Skip to content

Commit cec8d85

Browse files
committed
SNAPSHOT.1
1 parent 9d121fa commit cec8d85

File tree

6 files changed

+235
-41
lines changed

6 files changed

+235
-41
lines changed

images/serverManager.svg

Lines changed: 3 additions & 13 deletions
Loading

images/toolsContainer.svg

Lines changed: 3 additions & 13 deletions
Loading

package.json

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "servermanager",
33
"displayName": "InterSystems Server Manager",
4-
"version": "2.0.0-SNAPSHOT",
4+
"version": "2.0.0-SNAPSHOT.1",
55
"publisher": "intersystems-community",
66
"description": "Helper extension for defining connections to InterSystems servers.",
77
"repository": {
@@ -60,6 +60,7 @@
6060
"main": "./out/extension",
6161
"activationEvents": [
6262
"onView:intersystems-community_servermanager",
63+
"onCommand:intersystems-community.servermanager.refreshTree",
6364
"onCommand:intersystems-community.servermanager.addServer",
6465
"onCommand:intersystems-community.servermanager.storePassword",
6566
"onCommand:intersystems-community.servermanager.clearPassword",
@@ -241,7 +242,8 @@
241242
{
242243
"command": "intersystems-community.servermanager.openManagementPortalInSimpleBrowser",
243244
"category": "InterSystems Server Manager",
244-
"title": "Open Management Portal in Simple Browser Tab"
245+
"title": "Open Management Portal in Simple Browser Tab",
246+
"icon": "$(tools)"
245247
},
246248
{
247249
"command": "intersystems-community.servermanager.storePassword",
@@ -258,9 +260,73 @@
258260
"command": "intersystems-community.servermanager.importServers",
259261
"category": "InterSystems Server Manager",
260262
"title": "Import Servers from Registry"
263+
},
264+
{
265+
"command": "intersystems-community.servermanager.setIconRed",
266+
"title": "Red"
267+
},
268+
{
269+
"command": "intersystems-community.servermanager.setIconOrange",
270+
"title": "Orange"
271+
},
272+
{
273+
"command": "intersystems-community.servermanager.setIconYellow",
274+
"title": "Yellow"
275+
},
276+
{
277+
"command": "intersystems-community.servermanager.setIconGreen",
278+
"title": "Green"
279+
},
280+
{
281+
"command": "intersystems-community.servermanager.setIconBlue",
282+
"title": "Blue"
283+
},
284+
{
285+
"command": "intersystems-community.servermanager.setIconPurple",
286+
"title": "Purple"
287+
},
288+
{
289+
"command": "intersystems-community.servermanager.resetIconColor",
290+
"title": "default"
291+
}
292+
],
293+
"submenus": [
294+
{
295+
"id": "intersystems-community.servermanager.iconColor",
296+
"label": "Set Icon Color"
261297
}
262298
],
263299
"menus": {
300+
"intersystems-community.servermanager.iconColor": [
301+
{
302+
"command": "intersystems-community.servermanager.setIconRed",
303+
"group": "color"
304+
},
305+
{
306+
"command": "intersystems-community.servermanager.setIconOrange",
307+
"group": "color"
308+
},
309+
{
310+
"command": "intersystems-community.servermanager.setIconYellow",
311+
"group": "color"
312+
},
313+
{
314+
"command": "intersystems-community.servermanager.setIconGreen",
315+
"group": "color"
316+
},
317+
{
318+
"command": "intersystems-community.servermanager.setIconBlue",
319+
"group": "color"
320+
},
321+
{
322+
"command": "intersystems-community.servermanager.setIconPurple",
323+
"group": "color"
324+
},
325+
{
326+
"command": "intersystems-community.servermanager.resetIconColor",
327+
"group": "reset"
328+
}
329+
],
264330
"commandPalette": [
265331
{
266332
"command": "intersystems-community.servermanager.importServers",
@@ -310,11 +376,20 @@
310376
"when": "view == intersystems-community_servermanager && viewItem == starred.server.starred",
311377
"group": "inline@10"
312378
},
379+
{
380+
"command": "intersystems-community.servermanager.openManagementPortalInSimpleBrowser",
381+
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
382+
"group": "inline@80"
383+
},
313384
{
314385
"command": "intersystems-community.servermanager.openManagementPortalExternal",
315386
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
316387
"group": "inline@90"
317388
},
389+
{
390+
"submenu": "intersystems-community.servermanager.iconColor",
391+
"group": "color"
392+
},
318393
{
319394
"command": "intersystems-community.servermanager.storePassword",
320395
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",

src/api/getPortalUriWithCredentials.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import * as vscode from 'vscode';
22
import { Uri } from 'vscode';
3-
import { getServerSpec } from './getServerSpec';
3+
import { extensionId } from '../extension';
44

55
export async function getPortalUriWithCredentials(name: string, scope?: vscode.ConfigurationScope): Promise<Uri | undefined> {
6-
return getServerSpec(name, scope).then((spec) => {
6+
7+
// Use our own API so that the Recent folder updates with our activity
8+
const myApi = vscode.extensions.getExtension(extensionId)?.exports;
9+
return myApi.getServerSpec(name, scope).then((spec) => {
710
if (typeof spec !== 'undefined') {
811
const webServer = spec.webServer;
912
let queryString = '';

src/extension.ts

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,19 @@ export function activate(context: vscode.ExtensionContext) {
5656
context.subscriptions.push(
5757
vscode.commands.registerCommand(`${extensionId}.addServer`, async () => {
5858
await addServer();
59-
view.refreshTree();
6059
})
6160
);
6261
context.subscriptions.push(
6362
vscode.commands.registerCommand(`${extensionId}.addToStarred`, async (server?: ServerTreeItem) => {
6463
if (server?.contextValue?.match(/\.server\./) && server.name) {
6564
await view.addToFavorites(server.name);
66-
view.refreshTree();
6765
}
6866
})
6967
);
7068
context.subscriptions.push(
7169
vscode.commands.registerCommand(`${extensionId}.removeFromStarred`, async (server?: ServerTreeItem) => {
7270
if (server?.contextValue?.endsWith('.starred') && server.name) {
7371
await view.removeFromFavorites(server.name);
74-
view.refreshTree();
7572
}
7673
})
7774
);
@@ -120,6 +117,62 @@ export function activate(context: vscode.ExtensionContext) {
120117
}
121118
});
122119
})
120+
);
121+
context.subscriptions.push(
122+
vscode.commands.registerCommand(`${extensionId}.setIconRed`, (server?: ServerTreeItem) => {
123+
if (server?.name) {
124+
view.setIconColor(server.name, 'red');
125+
view.refreshTree();
126+
}
127+
})
128+
);
129+
context.subscriptions.push(
130+
vscode.commands.registerCommand(`${extensionId}.setIconOrange`, (server?: ServerTreeItem) => {
131+
if (server?.name) {
132+
view.setIconColor(server.name, 'orange');
133+
view.refreshTree();
134+
}
135+
})
136+
);
137+
context.subscriptions.push(
138+
vscode.commands.registerCommand(`${extensionId}.setIconYellow`, (server?: ServerTreeItem) => {
139+
if (server?.name) {
140+
view.setIconColor(server.name, 'yellow');
141+
view.refreshTree();
142+
}
143+
})
144+
);
145+
context.subscriptions.push(
146+
vscode.commands.registerCommand(`${extensionId}.setIconGreen`, (server?: ServerTreeItem) => {
147+
if (server?.name) {
148+
view.setIconColor(server.name, 'green');
149+
view.refreshTree();
150+
}
151+
})
152+
);
153+
context.subscriptions.push(
154+
vscode.commands.registerCommand(`${extensionId}.setIconBlue`, (server?: ServerTreeItem) => {
155+
if (server?.name) {
156+
view.setIconColor(server.name, 'blue');
157+
view.refreshTree();
158+
}
159+
})
160+
);
161+
context.subscriptions.push(
162+
vscode.commands.registerCommand(`${extensionId}.setIconPurple`, (server?: ServerTreeItem) => {
163+
if (server?.name) {
164+
view.setIconColor(server.name, 'purple');
165+
view.refreshTree();
166+
}
167+
})
168+
);
169+
context.subscriptions.push(
170+
vscode.commands.registerCommand(`${extensionId}.resetIconColor`, (server?: ServerTreeItem) => {
171+
if (server?.name) {
172+
view.setIconColor(server.name, undefined);
173+
view.refreshTree();
174+
}
175+
})
123176
);
124177
context.subscriptions.push(
125178
vscode.commands.registerCommand(`${extensionId}.importServers`, async () => {
@@ -128,10 +181,25 @@ export function activate(context: vscode.ExtensionContext) {
128181
})
129182
);
130183

184+
// Listen for relevant configuration changes
185+
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
186+
if (e.affectsConfiguration('intersystems.servers') || e.affectsConfiguration('objectscript.conn')) {
187+
view.refreshTree();
188+
}
189+
}));
190+
191+
// Expose our API
131192
let api = {
132193
async pickServer(scope?: vscode.ConfigurationScope, options: vscode.QuickPickOptions = {}): Promise<string | undefined> {
133-
return await pickServer(scope, options);
194+
const name = await pickServer(scope, options);
134195

196+
/*
197+
if (name) {
198+
view.addToRecents(name);
199+
}
200+
*/
201+
202+
return name;
135203
},
136204
getServerNames(scope?: vscode.ConfigurationScope): ServerName[] {
137205
return getServerNames(scope);
@@ -142,7 +210,11 @@ export function activate(context: vscode.ExtensionContext) {
142210
},
143211

144212
async getServerSpec(name: string, scope?: vscode.ConfigurationScope, flushCredentialCache: boolean = false): Promise<ServerSpec | undefined> {
145-
return await getServerSpec(name, scope, flushCredentialCache);
213+
const spec = await getServerSpec(name, scope, flushCredentialCache);
214+
if (spec) {
215+
view.addToRecents(name);
216+
}
217+
return spec;
146218
},
147219

148220
onDidChangePassword(): vscode.Event<string> {

0 commit comments

Comments
 (0)