推进 INI 面板 workflow overview helper

This commit is contained in:
2026-06-15 05:32:09 +08:00
parent df1f39974f
commit deb8b7cdd3
5 changed files with 247 additions and 4 deletions

View File

@@ -13,8 +13,14 @@ const stateBundle = {
opfs: "OPFS: ready",
},
},
overview: {
phase: "ready",
},
};
const workflowStatus = {
overview: {
phase: "ready",
},
lastAction: "load-session",
error: null,
};

View File

@@ -7,6 +7,7 @@ import {
createMachineSessionStateBundle,
createMachineSessionStateReport,
createMachineSessionStateReportExport,
createMachineSessionWorkflowOverview,
createMachineSessionWorkflowStatus,
} from "../../../runtime/ui/ini-panel/panel-state-summary.js";
import {
@@ -67,6 +68,38 @@ const expectedEmptyRunReadinessReport = {
iniWasmPath: null,
};
const expectedWorkflowOverview = {
phase: "ran",
missing: [],
readiness: {
ini: "INI WASM: ready",
interp: "Interpreter WASM: ready",
opfs: "OPFS: ready",
},
session: {
snapshotLabel: "ui-machine-session/ui-machine-session.json",
workflow: "save-session-snapshot",
ini: "/work/session-machine.ini",
gcode: "linuxcnc/gcode/ui-session.ngc",
},
loaded: {
iniWasmPath: null,
parameterWasmPath: null,
toolTableWasmPath: null,
},
runReadiness: expectedRunReadinessReport,
run: {
status: "ok",
canonicalEventCount: 2,
motionSnapshotCount: 2,
iniWasmPath: null,
},
status: {
lastAction: "run-gcode",
error: null,
},
};
const summary = createIniPanelStateSummary({
badges: {
ini: "INI WASM: ready",
@@ -427,6 +460,37 @@ assert.deepEqual(
interp: "Interpreter WASM: ready",
opfs: "OPFS: ready",
},
overview: {
phase: "ran",
missing: [],
readiness: {
ini: "INI WASM: ready",
interp: "Interpreter WASM: ready",
opfs: "OPFS: ready",
},
session: {
snapshotLabel: "ui-machine-session/ui-machine-session.json",
workflow: "save-session-snapshot",
ini: "/work/session-machine.ini",
gcode: "linuxcnc/gcode/ui-session.ngc",
},
loaded: {
iniWasmPath: null,
parameterWasmPath: null,
toolTableWasmPath: null,
},
runReadiness: expectedRunReadinessReport,
run: {
status: "ok",
canonicalEventCount: 2,
motionSnapshotCount: 2,
iniWasmPath: null,
},
status: {
lastAction: "run-gcode",
error: null,
},
},
runReadiness: expectedRunReadinessReport,
lastAction: "run-gcode",
error: null,
@@ -485,6 +549,11 @@ const expectedBundleReport = {
},
};
assert.deepEqual(
createMachineSessionWorkflowOverview(expectedBundleReport),
expectedWorkflowOverview,
);
assert.deepEqual(
createMachineSessionStateBundle({
badges: {
@@ -510,6 +579,7 @@ assert.deepEqual(
}),
{
report: expectedBundleReport,
overview: expectedWorkflowOverview,
export: {
filename: "machine-session-state-report.json",
mediaType: "application/json",
@@ -522,6 +592,7 @@ assert.deepEqual(
interp: "Interpreter WASM: ready",
opfs: "OPFS: ready",
},
overview: expectedWorkflowOverview,
lastAction: "run-gcode",
error: null,
runReadiness: expectedRunReadinessReport,
@@ -560,6 +631,7 @@ assert.deepEqual(
},
lastAction: "run-gcode",
error: null,
overview: expectedWorkflowOverview,
session: {
snapshotLabel: "ui-machine-session/ui-machine-session.json",
workflow: "save-session-snapshot",
@@ -603,6 +675,16 @@ assert.deepEqual(
{ label: "G-code", value: "linuxcnc/gcode/ui-session.ngc" },
],
},
{
id: "workflow",
title: "Workflow",
rows: [
{ label: "Phase", value: "ran" },
{ label: "Missing", value: null },
{ label: "Last action", value: "run-gcode" },
{ label: "Error", value: null },
],
},
{
id: "run",
title: "Run",
@@ -645,6 +727,7 @@ const renderedControlView = renderMachineSessionControlView(
report: expectedBundleReport,
workflowStatus: {
readiness: expectedBundleReport.readiness,
overview: expectedWorkflowOverview,
lastAction: "run-gcode",
error: null,
session: expectedBundleReport.session,
@@ -655,10 +738,10 @@ const renderedControlView = renderMachineSessionControlView(
);
assert.equal(renderedControlView.statusNode.textContent, "run-gcode | ok | -");
assert.equal(renderedControlView.sectionNodes.length, 3);
assert.equal(renderedControlView.sectionNodes[2].dataset.sectionId, "run");
assert.equal(renderedControlView.sectionNodes.length, 4);
assert.equal(renderedControlView.sectionNodes[3].dataset.sectionId, "run");
assert.equal(
renderedControlView.sectionNodes[2].children[1].children[3].textContent,
renderedControlView.sectionNodes[3].children[1].children[3].textContent,
"enabled",
);