diff --git a/web/docs/current/desktop-parity-continuation.md b/web/docs/current/desktop-parity-continuation.md index 2de25dec..8c3e7963 100644 --- a/web/docs/current/desktop-parity-continuation.md +++ b/web/docs/current/desktop-parity-continuation.md @@ -45,9 +45,10 @@ - 选中 BIM 后菜单显示 2D Drafting / 3D/BIM / Annotation / Manage / Flamingo / Fasteners / Utils;截图 `BIM-web-menu.png`; - Part 回归审计仍 0 错误/0 溢出。 - - 非 Part 菜单命令已接 `DesktopCommandDispatcher`:按 `command-matrix` 找记录、 - 用空参数执行,状态栏显示 running/executed/error;20 秒超时提示改用工作台任务。 - BIM_TogglePanels 实测进入 running(该命令需要面板任务,尚需专用 React 桥)。 + - 非 Part 菜单命令改为打开 **React TaskFrame 模态**(`web/src/shell/task-frame.tsx`), + iframe 复用 `/workbench.html?module=&command=` 的现有任务面板; + BIM_TogglePanels 实测弹出 "Bottom panels" 任务并可点按钮,0 pageError; + 截图 `BIM-task-frame.png`。统一执行/文档共享仍待 P2 的原生任务桥。 - Python InitGui 解析改为位置感知变量解析(`self.*`、重赋值、`+` 拼接), 菜单命令 513、工具栏命令 362,gui-missing 降至 623。 - 说明:preview 页仅渲染清单与命令回调;统一执行路由尚待 P2/P3。 diff --git a/web/docs/current/desktop-parity-evidence/BIM-task-frame.png b/web/docs/current/desktop-parity-evidence/BIM-task-frame.png new file mode 100644 index 00000000..15fb0694 Binary files /dev/null and b/web/docs/current/desktop-parity-evidence/BIM-task-frame.png differ diff --git a/web/src/project-shell.tsx b/web/src/project-shell.tsx index 21432b2b..e3273595 100644 --- a/web/src/project-shell.tsx +++ b/web/src/project-shell.tsx @@ -83,8 +83,7 @@ import { RecoveryController } from "./recovery-controller.js"; import { mountQueueRecoveryPanel } from "./queue-recovery-panel.js"; import { PartDesignWorkspace } from "./partdesign-workspace-component.js"; import { ParityWorkbenchMenu } from "./shell/workbench-menu.js"; -import { DesktopCommandDispatcher } from "./desktop-command-dispatcher.js"; -import type { WorkbenchCommandRecord } from "./workbench-command-facade.js"; +import { TaskFrame } from "./shell/task-frame.js"; import { DocumentTree, type DocumentTreeNode } from "./document-tree.js"; import { PARTDESIGN_DOCUMENT_COMMAND, PARTDESIGN_DOCUMENT_SCHEMA, type DesignAction, type DesignPayload, type DesignResult } from "./partdesign-document-facade.js"; @@ -313,8 +312,7 @@ function App() { const [designSnapshots, setDesignSnapshots] = useState>({}); const [workbenches, setWorkbenches] = useState>(() => initialWorkbench ? { [initialDocumentId]: initialWorkbench } : {}); const workbench = workbenches[active] ?? "Part"; - const desktopDispatcher = useRef(null); - const desktopCommandRecords = useRef>> | null>(null); + const [parityTask, setParityTask] = useState<{ module: string; command: string } | null>(null); const [selectedSheets, setSelectedSheets] = useState>({}); const [csvPanel, setCsvPanel] = useState<{ id: string; mode: "import" | "export"; selected?: string; done(result: Record): void } | null>(null); const [sheetRanges, setSheetRanges] = useState>({}); @@ -1704,32 +1702,10 @@ function App() { || !!workspaceTask || !!viewCommand || !!csvPanel || item.command === "Part_ColorPerFace" && (compoundSelection.length !== 1 || !partSnapshots[active]?.objects?.some(object => object.name === compoundSelection[0] && object.topology?.Face && object.type !== "App::Link")); - const executeManifestCommand = async (command: string) => { + const executeManifestCommand = (command: string) => { if (!active) return; - setStatus(`${command}: running`); - try { - desktopDispatcher.current ??= new DesktopCommandDispatcher(router); - if (!desktopCommandRecords.current) { - desktopCommandRecords.current = fetch("/api/workbench-command-matrix.json").then(async response => { - if (!response.ok) throw new Error(`command matrix HTTP ${response.status}`); - const payload = await response.json() as { records?: WorkbenchCommandRecord[] }; - return payload.records ?? []; - }); - } - const records = await desktopCommandRecords.current as WorkbenchCommandRecord[]; - const record = records.find(item => item.command === command - && [workbench, "Web", "Std"].includes(item.module)) - ?? records.find(item => item.command === command); - if (!record) throw new Error("no command matrix record"); - const response = await Promise.race([ - desktopDispatcher.current.execute(record, {}, nativeName(active)), - new Promise((_, reject) => setTimeout(() => reject(new Error("command timed out; open its workbench task")), 20000)), - ]); - if (response.kind === "error") setStatus(`${command}: ${response.error.message}`); - else setStatus(`${command}: executed`); - } catch (error) { - setStatus(`${command}: ${String((error as Error)?.message ?? error)}`); - } + setParityTask({ module: workbench, command }); + setStatus(`${command}: opened React task frame`); }; const activatePartAction = (item: PartUiAction) => { @@ -3148,6 +3124,8 @@ function App() {
Recent files{store.recent().length}
{developerMode &&
CheckpointlocalStorage metadata only
} {referenceOpen && setReferenceOpen(false)} />} + {parityTask && setParityTask(null)} />} {lineReferenceOpen && setLineReferenceOpen(false)} />}

{status}

; } diff --git a/web/src/shell/task-frame.tsx b/web/src/shell/task-frame.tsx new file mode 100644 index 00000000..450d3691 --- /dev/null +++ b/web/src/shell/task-frame.tsx @@ -0,0 +1,24 @@ +import React from "react"; + +export function TaskFrame({ module, command, onClose }: { + module: string; + command: string; + onClose: () => void; +}) { + const src = `/workbench.html?module=${encodeURIComponent(module)}&command=${encodeURIComponent(command)}`; + return
+ +
+
{module} · {command}任务桥(复用工作台任务面板) +
+