diff --git a/directory/sail.json b/directory/sail.json index 7d59be0e..f19939b9 100644 --- a/directory/sail.json +++ b/directory/sail.json @@ -108,77 +108,6 @@ "version": "1.0.0", "publisher": "FINOS", "icons": [] - }, - { - "appId": "pricer", - "name": "Pricer", - "title": "Pricer", - "description": "A demo app for the FDC3 Developer Course", - "icons": [ - { - "src": "http://localhost:5000/static/pricer/icon.png" - } - ], - "screenshots": [ - { - "src": "http://localhost:5000/static/pricer/screenshot.png", - "label": "Demo Screenshot" - } - ], - "type": "web", - "details": { - "url": "http://localhost:5000/static/pricer/index.html" - }, - "interop": { - "intents": { - "listensFor": { - "ViewQuote": { - "displayName": "View Quote", - "contexts": [ - "fdc3.instrument" - ] - }, - "demo.GetPrices": { - "displayName": "Get Prices", - "contexts": [ - "fdc3.instrument" - ] - } - } - } - }, - "hostManifests": { - "sail": { - "injectApi": "2.0" - } - } - }, - { - "appId": "tradelist", - "name": "TradeList", - "title": "TradeList", - "description": "A demo app for the FDC3 Developer Course", - "icons": [ - { - "src": "http://localhost:5000/static/tradelist/icon.png" - } - ], - "screenshots": [ - { - "src": "http://localhost:5000/static/tradelist/screenshot.png", - "label": "Demo Screenshot" - } - ], - "type": "web", - "details": { - "url": "http://localhost:5000/static/tradelist/index.html" - }, - "interop": {}, - "hostManifests": { - "sail": { - "injectApi": "2.0" - } - } } ], "message": "OK" diff --git a/src/client/grid/grid.tsx b/src/client/grid/grid.tsx index 3405a866..2eea991a 100644 --- a/src/client/grid/grid.tsx +++ b/src/client/grid/grid.tsx @@ -5,6 +5,7 @@ import "gridstack/dist/gridstack.css" import { GridsState } from "./gridstate" import { AppState, getAppState } from "../state/AppState" import { State } from "@kite9/fdc3-web-impl" +import { AppHosting } from "../../server/da/SailServerContext" type GridsProps = { cs: ClientState; gs: GridsState; as: AppState; id: string } @@ -142,13 +143,14 @@ export const Content = ({ {panel.title}

- + {/* { cs.removePanel(panel.panelId) + as.open(panel.appId, AppHosting.Tab) window.open(panel.url, "_blank") }} - /> + /> */}
diff --git a/src/client/state/AppState.ts b/src/client/state/AppState.ts index 3b99061a..3a5f2f2a 100644 --- a/src/client/state/AppState.ts +++ b/src/client/state/AppState.ts @@ -12,7 +12,7 @@ export interface AppState { registerAppWindow(window: Window, instanceId: string): void - open(detail: DirectoryApp): Promise + open(detail: DirectoryApp, destination?: AppHosting): Promise getAppState(instanceId: string): State | undefined @@ -125,9 +125,9 @@ class DefaultAppState implements AppState { * Opens either a new panel or a browser tab for the application to go in, * returns the instance id for the new thing. */ - open(detail: DirectoryApp): Promise { + open(detail: DirectoryApp, destination?: AppHosting): Promise { return new Promise(async (resolve, _reject) => { - const hosting: AppHosting = (detail.hostManifests as any)?.sail?.forceNewWindow ? AppHosting.Tab : AppHosting.Frame + const hosting: AppHosting = destination ?? (detail.hostManifests as any)?.sail?.forceNewWindow ? AppHosting.Tab : AppHosting.Frame const instanceId = await getServerState().registerAppLaunch(detail.appId, hosting) if (hosting == AppHosting.Tab) { const w = window.open((detail.details as WebAppDetails).url, "_blank")!!; diff --git a/src/server/da/initSocketService.ts b/src/server/da/initSocketService.ts index 8ce364ae..1e10e0b9 100644 --- a/src/server/da/initSocketService.ts +++ b/src/server/da/initSocketService.ts @@ -116,9 +116,10 @@ export function initSocketService(httpServer: any, sessions: Map 0)) { console.error("App tried to connect with invalid instance id, allowing connection anyway ", appInstanceId) + const instanceDetails: SailData = { appId: props.appId, instanceId: appInstanceId, @@ -130,11 +131,12 @@ export function initSocketService(httpServer: any, sessions: Map