推进 INI 面板 session load summary helper
This commit is contained in:
@@ -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"),
|
||||
);
|
||||
|
||||
22
wasm-port/runtime/ui/ini-panel/session-load-summary.js
Normal file
22
wasm-port/runtime/ui/ini-panel/session-load-summary.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export function createMachineSessionLoadSummary(session) {
|
||||
return {
|
||||
iniOpfsPath: session?.ini?.opfsPath ?? null,
|
||||
iniWasmPath: session?.ini?.wasmPath ?? null,
|
||||
parameterOpfsPath: session?.parameters?.opfsPath ?? null,
|
||||
parameterWasmPath: session?.parameters?.wasmPath ?? null,
|
||||
parameterResult: session?.parameters?.result ?? "",
|
||||
toolTableOpfsPath: session?.toolTable?.opfsPath ?? null,
|
||||
toolTableWasmPath: session?.toolTable?.wasmPath ?? null,
|
||||
toolTableResult: session?.toolTable?.result ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
export function machineSessionLoadLogLines(summary) {
|
||||
return [
|
||||
`INI: ${summary.iniOpfsPath ?? "-"} -> ${summary.iniWasmPath ?? "-"}`,
|
||||
`Parameter file: ${summary.parameterOpfsPath ?? "-"} -> ${summary.parameterWasmPath ?? "-"}`,
|
||||
`Parameters: ${summary.parameterResult.trim()}`,
|
||||
`Tool table file: ${summary.toolTableOpfsPath ?? "-"} -> ${summary.toolTableWasmPath ?? "-"}`,
|
||||
`Tool table: ${summary.toolTableResult.trim()}`,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user