Skip to content

Commit fb3ba7b

Browse files
author
DavidQ
committed
Remove Palette Manager from Workspace V2 producer flow and simplify import controls - PR_11_308
1 parent 61f73ca commit fb3ba7b

2 files changed

Lines changed: 51 additions & 25 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# PR_11_308 Report - Workspace V2 Palette Producer Removal and Import UX Cleanup
2+
3+
## Purpose
4+
Remove palette-manager from Workspace V2 Producer selection, remove duplicate textarea import path, and keep a single Import Workspace Session JSON flow with file-picker-first behavior.
5+
6+
## Files Changed
7+
- `tools/workspace-v2/index.js`
8+
- `docs/dev/reports/PR_11_308_report.md`
9+
10+
## Implementation Summary
11+
- Removed runtime creation/wiring of `Import Textarea JSON` button path.
12+
- Kept `Import Workspace Session JSON` as the primary import trigger:
13+
- opens hidden file picker
14+
- selected file content populates textarea
15+
- import validates/loads automatically
16+
- Added manual textarea fallback only when file picker is unavailable and textarea has JSON.
17+
- Removed `palette-manager-v2` option from the Producer tool dropdown at runtime.
18+
- Updated Producer default selection to a non-palette tool (`asset-browser-v2`) with first-option fallback.
19+
20+
## Validation Commands
21+
- `node --check tools/workspace-v2/index.js`
22+
23+
## Validation Results
24+
- PASS: JavaScript syntax check succeeded for `tools/workspace-v2/index.js`.
25+
26+
## Full Samples Smoke Test
27+
- Skipped.
28+
- Reason: change is scoped to Workspace V2 `index.js` producer/import wiring and does not modify shared sample loader/framework.

tools/workspace-v2/index.js

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class WorkspaceV2SessionProducer {
1818
this.importJsonNode = document.getElementById("workspaceV2ImportJson");
1919
this.importFileNode = document.getElementById("workspaceV2ImportFile");
2020
this.importButton = document.getElementById("workspaceV2ImportButton");
21-
this.importTextareaButton = null;
2221
this.exportButton = document.getElementById("workspaceV2ExportButton");
2322
this.workspaceJsonNode = this.importJsonNode;
2423
this.shareUrlNode = document.getElementById("workspaceV2ShareUrl");
@@ -218,12 +217,12 @@ class WorkspaceV2SessionProducer {
218217
this.renderSessionHistory();
219218
}
220219
});
220+
this.removePaletteManagerProducerOption();
221221
this.applyDefaultWorkspaceToolSelection();
222222
this.registerScrollTextColorRule();
223223
this.initializeImportExportSectionStatusNode();
224224
this.initializeWorkspaceToolsSummaryNode();
225225
this.initializeHiddenImportFileInput();
226-
this.initializeImportTextareaButton();
227226
this.decodeSessionParamFromUrl();
228227
this.initializeWorkspaceProducerSession();
229228
this.refreshPaletteOwnershipStateAndUi();
@@ -372,33 +371,17 @@ class WorkspaceV2SessionProducer {
372371
this.importFileNode.style.display = "none";
373372
}
374373

375-
initializeImportTextareaButton() {
376-
const existingButton = document.getElementById("workspaceV2ImportTextareaButton");
377-
if (existingButton instanceof HTMLButtonElement) {
378-
this.importTextareaButton = existingButton;
379-
} else {
380-
const importButtonParent = this.importButton ? this.importButton.parentElement : null;
381-
if (!importButtonParent) {
382-
return;
383-
}
384-
const textareaImportButton = document.createElement("button");
385-
textareaImportButton.type = "button";
386-
textareaImportButton.id = "workspaceV2ImportTextareaButton";
387-
textareaImportButton.textContent = "Import Textarea JSON";
388-
importButtonParent.insertBefore(textareaImportButton, this.importButton.nextSibling);
389-
this.importTextareaButton = textareaImportButton;
390-
}
391-
this.importTextareaButton.addEventListener("click", () => {
392-
this.importWorkspaceSessionJson();
393-
});
394-
}
395-
396374
handleImportWorkspaceSessionJsonClick() {
397-
this.setImportExportStatus("Select a workspace session file to import.");
398375
if (!this.importFileNode) {
376+
if (this.importJsonNode && this.importJsonNode.value.trim()) {
377+
this.setImportExportStatus("File picker unavailable. Importing from Workspace Session JSON.");
378+
this.importWorkspaceSessionJson();
379+
return;
380+
}
399381
this.setImportExportStatus("Import error: file picker is unavailable.");
400382
return;
401383
}
384+
this.setImportExportStatus("Select a workspace session file to import.");
402385
this.importFileDialogPending = true;
403386
this.importFileNode.value = "";
404387
this.importFileNode.click();
@@ -419,14 +402,29 @@ class WorkspaceV2SessionProducer {
419402
}, 0);
420403
}
421404

405+
removePaletteManagerProducerOption() {
406+
if (!this.toolSelect) {
407+
return;
408+
}
409+
Array.from(this.toolSelect.options).forEach((option) => {
410+
if (option.value === "palette-manager-v2") {
411+
option.remove();
412+
}
413+
});
414+
}
415+
422416
applyDefaultWorkspaceToolSelection() {
423417
if (!this.toolSelect) {
424418
return;
425419
}
426-
const defaultToolId = "palette-manager-v2";
420+
const defaultToolId = "asset-browser-v2";
427421
const hasDefaultOption = Array.from(this.toolSelect.options).some((option) => option.value === defaultToolId);
428422
if (hasDefaultOption) {
429423
this.toolSelect.value = defaultToolId;
424+
return;
425+
}
426+
if (this.toolSelect.options.length > 0) {
427+
this.toolSelect.selectedIndex = 0;
430428
}
431429
}
432430

0 commit comments

Comments
 (0)