推进 INI 面板 shell handoff workflow overview surface

This commit is contained in:
2026-06-15 15:09:57 +08:00
parent 6b6629ce73
commit b61e7e980d
13 changed files with 376 additions and 12 deletions

View File

@@ -36,9 +36,9 @@
try {
const visibleEntries = getVisibleIniPanelEntries();
assertEqual(visibleEntries.length, 2, "launch visible entry length");
assertEqual(visibleEntries.length, 3, "launch visible entry length");
const launcherLinks = createIniPanelLauncherLinkViewModel();
assertEqual(launcherLinks.length, 2, "launcher link model length");
assertEqual(launcherLinks.length, 3, "launcher link model length");
assertEqual(launcherLinks[0].entryId, "edit-run", "launcher link entry id");
assertEqual(launcherLinks[0].label, "Open edit and run panel", "launcher link label");
assertEqual(launcherLinks[0].href, "./index.html", "launcher link href");
@@ -48,6 +48,11 @@
"Open read-only control view",
"launch manifest control entry",
);
assertEqual(
getIniPanelEntryByHref("./workflow-overview.html").title,
"Open shell handoff overview",
"launch manifest workflow entry",
);
assertEqual(
createIniPanelShellViewModel().controlPage.browserApiMethods.join(","),
createControlPageBrowserApiMethods().join(","),
@@ -131,7 +136,7 @@
);
assertEqual(
launchApiManifest.methods.join(","),
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getShellSessionHandoffSummarySchema,getShellSessionHandoffSummary,isSupportedShellSessionHandoffSummary,getShellSessionHandoffCompatibilityReport,getShellSessionHandoffDisplayViewModel,getShellSessionHandoffSnapshot,getShellSessionHandoffRenderState,getShellSessionHandoffActionPlan,getShellSessionHandoffChecklist,getShellSessionHandoffPackageSchema,getShellSessionHandoffPackage,getShellSessionHandoffPackageReport,getShellSessionHandoffPackageDisplayViewModel,getShellSessionHandoffPackageRenderState,getShellSessionHandoffPackageMountState,getShellSessionHandoffPackageMountDisplayViewModel,getShellSessionHandoffPackageMountRenderState,renderShellSessionHandoffMountState,isSupportedShellSessionHandoffPackage,getLauncherLinks,getControlPageApiMethods",
createIniPanelLaunchApiManifest().methods.join(","),
"launch API manifest methods",
);
const shellIntegrationSchema = launchApi.getShellIntegrationSchema();
@@ -540,7 +545,7 @@
);
assertEqual(
launchApiManifest.visibleEntries.length,
2,
3,
"launch API manifest visible entry count",
);
assertEqual(
@@ -548,6 +553,11 @@
"./control-page.html",
"launch API manifest control target",
);
assertEqual(
launchApiManifest.targetPages[2].href,
"./workflow-overview.html",
"launch API manifest workflow target",
);
assertEqual(
launchApiManifest.persistenceCapabilities.length,
3,
@@ -573,9 +583,14 @@
"Open read-only control view",
"launch panel control link",
);
assertEqual(
launchDoc.querySelector('a[href="./workflow-overview.html"]').textContent,
"Open shell handoff overview",
"launch panel workflow link",
);
assertEqual(
launchApi.getLauncherLinks().length,
2,
3,
"launch API launcher link count",
);
assertEqual(

View File

@@ -0,0 +1,86 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>LinuxCNC INI Workflow Overview Smoke</title>
</head>
<body>
<pre id="status">running</pre>
<script type="module">
function assertEqual(actual, expected, label) {
if (actual !== expected) {
throw new Error(`${label}: expected ${expected}, got ${actual}`);
}
}
async function loadWorkflowOverviewFrame() {
const frame = document.createElement("iframe");
frame.src = "../../runtime/ui/ini-panel/workflow-overview.html";
document.body.appendChild(frame);
await new Promise((resolve, reject) => {
frame.addEventListener("load", resolve, { once: true });
frame.addEventListener("error", reject, { once: true });
});
return frame.contentDocument;
}
try {
const workflowDoc = await loadWorkflowOverviewFrame();
const workflowApi = workflowDoc.defaultView.linuxCncIniPanelWorkflowOverviewApi;
if (
!workflowApi?.getWorkflowOverviewRenderState ||
!workflowApi?.getWorkflowOverviewDisplayViewModel ||
!workflowApi?.getWorkflowOverviewSummary ||
!workflowApi?.getWorkflowOverviewDomContract ||
!workflowApi?.getWorkflowOverviewDomReadiness ||
!workflowApi?.renderWorkflowOverview ||
!workflowApi?.mountWorkflowOverview ||
!workflowApi?.createWorkflowOverviewRenderState
) {
throw new Error("workflow overview API namespace did not expose overview helpers");
}
const renderState = workflowApi.getWorkflowOverviewRenderState();
const displayViewModel = workflowApi.getWorkflowOverviewDisplayViewModel();
const summary = workflowApi.getWorkflowOverviewSummary();
const domContract = workflowApi.getWorkflowOverviewDomContract();
const domReadiness = workflowApi.getWorkflowOverviewDomReadiness();
const renderResult = workflowApi.renderWorkflowOverview();
const mountResult = workflowApi.mountWorkflowOverview();
assertEqual(summary.summaryVersion, 1, "workflow overview summary version");
assertEqual(displayViewModel.title, "Shell handoff workflow", "workflow overview display title");
assertEqual(renderState.renderStateVersion, 1, "workflow overview render-state version");
assertEqual(renderState.dataset.handoffScope, "workflow", "workflow overview render-state scope");
assertEqual(domContract.selectors.mount, "[data-handoff-workflow]", "workflow overview DOM contract mount selector");
assertEqual(domReadiness.ready, true, "workflow overview DOM readiness");
assertEqual(renderResult.rendered, true, "workflow overview render result");
assertEqual(renderResult.rowCount, 5, "workflow overview render row count");
assertEqual(mountResult.ready, false, "workflow overview mount result readiness");
assertEqual(mountResult.renderResult.rendered, true, "workflow overview mount result rendered");
assertEqual(
workflowDoc.querySelector("[data-handoff-workflow]").dataset.handoffScope,
"workflow",
"workflow overview DOM scope",
);
assertEqual(
workflowDoc.querySelector("[data-handoff-workflow-status]").textContent,
renderState.statusLine,
"workflow overview DOM status line",
);
assertEqual(
workflowDoc.querySelector('[data-handoff-workflow-value="blocking-reasons"]').textContent.includes("readonly-status"),
true,
"workflow overview DOM blocking reasons row",
);
document.getElementById("status").textContent = "browser_ini_workflow_overview_smoke=ok";
console.log("browser_ini_workflow_overview_smoke=ok");
} catch (error) {
document.getElementById("status").textContent = `browser_ini_workflow_overview_smoke=failed: ${error.message}`;
console.error(error);
throw error;
}
</script>
</body>
</html>

View File

@@ -63,10 +63,12 @@ PORT="$(cat "$PORT_FILE")"
URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_smoke.html"
CONTROL_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_control_page_smoke.html"
LAUNCH_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_launch_smoke.html"
WORKFLOW_OVERVIEW_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_workflow_overview_smoke.html"
SHELL_INTEGRATION_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_shell_integration_workflow_smoke.html"
OUT="$TMP_DIR/chromium.out"
CONTROL_OUT="$TMP_DIR/chromium-control.out"
LAUNCH_OUT="$TMP_DIR/chromium-launch.out"
WORKFLOW_OVERVIEW_OUT="$TMP_DIR/chromium-workflow-overview.out"
SHELL_INTEGRATION_OUT="$TMP_DIR/chromium-shell-integration.out"
"$CHROMIUM" \
@@ -120,6 +122,23 @@ fi
echo "browser_ini_launch_smoke=ok"
"$CHROMIUM" \
--headless=new \
--disable-gpu \
--no-sandbox \
--user-data-dir="$CHROME_PROFILE" \
--virtual-time-budget=10000 \
--dump-dom \
"$WORKFLOW_OVERVIEW_URL" >"$WORKFLOW_OVERVIEW_OUT" 2>&1
if ! grep -Fq "browser_ini_workflow_overview_smoke=ok" "$WORKFLOW_OVERVIEW_OUT"; then
echo "browser INI workflow overview smoke failed" >&2
sed -n '1,220p' "$WORKFLOW_OVERVIEW_OUT" >&2
exit 1
fi
echo "browser_ini_workflow_overview_smoke=ok"
"$CHROMIUM" \
--headless=new \
--disable-gpu \

View File

@@ -168,6 +168,7 @@ const requiredPages = [
["Launch", "runtime/ui/ini-panel/launch.html"],
["Edit and run", "runtime/ui/ini-panel/index.html"],
["Read-only control view", "runtime/ui/ini-panel/control-page.html"],
["Workflow overview", "runtime/ui/ini-panel/workflow-overview.html"],
];
for (const [label, path] of requiredPages) {

View File

@@ -17,6 +17,11 @@ assert.deepEqual(INI_PANEL_ENTRIES, [
title: "Open read-only control view",
href: "./control-page.html",
},
{
id: "workflow-overview",
title: "Open shell handoff overview",
href: "./workflow-overview.html",
},
]);
const manifest = getIniPanelEntryManifest();
@@ -26,6 +31,7 @@ assert.notStrictEqual(manifest[0], INI_PANEL_ENTRIES[0]);
assert.deepEqual(getIniPanelEntryByHref("./index.html"), INI_PANEL_ENTRIES[0]);
assert.deepEqual(getIniPanelEntryByHref("./control-page.html"), INI_PANEL_ENTRIES[1]);
assert.deepEqual(getIniPanelEntryByHref("./workflow-overview.html"), INI_PANEL_ENTRIES[2]);
assert.equal(getIniPanelEntryByHref("./missing.html"), null);
manifest[0].title = "changed";

View File

@@ -91,6 +91,11 @@ assert.deepEqual(manifest, {
href: "./control-page.html",
title: "Open read-only control view",
},
{
id: "workflow-overview",
href: "./workflow-overview.html",
title: "Open shell handoff overview",
},
],
targetPages: [
{
@@ -101,6 +106,10 @@ assert.deepEqual(manifest, {
entryId: "control-view",
href: "./control-page.html",
},
{
entryId: "workflow-overview",
href: "./workflow-overview.html",
},
],
controlPageApiMethods: createControlPageBrowserApiMethods(),
persistenceCapabilities: [

View File

@@ -159,8 +159,8 @@ assert.deepEqual(readiness, {
},
missing: [],
counts: {
pages: 2,
launcherLinks: 2,
pages: 3,
launcherLinks: 3,
launchMethods: 39,
controlPageMethods: 11,
persistenceCapabilities: 3,
@@ -221,8 +221,8 @@ assert.deepEqual(handoffSummary, {
phase: "ready",
missing: [],
counts: {
pages: 2,
launcherLinks: 2,
pages: 3,
launcherLinks: 3,
launchMethods: 39,
controlPageMethods: 11,
persistenceCapabilities: 3,
@@ -1156,8 +1156,8 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
},
missing: ["launchCompatibility"],
counts: {
pages: 2,
launcherLinks: 2,
pages: 3,
launcherLinks: 3,
launchMethods: 39,
controlPageMethods: 11,
persistenceCapabilities: 3,

View File

@@ -153,6 +153,11 @@ assert.deepEqual(createIniPanelLauncherLinkViewModel(), [
href: "./control-page.html",
label: "Open read-only control view",
},
{
entryId: "workflow-overview",
href: "./workflow-overview.html",
label: "Open shell handoff overview",
},
]);
const launcherLinks = createIniPanelLauncherLinkViewModel();
launcherLinks[0].label = "changed";
@@ -169,6 +174,11 @@ assert.deepEqual(shellViewModel.pages, [
href: "./control-page.html",
title: "Open read-only control view",
},
{
id: "workflow-overview",
href: "./workflow-overview.html",
title: "Open shell handoff overview",
},
]);
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
assert.deepEqual(shellViewModel.shellIntegrationSchema, createIniPanelShellIntegrationSchema());