推进 INI 面板运行摘要状态
This commit is contained in:
@@ -109,6 +109,11 @@ const fields = {
|
||||
sessionGcode: document.getElementById("field-session-gcode"),
|
||||
sessionSnapshot: document.getElementById("field-session-snapshot"),
|
||||
runStatus: document.getElementById("field-run-status"),
|
||||
runSource: document.getElementById("field-run-source"),
|
||||
runSnapshot: document.getElementById("field-run-snapshot"),
|
||||
runWorkflow: document.getElementById("field-run-workflow"),
|
||||
runOpfsPath: document.getElementById("field-run-opfs-path"),
|
||||
runWasmPath: document.getElementById("field-run-wasm-path"),
|
||||
fiveaxisRemap: document.getElementById("field-fiveaxis-remap"),
|
||||
};
|
||||
|
||||
@@ -350,6 +355,34 @@ function runSessionContextLogLines(program, snapshot = restoredSessionSnapshot)
|
||||
];
|
||||
}
|
||||
|
||||
function clearLastRunSummary() {
|
||||
window.linuxCncIniPanelLastRunSummary = null;
|
||||
setField("runSource", "-");
|
||||
setField("runSnapshot", "-");
|
||||
setField("runWorkflow", "-");
|
||||
setField("runOpfsPath", "-");
|
||||
setField("runWasmPath", "-");
|
||||
}
|
||||
|
||||
function setLastRunSummary(program, snapshot = restoredSessionSnapshot) {
|
||||
const snapshotLabel = snapshot ? sessionSnapshotLabel(snapshot.sessionId) : null;
|
||||
const metadata = snapshot?.metadata ?? {};
|
||||
const summary = {
|
||||
programSource: program.source,
|
||||
snapshotLabel,
|
||||
workflow: metadata.workflow ?? null,
|
||||
programOpfsPath: program.opfsPath,
|
||||
programWasmPath: program.wasmPath,
|
||||
};
|
||||
window.linuxCncIniPanelLastRunSummary = summary;
|
||||
setField("runSource", summary.programSource);
|
||||
setField("runSnapshot", summary.snapshotLabel ?? "-");
|
||||
setField("runWorkflow", summary.workflow ?? "-");
|
||||
setField("runOpfsPath", summary.programOpfsPath);
|
||||
setField("runWasmPath", summary.programWasmPath);
|
||||
return summary;
|
||||
}
|
||||
|
||||
async function loadSelectedGcodeProgram() {
|
||||
const opfsPath = restoredSessionSnapshot?.payload?.files?.gcode;
|
||||
let filename = UI_SESSION.defaultGcodeFilename;
|
||||
@@ -627,11 +660,13 @@ document.getElementById("run-gcode").addEventListener("click", async () => {
|
||||
interp.writeTextFile(program.wasmPath, program.text);
|
||||
clearRunPlayback();
|
||||
setField("runStatus", "running");
|
||||
clearLastRunSummary();
|
||||
setRunMonitor(5, "running", {}, "running");
|
||||
await nextFrame();
|
||||
const result = interp.runFileWithIni(program.wasmPath, loadedSession.ini.wasmPath);
|
||||
setField("sessionGcode", program.opfsPath);
|
||||
setField("runStatus", "ok");
|
||||
setLastRunSummary(program);
|
||||
setCanonicalEvents(result.trim());
|
||||
playRunMotion(result.trim(), program.text);
|
||||
setLog(
|
||||
@@ -646,6 +681,7 @@ document.getElementById("run-gcode").addEventListener("click", async () => {
|
||||
setField("runStatus", "failed");
|
||||
setCanonicalEvents("");
|
||||
clearRunPlayback();
|
||||
clearLastRunSummary();
|
||||
setRunMonitor(0, "failed", {}, "failed");
|
||||
setLog(`G-code run failed: ${error.message}`, true);
|
||||
}
|
||||
|
||||
@@ -279,6 +279,16 @@
|
||||
<dd id="field-session-snapshot">-</dd>
|
||||
<dt>Run Status</dt>
|
||||
<dd id="field-run-status">-</dd>
|
||||
<dt>Run Source</dt>
|
||||
<dd id="field-run-source">-</dd>
|
||||
<dt>Run Snapshot</dt>
|
||||
<dd id="field-run-snapshot">-</dd>
|
||||
<dt>Run Workflow</dt>
|
||||
<dd id="field-run-workflow">-</dd>
|
||||
<dt>Run OPFS Path</dt>
|
||||
<dd id="field-run-opfs-path">-</dd>
|
||||
<dt>Run WASM Path</dt>
|
||||
<dd id="field-run-wasm-path">-</dd>
|
||||
<dt>5-Axis Remap</dt>
|
||||
<dd id="field-fiveaxis-remap">-</dd>
|
||||
</dl>
|
||||
|
||||
Reference in New Issue
Block a user