Skip to content

Commit

Permalink
SNAPSHOT.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsjohnmurray committed Apr 13, 2021
1 parent 9d121fa commit cec8d85
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 41 deletions.
16 changes: 3 additions & 13 deletions images/serverManager.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 3 additions & 13 deletions images/toolsContainer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 77 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "servermanager",
"displayName": "InterSystems Server Manager",
"version": "2.0.0-SNAPSHOT",
"version": "2.0.0-SNAPSHOT.1",
"publisher": "intersystems-community",
"description": "Helper extension for defining connections to InterSystems servers.",
"repository": {
Expand Down Expand Up @@ -60,6 +60,7 @@
"main": "./out/extension",
"activationEvents": [
"onView:intersystems-community_servermanager",
"onCommand:intersystems-community.servermanager.refreshTree",
"onCommand:intersystems-community.servermanager.addServer",
"onCommand:intersystems-community.servermanager.storePassword",
"onCommand:intersystems-community.servermanager.clearPassword",
Expand Down Expand Up @@ -241,7 +242,8 @@
{
"command": "intersystems-community.servermanager.openManagementPortalInSimpleBrowser",
"category": "InterSystems Server Manager",
"title": "Open Management Portal in Simple Browser Tab"
"title": "Open Management Portal in Simple Browser Tab",
"icon": "$(tools)"
},
{
"command": "intersystems-community.servermanager.storePassword",
Expand All @@ -258,9 +260,73 @@
"command": "intersystems-community.servermanager.importServers",
"category": "InterSystems Server Manager",
"title": "Import Servers from Registry"
},
{
"command": "intersystems-community.servermanager.setIconRed",
"title": "Red"
},
{
"command": "intersystems-community.servermanager.setIconOrange",
"title": "Orange"
},
{
"command": "intersystems-community.servermanager.setIconYellow",
"title": "Yellow"
},
{
"command": "intersystems-community.servermanager.setIconGreen",
"title": "Green"
},
{
"command": "intersystems-community.servermanager.setIconBlue",
"title": "Blue"
},
{
"command": "intersystems-community.servermanager.setIconPurple",
"title": "Purple"
},
{
"command": "intersystems-community.servermanager.resetIconColor",
"title": "default"
}
],
"submenus": [
{
"id": "intersystems-community.servermanager.iconColor",
"label": "Set Icon Color"
}
],
"menus": {
"intersystems-community.servermanager.iconColor": [
{
"command": "intersystems-community.servermanager.setIconRed",
"group": "color"
},
{
"command": "intersystems-community.servermanager.setIconOrange",
"group": "color"
},
{
"command": "intersystems-community.servermanager.setIconYellow",
"group": "color"
},
{
"command": "intersystems-community.servermanager.setIconGreen",
"group": "color"
},
{
"command": "intersystems-community.servermanager.setIconBlue",
"group": "color"
},
{
"command": "intersystems-community.servermanager.setIconPurple",
"group": "color"
},
{
"command": "intersystems-community.servermanager.resetIconColor",
"group": "reset"
}
],
"commandPalette": [
{
"command": "intersystems-community.servermanager.importServers",
Expand Down Expand Up @@ -310,11 +376,20 @@
"when": "view == intersystems-community_servermanager && viewItem == starred.server.starred",
"group": "inline@10"
},
{
"command": "intersystems-community.servermanager.openManagementPortalInSimpleBrowser",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
"group": "inline@80"
},
{
"command": "intersystems-community.servermanager.openManagementPortalExternal",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
"group": "inline@90"
},
{
"submenu": "intersystems-community.servermanager.iconColor",
"group": "color"
},
{
"command": "intersystems-community.servermanager.storePassword",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
Expand Down
7 changes: 5 additions & 2 deletions src/api/getPortalUriWithCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import * as vscode from 'vscode';
import { Uri } from 'vscode';
import { getServerSpec } from './getServerSpec';
import { extensionId } from '../extension';

export async function getPortalUriWithCredentials(name: string, scope?: vscode.ConfigurationScope): Promise<Uri | undefined> {
return getServerSpec(name, scope).then((spec) => {

// Use our own API so that the Recent folder updates with our activity
const myApi = vscode.extensions.getExtension(extensionId)?.exports;
return myApi.getServerSpec(name, scope).then((spec) => {
if (typeof spec !== 'undefined') {
const webServer = spec.webServer;
let queryString = '';
Expand Down
82 changes: 77 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,19 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.addServer`, async () => {
await addServer();
view.refreshTree();
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.addToStarred`, async (server?: ServerTreeItem) => {
if (server?.contextValue?.match(/\.server\./) && server.name) {
await view.addToFavorites(server.name);
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.removeFromStarred`, async (server?: ServerTreeItem) => {
if (server?.contextValue?.endsWith('.starred') && server.name) {
await view.removeFromFavorites(server.name);
view.refreshTree();
}
})
);
Expand Down Expand Up @@ -120,6 +117,62 @@ export function activate(context: vscode.ExtensionContext) {
}
});
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.setIconRed`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, 'red');
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.setIconOrange`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, 'orange');
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.setIconYellow`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, 'yellow');
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.setIconGreen`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, 'green');
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.setIconBlue`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, 'blue');
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.setIconPurple`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, 'purple');
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.resetIconColor`, (server?: ServerTreeItem) => {
if (server?.name) {
view.setIconColor(server.name, undefined);
view.refreshTree();
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.importServers`, async () => {
Expand All @@ -128,10 +181,25 @@ export function activate(context: vscode.ExtensionContext) {
})
);

// Listen for relevant configuration changes
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('intersystems.servers') || e.affectsConfiguration('objectscript.conn')) {
view.refreshTree();
}
}));

// Expose our API
let api = {
async pickServer(scope?: vscode.ConfigurationScope, options: vscode.QuickPickOptions = {}): Promise<string | undefined> {
return await pickServer(scope, options);
const name = await pickServer(scope, options);

/*
if (name) {
view.addToRecents(name);
}
*/

return name;
},
getServerNames(scope?: vscode.ConfigurationScope): ServerName[] {
return getServerNames(scope);
Expand All @@ -142,7 +210,11 @@ export function activate(context: vscode.ExtensionContext) {
},

async getServerSpec(name: string, scope?: vscode.ConfigurationScope, flushCredentialCache: boolean = false): Promise<ServerSpec | undefined> {
return await getServerSpec(name, scope, flushCredentialCache);
const spec = await getServerSpec(name, scope, flushCredentialCache);
if (spec) {
view.addToRecents(name);
}
return spec;
},

onDidChangePassword(): vscode.Event<string> {
Expand Down
Loading

0 comments on commit cec8d85

Please sign in to comment.