推进 INI 面板 session load summary helper

This commit is contained in:
2026-06-14 18:29:49 +08:00
parent aeb290b885
commit 3ca213a889
5 changed files with 239 additions and 10 deletions

View File

@@ -26,6 +26,10 @@ import {
createRunSummary,
summarizeRunResult,
} from "./run-summary.js";
import {
createMachineSessionLoadSummary,
machineSessionLoadLogLines,
} from "./session-load-summary.js";
import {
createSessionSnapshotSummary,
sessionSnapshotMetadataLogLines,
@@ -616,14 +620,11 @@ document.getElementById("restore-session-snapshot").addEventListener("click", as
document.getElementById("load-session").addEventListener("click", async () => {
try {
await loadMachineSessionIntoWasm();
const loadSummary = createMachineSessionLoadSummary(loadedSession);
setLog(
[
"Loaded machine session into the interpreter WASM filesystem.",
`INI: ${loadedSession.ini.opfsPath} -> ${loadedSession.ini.wasmPath}`,
`Parameter file: ${loadedSession.parameters.opfsPath} -> ${loadedSession.parameters.wasmPath}`,
`Parameters: ${loadedSession.parameters.result.trim()}`,
`Tool table file: ${loadedSession.toolTable.opfsPath} -> ${loadedSession.toolTable.wasmPath}`,
`Tool table: ${loadedSession.toolTable.result.trim()}`,
...machineSessionLoadLogLines(loadSummary),
].join("\n"),
);
} catch (error) {
@@ -637,15 +638,12 @@ document.getElementById("restore-load-session").addEventListener("click", async
await loadMachineSessionIntoWasm();
setField("sessionGcode", snapshot.payload.files.gcode);
const summary = createSessionSnapshotSummary(snapshot, sessionSnapshotLabel(snapshot.sessionId));
const loadSummary = createMachineSessionLoadSummary(loadedSession);
setLog(
[
"Restored and loaded machine session snapshot.",
...sessionSnapshotSummaryLogLines(summary),
`INI: ${loadedSession.ini.opfsPath} -> ${loadedSession.ini.wasmPath}`,
`Parameter file: ${loadedSession.parameters.opfsPath} -> ${loadedSession.parameters.wasmPath}`,
`Parameters: ${loadedSession.parameters.result.trim()}`,
`Tool table file: ${loadedSession.toolTable.opfsPath} -> ${loadedSession.toolTable.wasmPath}`,
`Tool table: ${loadedSession.toolTable.result.trim()}`,
...machineSessionLoadLogLines(loadSummary),
`G-code: ${summary.gcodeOpfsPath ?? "-"}`,
].join("\n"),
);