Skip to content

Commit

Permalink
Update the developer menu module
Browse files Browse the repository at this point in the history
Update the hook that we look for use CloseTab instead of print.

Add an option to copy the url which can be useful for developers.
  • Loading branch information
johnman committed Jan 24, 2024
1 parent 2e0d2a1 commit 0c16133
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Fixed - when launching multiple instances of an inline app asset it is possible to try and re-download an app asset that has just been downloaded or exists. We now fetch the app asset info to see if the platform already has the app asset and if it is the required version.
- Added util getCommandLineArgs to extract multiple command line arguments from a string into an array. Snap accepts an array of arguments and app assets and external apps take a string as an args parameter. This lets you specify arguments that cover scenarios where snap is disabled and enabled. Added tests to verify getCommandLineArgs behavior.
- Updated identity returned when launching a native app or app asset (either normally or through snap). The UUID is the app id if the app has been marked as instanceMode = "single" otherwise the uuid is appId/guid (guid being an instanceId). The name is the same as the UUID (as name is not specified in app asset/external process options). If your app supports having multiple instances and it registers intent handlers then we recommend passing the created UUID for your app instance using {OF-EXT-UUD} as part of the command line args so that the uuid can be used when you connect to the OpenFin runtime. When you then connect to the workspace platform interop broker (as the platform will be waiting on that connection to fire an intent against it) it will use the expected UUID as it's connection id.
- Update developer composite menu to use the Close menu option instead of Print as the positioning hook. Add Copy Url to the developer view context menu options.

## v16

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,31 @@ export class DeveloperActions implements Actions {
}
};

actionMap["copy-url"] = async (payload: CustomActionPayload): Promise<void> => {
if (payload.callerType === CustomActionCallerType.ViewTabContextMenu) {
const urls: string[] = [];
for (let i = 0; i < payload.selectedViews.length; i++) {
const viewIdentity = payload.selectedViews[i];
try {
const view = fin.View.wrapSync(viewIdentity);
const info = await view.getInfo();
urls.push(info.url);
} catch (error) {
this._logger?.error(
`Error while trying to capture view url for view ${viewIdentity.name}`,
error
);
}
}
if (urls.length > 0) {
const url = urls.join("\n");
await fin.Clipboard.writeText({
data: url
});
}
}
};

return actionMap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ export class DeveloperMenus implements Menus {
}
},
position: {
operation: "after",
type: "Print"
operation: "before",
type: "CloseTab"
},
separator: "before"
},
Expand All @@ -118,6 +118,22 @@ export class DeveloperMenus implements Menus {
type: "Custom",
customId: "developer-inspect"
}
},
{
include: true,
label: "Copy Url",
data: {
type: "Custom",
action: {
id: "copy-url"
}
},
position: {
operation: "after",
type: "Custom",
customId: "raise-create-app-definition-intent"
},
separator: "after"
}
];
}
Expand Down

0 comments on commit 0c16133

Please sign in to comment.