推进 INI 面板 machine session state snapshot helper
This commit is contained in:
@@ -660,6 +660,37 @@ TOOL_TABLE = browser-tool.tbl
|
||||
2,
|
||||
"UI snapshot run summary motion snapshot count",
|
||||
);
|
||||
const machineSessionState = uiDocument.defaultView.linuxCncIniPanelMachineSessionState;
|
||||
assertEqual(
|
||||
machineSessionState.lastAction,
|
||||
"run-gcode",
|
||||
"UI machine session state last action",
|
||||
);
|
||||
assertEqual(
|
||||
machineSessionState.selectedProgram.opfsPath,
|
||||
"linuxcnc/gcode/ui-session.ngc",
|
||||
"UI machine session state selected program OPFS path",
|
||||
);
|
||||
assertEqual(
|
||||
machineSessionState.sessionLoad.iniWasmPath,
|
||||
"/work/session-machine.ini",
|
||||
"UI machine session state loaded INI WASM path",
|
||||
);
|
||||
assertEqual(
|
||||
machineSessionState.run.programSource,
|
||||
"snapshot",
|
||||
"UI machine session state run source",
|
||||
);
|
||||
assertEqual(
|
||||
machineSessionState.fields.runWorkflow,
|
||||
"save-session-snapshot",
|
||||
"UI machine session state run workflow field",
|
||||
);
|
||||
assertEqual(
|
||||
machineSessionState.error,
|
||||
null,
|
||||
"UI machine session state error",
|
||||
);
|
||||
if (
|
||||
!runLog.includes("canon_event=STRAIGHT_TRAVERSE") ||
|
||||
!runLog.includes("canon_event=STRAIGHT_FEED")
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { createIniPanelStateSummary } from "../../../runtime/ui/ini-panel/panel-state-summary.js";
|
||||
import {
|
||||
createIniPanelStateSummary,
|
||||
createMachineSessionStateSnapshot,
|
||||
} from "../../../runtime/ui/ini-panel/panel-state-summary.js";
|
||||
|
||||
const summary = createIniPanelStateSummary({
|
||||
badges: {
|
||||
@@ -81,4 +84,106 @@ assert.deepEqual(
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
createMachineSessionStateSnapshot({
|
||||
badges: {
|
||||
ini: "INI WASM: ready",
|
||||
interp: "Interpreter WASM: ready",
|
||||
opfs: "OPFS: ready",
|
||||
},
|
||||
machine: {
|
||||
machine: "xyzab-tdr",
|
||||
},
|
||||
sessionSnapshot: {
|
||||
snapshotLabel: "ui-machine-session/ui-machine-session.json",
|
||||
},
|
||||
sessionLoad: {
|
||||
iniWasmPath: "/work/session-machine.ini",
|
||||
},
|
||||
selectedProgram: {
|
||||
source: "snapshot",
|
||||
opfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
wasmPath: "/work/ui-session.ngc",
|
||||
},
|
||||
run: {
|
||||
runStatus: "ok",
|
||||
programSource: "snapshot",
|
||||
},
|
||||
fields: {
|
||||
sessionIni: "/work/session-machine.ini",
|
||||
sessionParameters: "/work/session-linuxcnc.var",
|
||||
sessionToolTable: "/work/session-tool.tbl",
|
||||
sessionGcode: "linuxcnc/gcode/ui-session.ngc",
|
||||
sessionSnapshot: "ui-machine-session/ui-machine-session.json",
|
||||
runStatus: "ok",
|
||||
runSource: "snapshot",
|
||||
runSnapshot: "ui-machine-session/ui-machine-session.json",
|
||||
runWorkflow: "save-session-snapshot",
|
||||
runOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
runWasmPath: "/work/ui-session.ngc",
|
||||
},
|
||||
lastAction: "run-gcode",
|
||||
fiveaxisRemap: "ok",
|
||||
}),
|
||||
{
|
||||
badges: {
|
||||
ini: "INI WASM: ready",
|
||||
interp: "Interpreter WASM: ready",
|
||||
opfs: "OPFS: ready",
|
||||
},
|
||||
machine: {
|
||||
machine: "xyzab-tdr",
|
||||
},
|
||||
machineFiles: null,
|
||||
sessionSnapshot: {
|
||||
snapshotLabel: "ui-machine-session/ui-machine-session.json",
|
||||
},
|
||||
sessionLoad: {
|
||||
iniWasmPath: "/work/session-machine.ini",
|
||||
},
|
||||
run: {
|
||||
runStatus: "ok",
|
||||
programSource: "snapshot",
|
||||
},
|
||||
fiveaxisRemap: "ok",
|
||||
selectedProgram: {
|
||||
source: "snapshot",
|
||||
opfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
wasmPath: "/work/ui-session.ngc",
|
||||
},
|
||||
fields: {
|
||||
sessionIni: "/work/session-machine.ini",
|
||||
sessionParameters: "/work/session-linuxcnc.var",
|
||||
sessionToolTable: "/work/session-tool.tbl",
|
||||
sessionGcode: "linuxcnc/gcode/ui-session.ngc",
|
||||
sessionSnapshot: "ui-machine-session/ui-machine-session.json",
|
||||
runStatus: "ok",
|
||||
runSource: "snapshot",
|
||||
runSnapshot: "ui-machine-session/ui-machine-session.json",
|
||||
runWorkflow: "save-session-snapshot",
|
||||
runOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
runWasmPath: "/work/ui-session.ngc",
|
||||
},
|
||||
lastAction: "run-gcode",
|
||||
error: null,
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
createMachineSessionStateSnapshot().fields,
|
||||
{
|
||||
sessionIni: null,
|
||||
sessionParameters: null,
|
||||
sessionToolTable: null,
|
||||
sessionGcode: null,
|
||||
sessionSnapshot: null,
|
||||
runStatus: null,
|
||||
runSource: null,
|
||||
runSnapshot: null,
|
||||
runWorkflow: null,
|
||||
runOpfsPath: null,
|
||||
runWasmPath: null,
|
||||
},
|
||||
);
|
||||
|
||||
console.log("ini_panel_state_summary_node_smoke=ok");
|
||||
|
||||
Reference in New Issue
Block a user