推进 INI 面板运行摘要 helper

This commit is contained in:
2026-06-14 17:44:20 +08:00
parent ccd6b67e35
commit 8137cce488
5 changed files with 165 additions and 13 deletions

View File

@@ -22,6 +22,9 @@ import {
loadMachineSessionSnapshot,
saveMachineSessionSnapshot,
} from "../../opfs/snapshot-store.js";
import {
createRunSummary,
} from "./run-summary.js";
const SAMPLE_PATH =
"../../../vendor/linuxcnc/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini";
@@ -368,19 +371,14 @@ function clearLastRunSummary() {
}
function setLastRunSummary(program, runtime = {}, snapshot = restoredSessionSnapshot) {
const snapshotLabel = snapshot ? sessionSnapshotLabel(snapshot.sessionId) : null;
const metadata = snapshot?.metadata ?? {};
const summary = {
runStatus: runtime.runStatus ?? "ok",
programSource: program.source,
snapshotLabel,
workflow: metadata.workflow ?? null,
programOpfsPath: program.opfsPath,
programWasmPath: program.wasmPath,
iniWasmPath: runtime.iniWasmPath ?? null,
canonicalEventCount: runtime.canonicalEventCount ?? 0,
motionSnapshotCount: runtime.motionSnapshotCount ?? 0,
};
const summary = createRunSummary(
program,
{
...runtime,
snapshotLabel: snapshot ? sessionSnapshotLabel(snapshot.sessionId) : null,
},
snapshot,
);
window.linuxCncIniPanelLastRunSummary = summary;
setField("runSource", summary.programSource);
setField("runSnapshot", summary.snapshotLabel ?? "-");

View File

@@ -0,0 +1,14 @@
export function createRunSummary(program, runtime = {}, snapshot = null) {
const metadata = snapshot?.metadata ?? {};
return {
runStatus: runtime.runStatus ?? "ok",
programSource: program.source,
snapshotLabel: runtime.snapshotLabel ?? metadata.snapshotLabel ?? null,
workflow: metadata.workflow ?? null,
programOpfsPath: program.opfsPath,
programWasmPath: program.wasmPath,
iniWasmPath: runtime.iniWasmPath ?? null,
canonicalEventCount: runtime.canonicalEventCount ?? 0,
motionSnapshotCount: runtime.motionSnapshotCount ?? 0,
};
}