diff --git a/src/runner-server-vscode/index.ts b/src/runner-server-vscode/index.ts index d77cf221d99..8131b221d10 100644 --- a/src/runner-server-vscode/index.ts +++ b/src/runner-server-vscode/index.ts @@ -127,6 +127,7 @@ function activate(context : ExtensionContext) { var end = sdata.indexOf('\n', i + 1); var externalAddress = await getExternalIP(); address = sdata.substring(i, end).replace("[::]", externalAddress).replace("0.0.0.0", externalAddress).trim(); + var webviewAddress = sdata.substring(i, end).replace("[::]", "localhost").replace("0.0.0.0", "localhost").trim(); window.registerTreeDataProvider("workflow-view", new RSTreeDataProvider(context, address)); @@ -174,12 +175,13 @@ function activate(context : ExtensionContext) { return panel; } + const fullWebServerUri = webviewAddress && await env.asExternalUri( + Uri.parse(webviewAddress) + ); + var openPanel = async(name: string, url : string) => { await getPanel(); panel.title = name; - const fullWebServerUri = address && await env.asExternalUri( - Uri.parse(address) - ); const cspSource = panel.webview.cspSource; // Get the content Uri const style = panel.webview.asWebviewUri( @@ -206,9 +208,17 @@ function activate(context : ExtensionContext) { openPanel(name, `?view=allworkflows&extension=1#/0/${runId}/0/${id}`); }); + commands.registerCommand("runner.server.openjobexternal", (obj : TreeItem) => { + env.openExternal(Uri.parse(`${fullWebServerUri}?view=allworkflows#/0/${obj.command.arguments[0]}/0/${obj.command.arguments[1]}`)); + }); + commands.registerCommand("runner.server.openworkflowrun", runId => { openPanel(`#${runId}`, `?view=allworkflows&extension=1#/0/${runId}/0`); }); + + commands.registerCommand("runner.server.openworkflowrunexternal", (obj : TreeItem) => { + env.openExternal(Uri.parse(`${fullWebServerUri}?view=allworkflows#/0/${obj.command.arguments[0]}/0`)); + }); } }); serverproc.stderr.on('data', async (data) => { diff --git a/src/runner-server-vscode/package.json b/src/runner-server-vscode/package.json index b487d4b45b1..72b425969f5 100644 --- a/src/runner-server-vscode/package.json +++ b/src/runner-server-vscode/package.json @@ -42,6 +42,18 @@ "shortTitle": "Cancel", "icon": "$(stop-circle)" }, + { + "command": "runner.server.openjobexternal", + "title": "Open in Browser", + "shortTitle": "Open in Browser", + "icon": "$(globe)" + }, + { + "command": "runner.server.openworkflowrunexternal", + "title": "Open in Browser", + "shortTitle": "Open in Browser", + "icon": "$(globe)" + }, { "command": "runner.server.start-client", "title": "Start Runner.Client" @@ -72,7 +84,7 @@ } ], "views": { - "explorer": [ + "runner-server": [ { "id": "workflow-view", "name": "Workflow View" @@ -97,6 +109,25 @@ "command": "runner.server.workflow.cancel", "group": "inline", "when": "view == workflow-view && !(viewItem =~ /completed/) && (viewItem =~ /job/ || viewItem =~ /workflow/ )" +}, + { + "command": "runner.server.openjobexternal", + "group": "inline", + "when": "view == workflow-view && viewItem =~ /job/" + }, + { + "command": "runner.server.openworkflowrunexternal", + "group": "inline", + "when": "view == workflow-view && viewItem =~ /workflow/" + } + ] + }, + "viewsContainers": { + "activitybar": [ + { + "id": "runner-server", + "title": "Runner.Server", + "icon": "resources/icons/light/run.svg" } ] }