Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,25 +152,6 @@ Learn more about `isfs` and `isfs-readonly` folders in the [documentation](https

When you have a folder or a workspace (including a multi-root one) open in VS Code, Server Manager displays a 'Current' node at the start of its tree if your workspace references any server defined in Server Manager. The linking happens automatically if you added workspace folders from Server Manager as described above. If you are using the client-side mode of working, your `objectscript.conn` setting needs to use the `server` property.

## Launching Management Portal

When you hover over a server entry in the tree two command buttons let you launch InterSystems Management Portal.

The first button uses VS Code's Simple Browser feature, which creates a tab alongside any documents you may have open. The second button opens Portal in your workstation's default web browser.

### Notes About Simple Browser

- There is only ever a single Simple Browser tab. Launching another server's Management Portal in it will replace the previous one.
- If the server version is InterSystems IRIS 2020.1.1 or later you will need to change a setting on the suite of web applications that implement Management Portal. This is a consequence of change [SGM031 - Support SameSite for CSP session and user cookies](https://docs.intersystems.com/iris20201/csp/docbook/relnotes/index.html#SGM031). Simple Browser will not be permitted to store Portal's session management cookies, so Portal must be willing to fall back to using the CSPCHD query parameter mechanism.
- Locate the five web applications whose path begins with `/csp/sys`
![Portal web app list](images/README/portalWebApps.png)

- Alter the `Use Cookie for Session` setting on each of them so it is `Autodetect` instead of `Always`.
![Portal web app detail](images/README/portalWebAppSetting.png)
Remember to save the change. The change is not thought to have any adverse effects on the usage of Portal from ordinary browsers, which will continue to use session cookies.

- When a 2020.1.1+ Portal has resorted to using CSPCHD (see above) a few inter-page links fail because they don't add the CSPCHD queryparam. One specific case is the breadcrumb links. Pending the arrival of an InterSystems correction (JIRA DP-404817) these links will take you to the login page. Either enter your credentials to proceed, or launch Simple Browser again from the Server Manager tree.

## Amending and Removing Servers

To manage your server definitions, including changing the username it connects with, [edit the relevant JSON file](https://code.visualstudio.com/docs/getstarted/settings).
Expand Down
23 changes: 12 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 8 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"multi-root ready"
],
"engines": {
"vscode": "^1.93.0"
"vscode": "^1.109.0"
},
"icon": "images/logo.png",
"categories": [
Expand Down Expand Up @@ -57,7 +57,7 @@
"@types/glob": "^7.1.1",
"@types/mocha": "^9.0.0",
"@types/node": "^20.14.0",
"@types/vscode": "^1.93.0",
"@types/vscode": "^1.109.0",
"@vscode/test-electron": "^2.3.8",
"@vscode/test-web": "^0.0.71",
"glob": "^7.1.6",
Expand Down Expand Up @@ -277,19 +277,14 @@
"command": "intersystems-community.servermanager.removeFromRecent",
"title": "Remove from Recent"
},
{
"command": "intersystems-community.servermanager.openPortalExternal",
"title": "Open Management Portal in External Browser",
"icon": "$(link-external)"
},
{
"command": "intersystems-community.servermanager.openPortalTab",
"title": "Open Management Portal in Tab",
"icon": "$(tools)"
"icon": "$(link-external)"
},
{
"command": "intersystems-community.servermanager.openPortalExplorerExternal",
"title": "Open Management Portal Here in External Browser",
"command": "intersystems-community.servermanager.openPortalExplorerTab",
"title": "Open Management Portal Here in Tab",
"icon": "$(link-external)"
},
{
Expand Down Expand Up @@ -396,12 +391,7 @@
"menus": {
"intersystems-community.servermanager.moreActions": [
{
"command": "intersystems-community.servermanager.openPortalTab",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
"group": "1_builtin@10"
},
{
"command": "intersystems-community.servermanager.openPortalExplorerExternal",
"command": "intersystems-community.servermanager.openPortalExplorerTab",
"when": "view == intersystems-community_servermanager && viewItem =~ /namespace$/",
"group": "1_builtin@10"
}
Expand Down Expand Up @@ -453,16 +443,12 @@
"command": "intersystems-community.servermanager.removeFromRecent",
"when": "false"
},
{
"command": "intersystems-community.servermanager.openPortalExternal",
"when": "false"
},
{
"command": "intersystems-community.servermanager.openPortalTab",
"when": "false"
},
{
"command": "intersystems-community.servermanager.openPortalExplorerExternal",
"command": "intersystems-community.servermanager.openPortalExplorerTab",
"when": "false"
},
{
Expand Down Expand Up @@ -611,7 +597,7 @@
"group": "inline@20"
},
{
"command": "intersystems-community.servermanager.openPortalExternal",
"command": "intersystems-community.servermanager.openPortalTab",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
"group": "inline@90"
},
Expand Down
24 changes: 24 additions & 0 deletions src/api/getPortalUri.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as vscode from "vscode";
import { Uri } from "vscode";
import { IServerSpec } from "@intersystems-community/intersystems-servermanager";
import { extensionId } from "../commonActivate";

export async function getPortalUri(
name: string,
page = "/csp/sys/UtilHome.csp",
namespace = "%SYS",
scope?: vscode.ConfigurationScope,
): Promise<Uri | undefined> {

// Use our own API so that the Recent folder updates with our activity
const myApi = vscode.extensions.getExtension(extensionId)?.exports;

const spec: IServerSpec | undefined = await myApi.getServerSpec(name, scope);
if (typeof spec !== "undefined") {

const webServer = spec.webServer;
const queryString = `$NAMESPACE=${encodeURIComponent(namespace)}`;

return vscode.Uri.parse(`${webServer.scheme}://${webServer.host}:${webServer.port}${webServer.pathPrefix}${page}?${queryString}`, true);
}
}
93 changes: 0 additions & 93 deletions src/api/getPortalUriWithToken.ts

This file was deleted.

36 changes: 15 additions & 21 deletions src/commonActivate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";
import { IServerName, IServerSpec } from "@intersystems-community/intersystems-servermanager";
import { addServer } from "./api/addServer";
import { BrowserTarget, getPortalUriWithToken } from "./api/getPortalUriWithToken";
import { getPortalUri } from "./api/getPortalUri";
import { getServerNames } from "./api/getServerNames";
import { getServerSpec } from "./api/getServerSpec";
import { getServerSummary } from "./api/getServerSummary";
Expand Down Expand Up @@ -168,36 +168,30 @@ export function commonActivate(context: vscode.ExtensionContext, view: ServerMan
await view.removeFromRecents(server.name);
}
}),
vscode.commands.registerCommand(`${extensionId}.openPortalExternal`, (server?: ServerTreeItem) => {
vscode.commands.registerCommand(`${extensionId}.openPortalTab`, async (server?: ServerTreeItem) => {
if (server?.contextValue?.match(/\.server\./) && server.name) {
getPortalUriWithToken(BrowserTarget.EXTERNAL, server.name, undefined, undefined, server?.params?.serverSummary?.scope).then((uriWithToken) => {
if (uriWithToken) {
vscode.env.openExternal(uriWithToken);
// It is essential to pass skipEncoding=true when converting the uri to a string,
// otherwise the querystring's & and = get encoded.
// Use Integrated Browser which arrived in 1.109
getPortalUri(server.name, undefined, undefined, server?.params?.serverSummary?.scope).then((uri) => {
if (uri) {
vscode.commands.executeCommand("workbench.action.browser.open", uri.toString(true));
}
});
}
}),
vscode.commands.registerCommand(`${extensionId}.openPortalTab`, (server?: ServerTreeItem) => {
if (server?.contextValue?.match(/\.server\./) && server.name) {
getPortalUriWithToken(BrowserTarget.SIMPLE, server.name, undefined, undefined, server?.params?.serverSummary?.scope).then((uriWithToken) => {
if (uriWithToken) {
//
// It is essential to pass skipEncoding=true when converting the uri to a string,
// otherwise the querystring's & and = get encoded.
vscode.commands.executeCommand("simpleBrowser.show", uriWithToken.toString(true));
}
});
}
}),
vscode.commands.registerCommand(`${extensionId}.openPortalExplorerExternal`, (namespaceTreeItem?: NamespaceTreeItem) => {
vscode.commands.registerCommand(`${extensionId}.openPortalExplorerTab`, (namespaceTreeItem?: NamespaceTreeItem) => {
if (namespaceTreeItem) {
const pathParts = namespaceTreeItem.id?.split(":");
if (pathParts && pathParts.length === 4) {
const serverName = pathParts[1];
const namespace = pathParts[3];
getPortalUriWithToken(BrowserTarget.EXTERNAL, serverName, "/csp/sys/exp/%25CSP.UI.Portal.ClassList.zen", namespace, namespaceTreeItem.parent?.parent?.params?.serverSummary?.scope).then((uriWithToken) => {
if (uriWithToken) {
vscode.env.openExternal(uriWithToken);
getPortalUri(serverName, "/csp/sys/exp/%2525CSP.UI.Portal.ClassList.zen", namespace, namespaceTreeItem.parent?.parent?.params?.serverSummary?.scope).then((uri) => {
if (uri) {
// It is essential to pass skipEncoding=true when converting the uri to a string,
// otherwise the querystring's & and = get encoded.
// Use Integrated Browser which arrived in 1.109
vscode.commands.executeCommand("workbench.action.browser.open", uri.toString(true));
}
});
}
Expand Down
4 changes: 0 additions & 4 deletions src/ui/serverManagerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,6 @@ export class ServerTreeItem extends SMTreeItem {
"server-environment",
color ? new vscode.ThemeColor("charts." + color) : undefined,
);

// TODO If single click on server item should open Portal tab
// this.command = {command: 'intersystems-community.servermanager.openPortalTab',
// title: 'Open Management Portal in Simple Browser Tab', arguments: [this]};
}
}

Expand Down