Skip to content

Commit 824d83c

Browse files
authored
VS Code extension: native sandbox/log features, user-facing settings (#208)
* VS Code extension: native sandbox/log features, user-facing settings Replace ODS sandbox management and storefront-next-cartridge webviews with native TreeView + commands pattern. Add log tailing feature. Add contributes.configuration settings for feature toggles, log level, and sandbox polling interval. Add realm config support to SDK. - Sandbox Explorer: native TreeView with realm/sandbox hierarchy, lifecycle commands (create, delete, start, stop, restart), polling - Log Tailing: start/stop commands streaming to output channel - Settings (b2c-dx.*): feature enable/disable, logLevel (replaces hardcoded trace), sandbox.pollingInterval - SDK: realm field in dw.json / NormalizedConfig - Removed: ods-management.html, storefront-next-cartridge.html * Hide context-only commands from Command Palette Tree-view commands that require a node argument (sandbox lifecycle, webdav file ops, content export/remove) silently no-op when invoked from F1. Add commandPalette when:false entries to hide them.
1 parent 4aaf658 commit 824d83c

File tree

14 files changed

+1144
-1099
lines changed

14 files changed

+1144
-1099
lines changed

packages/b2c-tooling-sdk/src/config/dw-json.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export interface DwJsonConfig {
6767
tenantId?: string;
6868
/** ODS API hostname */
6969
sandboxApiHost?: string;
70+
/** Default ODS realm for sandbox operations */
71+
realm?: string;
7072
/** Default content library ID for content export/list commands */
7173
contentLibrary?: string;
7274
/** Optional CIP analytics host override */

packages/b2c-tooling-sdk/src/config/mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export function mapDwJsonToNormalizedConfig(json: DwJsonConfig): NormalizedConfi
116116
shortCode: json.shortCode,
117117
tenantId: json.tenantId,
118118
sandboxApiHost: json.sandboxApiHost,
119+
realm: json.realm,
119120
contentLibrary: json.contentLibrary,
120121
cipHost: json.cipHost,
121122
instanceName: json.name,
@@ -315,6 +316,7 @@ export function mergeConfigsWithProtection(
315316
contentLibrary: overrides.contentLibrary ?? base.contentLibrary,
316317
cipHost: overrides.cipHost ?? base.cipHost,
317318
sandboxApiHost: overrides.sandboxApiHost ?? base.sandboxApiHost,
319+
realm: overrides.realm ?? base.realm,
318320
instanceName: overrides.instanceName ?? base.instanceName,
319321
projectDirectory: overrides.projectDirectory ?? base.projectDirectory,
320322
workingDirectory: overrides.workingDirectory ?? base.workingDirectory,

packages/b2c-tooling-sdk/src/config/sources/package-json-source.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const ALLOWED_FIELDS: (keyof NormalizedConfig)[] = [
2929
'mrtOrigin',
3030
'accountManagerHost',
3131
'sandboxApiHost',
32+
'realm',
3233
];
3334

3435
/**

packages/b2c-tooling-sdk/src/config/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export interface NormalizedConfig {
5757
// ODS (On-Demand Sandbox)
5858
/** ODS API hostname */
5959
sandboxApiHost?: string;
60+
/** Default ODS realm for sandbox operations */
61+
realm?: string;
6062

6163
// MRT fields
6264
/** MRT project slug */

packages/b2c-vs-extension/package.json

Lines changed: 207 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,51 @@
2323
"onFileSystem:b2c-webdav",
2424
"onFileSystem:b2c-content",
2525
"onCommand:b2c-dx.openUI",
26-
"onCommand:b2c-dx.handleStorefrontNextCartridge",
2726
"onCommand:b2c-dx.promptAgent",
2827
"onCommand:b2c-dx.listWebDav",
2928
"onCommand:b2c-dx.scapiExplorer",
30-
"onCommand:b2c-dx.odsManagement"
29+
"onView:b2cSandboxExplorer"
3130
],
3231
"main": "./dist/extension.js",
3332
"contributes": {
33+
"configuration": {
34+
"title": "B2C DX",
35+
"properties": {
36+
"b2c-dx.features.sandboxExplorer": {
37+
"type": "boolean",
38+
"default": true,
39+
"description": "Enable the Sandbox Explorer sidebar."
40+
},
41+
"b2c-dx.features.webdavBrowser": {
42+
"type": "boolean",
43+
"default": true,
44+
"description": "Enable the WebDAV Browser."
45+
},
46+
"b2c-dx.features.contentLibraries": {
47+
"type": "boolean",
48+
"default": true,
49+
"description": "Enable the Content Libraries browser."
50+
},
51+
"b2c-dx.features.logTailing": {
52+
"type": "boolean",
53+
"default": true,
54+
"description": "Enable log tailing commands."
55+
},
56+
"b2c-dx.logLevel": {
57+
"type": "string",
58+
"default": "info",
59+
"enum": ["trace", "debug", "info", "warn", "error", "silent"],
60+
"description": "Log verbosity level for the B2C DX output channel."
61+
},
62+
"b2c-dx.sandbox.pollingInterval": {
63+
"type": "number",
64+
"default": 10,
65+
"minimum": 2,
66+
"maximum": 300,
67+
"description": "Seconds between polls during sandbox state transitions."
68+
}
69+
}
70+
},
3471
"submenus": [
3572
{
3673
"id": "b2c-dx.submenu",
@@ -43,6 +80,11 @@
4380
"id": "b2c-dx",
4481
"title": "B2C-DX",
4582
"icon": "media/b2c-icon.svg"
83+
},
84+
{
85+
"id": "b2c-dx-sandboxes",
86+
"title": "B2C-DX Sandboxes",
87+
"icon": "$(server-environment)"
4688
}
4789
]
4890
},
@@ -52,13 +94,20 @@
5294
"id": "b2cWebdavExplorer",
5395
"name": "WebDAV Browser",
5496
"icon": "media/b2c-icon.svg",
55-
"contextualTitle": "B2C Commerce"
97+
"contextualTitle": "B2C-DX"
5698
},
5799
{
58100
"id": "b2cContentExplorer",
59101
"name": "Libraries",
60102
"icon": "media/b2c-icon.svg",
61-
"contextualTitle": "B2C Commerce Content"
103+
"contextualTitle": "B2C-DX"
104+
}
105+
],
106+
"b2c-dx-sandboxes": [
107+
{
108+
"id": "b2cSandboxExplorer",
109+
"name": "Realm Explorer",
110+
"contextualTitle": "B2C-DX"
62111
}
63112
]
64113
},
@@ -70,6 +119,10 @@
70119
{
71120
"view": "b2cContentExplorer",
72121
"contents": "No content libraries configured.\n\nSet \"contentLibrary\" in dw.json or add a library manually.\n\n[Add Library](command:b2c-dx.content.addLibrary)"
122+
},
123+
{
124+
"view": "b2cSandboxExplorer",
125+
"contents": "No sandbox realms configured.\n\nSet \"realm\" in dw.json or add a realm manually.\n\n[Add Realm](command:b2c-dx.sandbox.addRealm)"
73126
}
74127
],
75128
"commands": [
@@ -78,11 +131,6 @@
78131
"title": "Open Page Designer Assistant UI",
79132
"category": "B2C DX - Page Designer Assistant"
80133
},
81-
{
82-
"command": "b2c-dx.handleStorefrontNextCartridge",
83-
"title": "Storefront Next Cartridge",
84-
"category": "B2C DX - Page Designer Assistant"
85-
},
86134
{
87135
"command": "b2c-dx.promptAgent",
88136
"title": "Prompt Agent",
@@ -99,10 +147,87 @@
99147
"category": "B2C DX"
100148
},
101149
{
102-
"command": "b2c-dx.odsManagement",
103-
"title": "On Demand Sandbox (ods) Management",
150+
"command": "b2c-dx.sandbox.refresh",
151+
"title": "Refresh",
152+
"icon": "$(refresh)",
153+
"category": "B2C DX - Sandboxes"
154+
},
155+
{
156+
"command": "b2c-dx.sandbox.addRealm",
157+
"title": "Add Realm",
158+
"icon": "$(add)",
159+
"category": "B2C DX - Sandboxes"
160+
},
161+
{
162+
"command": "b2c-dx.sandbox.removeRealm",
163+
"title": "Remove Realm",
164+
"icon": "$(remove)",
165+
"category": "B2C DX - Sandboxes"
166+
},
167+
{
168+
"command": "b2c-dx.sandbox.create",
169+
"title": "Create Sandbox",
170+
"icon": "$(plus)",
171+
"category": "B2C DX - Sandboxes"
172+
},
173+
{
174+
"command": "b2c-dx.sandbox.delete",
175+
"title": "Delete Sandbox",
176+
"icon": "$(trash)",
177+
"category": "B2C DX - Sandboxes"
178+
},
179+
{
180+
"command": "b2c-dx.sandbox.start",
181+
"title": "Start Sandbox",
182+
"icon": "$(debug-start)",
183+
"category": "B2C DX - Sandboxes"
184+
},
185+
{
186+
"command": "b2c-dx.sandbox.stop",
187+
"title": "Stop Sandbox",
188+
"icon": "$(debug-stop)",
189+
"category": "B2C DX - Sandboxes"
190+
},
191+
{
192+
"command": "b2c-dx.sandbox.restart",
193+
"title": "Restart Sandbox",
194+
"icon": "$(debug-restart)",
195+
"category": "B2C DX - Sandboxes"
196+
},
197+
{
198+
"command": "b2c-dx.sandbox.viewDetails",
199+
"title": "View Details",
200+
"icon": "$(info)",
201+
"category": "B2C DX - Sandboxes"
202+
},
203+
{
204+
"command": "b2c-dx.sandbox.openBM",
205+
"title": "Open Business Manager",
206+
"icon": "$(link-external)",
207+
"category": "B2C DX - Sandboxes"
208+
},
209+
{
210+
"command": "b2c-dx.instance.inspect",
211+
"title": "B2C Instance Config",
212+
"category": "B2C DX"
213+
},
214+
{
215+
"command": "b2c-dx.instance.switch",
216+
"title": "Switch Active Instance",
104217
"category": "B2C DX"
105218
},
219+
{
220+
"command": "b2c-dx.logs.startTail",
221+
"title": "Start Tailing Logs",
222+
"icon": "$(output)",
223+
"category": "B2C DX - Logs"
224+
},
225+
{
226+
"command": "b2c-dx.logs.stopTail",
227+
"title": "Stop Tailing Logs",
228+
"icon": "$(debug-stop)",
229+
"category": "B2C DX - Logs"
230+
},
106231
{
107232
"command": "b2c-dx.webdav.refresh",
108233
"title": "Refresh",
@@ -232,6 +357,16 @@
232357
"command": "b2c-dx.content.clearFilter",
233358
"when": "view == b2cContentExplorer && b2cContentFilterActive",
234359
"group": "navigation"
360+
},
361+
{
362+
"command": "b2c-dx.sandbox.refresh",
363+
"when": "view == b2cSandboxExplorer",
364+
"group": "navigation"
365+
},
366+
{
367+
"command": "b2c-dx.sandbox.addRealm",
368+
"when": "view == b2cSandboxExplorer",
369+
"group": "navigation"
235370
}
236371
],
237372
"view/item/context": [
@@ -289,6 +424,46 @@
289424
"command": "b2c-dx.content.removeLibrary",
290425
"when": "view == b2cContentExplorer && viewItem == library",
291426
"group": "2_manage@1"
427+
},
428+
{
429+
"command": "b2c-dx.sandbox.create",
430+
"when": "view == b2cSandboxExplorer && viewItem == realm",
431+
"group": "1_realm@1"
432+
},
433+
{
434+
"command": "b2c-dx.sandbox.removeRealm",
435+
"when": "view == b2cSandboxExplorer && viewItem == realm",
436+
"group": "2_manage@1"
437+
},
438+
{
439+
"command": "b2c-dx.sandbox.viewDetails",
440+
"when": "view == b2cSandboxExplorer && viewItem =~ /^sandbox-/",
441+
"group": "1_info@1"
442+
},
443+
{
444+
"command": "b2c-dx.sandbox.openBM",
445+
"when": "view == b2cSandboxExplorer && viewItem =~ /^sandbox-/",
446+
"group": "1_info@2"
447+
},
448+
{
449+
"command": "b2c-dx.sandbox.start",
450+
"when": "view == b2cSandboxExplorer && viewItem == sandbox-stopped",
451+
"group": "2_lifecycle@1"
452+
},
453+
{
454+
"command": "b2c-dx.sandbox.stop",
455+
"when": "view == b2cSandboxExplorer && viewItem == sandbox-started",
456+
"group": "2_lifecycle@2"
457+
},
458+
{
459+
"command": "b2c-dx.sandbox.restart",
460+
"when": "view == b2cSandboxExplorer && viewItem == sandbox-started",
461+
"group": "2_lifecycle@3"
462+
},
463+
{
464+
"command": "b2c-dx.sandbox.delete",
465+
"when": "view == b2cSandboxExplorer && viewItem =~ /^sandbox-/",
466+
"group": "3_destructive@1"
292467
}
293468
],
294469
"explorer/context": [
@@ -308,6 +483,27 @@
308483
"command": "b2c-dx.content.import",
309484
"when": "explorerResourceIsFolder"
310485
}
486+
],
487+
"commandPalette": [
488+
{"command": "b2c-dx.sandbox.removeRealm", "when": "false"},
489+
{"command": "b2c-dx.sandbox.delete", "when": "false"},
490+
{"command": "b2c-dx.sandbox.start", "when": "false"},
491+
{"command": "b2c-dx.sandbox.stop", "when": "false"},
492+
{"command": "b2c-dx.sandbox.restart", "when": "false"},
493+
{"command": "b2c-dx.sandbox.viewDetails", "when": "false"},
494+
{"command": "b2c-dx.sandbox.openBM", "when": "false"},
495+
{"command": "b2c-dx.webdav.newFolder", "when": "false"},
496+
{"command": "b2c-dx.webdav.uploadFile", "when": "false"},
497+
{"command": "b2c-dx.webdav.delete", "when": "false"},
498+
{"command": "b2c-dx.webdav.download", "when": "false"},
499+
{"command": "b2c-dx.webdav.openFile", "when": "false"},
500+
{"command": "b2c-dx.webdav.newFile", "when": "false"},
501+
{"command": "b2c-dx.webdav.mountWorkspace", "when": "false"},
502+
{"command": "b2c-dx.content.removeLibrary", "when": "false"},
503+
{"command": "b2c-dx.content.export", "when": "false"},
504+
{"command": "b2c-dx.content.exportNoAssets", "when": "false"},
505+
{"command": "b2c-dx.content.exportAssets", "when": "false"},
506+
{"command": "b2c-dx.content.clearFilter", "when": "false"}
311507
]
312508
}
313509
},

0 commit comments

Comments
 (0)