Skip to content

Commit 86f2504

Browse files
committed
Add 'Alt' alternatives on the Edit and View buttons to add ?csp param to isfs folders
1 parent a667dd6 commit 86f2504

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

package.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@
314314
"command": "intersystems-community.servermanager.viewNamespace",
315315
"title": "View Code in Namespace",
316316
"icon": "$(eye)"
317+
},
318+
{
319+
"command": "intersystems-community.servermanager.editNamespaceWebAppFiles",
320+
"title": "Edit Web Application Files for Namespace",
321+
"icon": "$(file-code)"
322+
},
323+
{
324+
"command": "intersystems-community.servermanager.viewNamespaceWebAppFiles",
325+
"title": "View Web Application Files for Namespace",
326+
"icon": "$(telescope)"
317327
}
318328
],
319329
"submenus": [
@@ -373,6 +383,54 @@
373383
{
374384
"command": "intersystems-community.servermanager.openPortalTab",
375385
"when": "false"
386+
},
387+
{
388+
"command": "intersystems-community.servermanager.retryServer",
389+
"when": "false"
390+
},
391+
{
392+
"command": "intersystems-community.servermanager.setIconRed",
393+
"when": "false"
394+
},
395+
{
396+
"command": "intersystems-community.servermanager.setIconOrange",
397+
"when": "false"
398+
},
399+
{
400+
"command": "intersystems-community.servermanager.setIconYellow",
401+
"when": "false"
402+
},
403+
{
404+
"command": "intersystems-community.servermanager.setIconGreen",
405+
"when": "false"
406+
},
407+
{
408+
"command": "intersystems-community.servermanager.setIconBlue",
409+
"when": "false"
410+
},
411+
{
412+
"command": "intersystems-community.servermanager.setIconPurple",
413+
"when": "false"
414+
},
415+
{
416+
"command": "intersystems-community.servermanager.resetIconColor",
417+
"when": "false"
418+
},
419+
{
420+
"command": "intersystems-community.servermanager.editNamespace",
421+
"when": "false"
422+
},
423+
{
424+
"command": "intersystems-community.servermanager.viewNamespace",
425+
"when": "false"
426+
},
427+
{
428+
"command": "intersystems-community.servermanager.editNamespaceWebAppFiles",
429+
"when": "false"
430+
},
431+
{
432+
"command": "intersystems-community.servermanager.viewNamespaceWebAppFiles",
433+
"when": "false"
376434
}
377435
],
378436
"view/title": [
@@ -420,11 +478,13 @@
420478
},
421479
{
422480
"command": "intersystems-community.servermanager.editNamespace",
481+
"alt": "intersystems-community.servermanager.editNamespaceWebAppFiles",
423482
"when": "view == intersystems-community_servermanager && viewItem =~ /namespace$/",
424483
"group": "inline@10"
425484
},
426485
{
427486
"command": "intersystems-community.servermanager.viewNamespace",
487+
"alt": "intersystems-community.servermanager.viewNamespaceWebAppFiles",
428488
"when": "view == intersystems-community_servermanager && viewItem =~ /namespace$/",
429489
"group": "inline@20"
430490
},

src/extension.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,16 @@ export function activate(context: vscode.ExtensionContext) {
202202
})
203203
);
204204

205-
const addWorkspaceFolderAsync = async (readonly: boolean, namespaceTreeItem?: ServerTreeItem) => {
205+
const addWorkspaceFolderAsync = async (readonly: boolean, csp: boolean, namespaceTreeItem?: ServerTreeItem) => {
206206
if (namespaceTreeItem) {
207207
const pathParts = namespaceTreeItem.id?.split(':');
208208
if (pathParts && pathParts.length === 4) {
209209
const serverName = pathParts[1];
210210
const namespace = pathParts[3];
211211
const serverSpec = await getServerSpec(serverName, undefined, undefined, true);
212212
if (serverSpec) {
213-
const uri = vscode.Uri.parse(`isfs${readonly ? "-readonly" : ""}://${serverName}:${namespace}/${serverSpec.webServer.pathPrefix || ''}`);
214-
const label = `${serverName}:${namespace}${readonly ? " (read-only)" : ""}`;
213+
const uri = vscode.Uri.parse(`isfs${readonly ? "-readonly" : ""}://${serverName}:${namespace}/${serverSpec.webServer.pathPrefix || ''}${csp ? '?csp' : ''}`);
214+
const label = `${serverName}:${namespace}${csp ? ' webfiles' : ''}${readonly ? " (read-only)" : ""}`;
215215
const added = vscode.workspace.updateWorkspaceFolders(
216216
vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders.length : 0,
217217
0,
@@ -232,11 +232,19 @@ export function activate(context: vscode.ExtensionContext) {
232232
}
233233

234234
context.subscriptions.push(
235-
vscode.commands.registerCommand(`${extensionId}.editNamespace`, async (namespaceTreeItem?: ServerTreeItem) => {await addWorkspaceFolderAsync(false, namespaceTreeItem)})
235+
vscode.commands.registerCommand(`${extensionId}.editNamespace`, async (namespaceTreeItem?: ServerTreeItem) => {await addWorkspaceFolderAsync(false, false, namespaceTreeItem)})
236236
);
237237

238238
context.subscriptions.push(
239-
vscode.commands.registerCommand(`${extensionId}.viewNamespace`, async (namespaceTreeItem?: ServerTreeItem) => {await addWorkspaceFolderAsync(true, namespaceTreeItem)})
239+
vscode.commands.registerCommand(`${extensionId}.viewNamespace`, async (namespaceTreeItem?: ServerTreeItem) => {await addWorkspaceFolderAsync(true, false, namespaceTreeItem)})
240+
);
241+
242+
context.subscriptions.push(
243+
vscode.commands.registerCommand(`${extensionId}.editNamespaceWebAppFiles`, async (namespaceTreeItem?: ServerTreeItem) => {await addWorkspaceFolderAsync(false, true, namespaceTreeItem)})
244+
);
245+
246+
context.subscriptions.push(
247+
vscode.commands.registerCommand(`${extensionId}.viewNamespaceWebAppFiles`, async (namespaceTreeItem?: ServerTreeItem) => {await addWorkspaceFolderAsync(true, true, namespaceTreeItem)})
240248
);
241249

242250
// Listen for relevant configuration changes

0 commit comments

Comments
 (0)