接入 INI panel session readiness workflow
This commit is contained in:
@@ -18,6 +18,9 @@ import {
|
||||
import {
|
||||
loadMachineSessionFromOpfs,
|
||||
} from "../../opfs/linuxcnc-machine-session-bridge.js";
|
||||
import {
|
||||
readMachineSessionReadiness,
|
||||
} from "../../opfs/machine-session-readiness.js";
|
||||
import {
|
||||
loadMachineSessionSnapshot,
|
||||
saveMachineSessionSnapshot,
|
||||
@@ -37,6 +40,7 @@ import {
|
||||
} from "./run-workflow.js";
|
||||
import {
|
||||
loadMachineSessionIntoWasmWorkflow,
|
||||
readMachineSessionReadinessWorkflow,
|
||||
restoreMachineSessionSnapshotWorkflow,
|
||||
saveMachineSessionSnapshotWorkflow,
|
||||
} from "./session-workflow.js";
|
||||
@@ -486,6 +490,14 @@ async function loadMachineSessionIntoWasm() {
|
||||
return loadedSession;
|
||||
}
|
||||
|
||||
function readCurrentMachineSessionReadiness() {
|
||||
return readMachineSessionReadiness(MACHINE_ID, {
|
||||
sessionId: UI_SESSION.snapshotId,
|
||||
snapshotFilename: UI_SESSION.snapshotFilename,
|
||||
gcodeFilename: UI_SESSION.defaultGcodeFilename,
|
||||
});
|
||||
}
|
||||
|
||||
async function loadSample() {
|
||||
setLog(`Fetching ${SAMPLE_PATH}`);
|
||||
const response = await fetch(SAMPLE_PATH);
|
||||
@@ -674,6 +686,7 @@ document.getElementById("restore-session-snapshot").addEventListener("click", as
|
||||
snapshotLabel: sessionSnapshotLabel(UI_SESSION),
|
||||
loadMachineSessionSnapshot,
|
||||
loadMachineTextFiles,
|
||||
readReadiness: readCurrentMachineSessionReadiness,
|
||||
});
|
||||
editor.value = workflow.editorIniText;
|
||||
setField("sessionIni", workflow.fields.sessionIni);
|
||||
@@ -684,6 +697,7 @@ document.getElementById("restore-session-snapshot").addEventListener("click", as
|
||||
restoredSessionSnapshot = workflow.snapshot;
|
||||
updatePanelMachineSessionState({
|
||||
sessionSnapshot: workflow.summary,
|
||||
sessionReadiness: workflow.readiness,
|
||||
sessionLoad: null,
|
||||
selectedProgram: null,
|
||||
fields: workflow.fields,
|
||||
@@ -707,17 +721,27 @@ document.getElementById("restore-session-snapshot").addEventListener("click", as
|
||||
|
||||
document.getElementById("load-session").addEventListener("click", async () => {
|
||||
try {
|
||||
const readinessWorkflow = await readMachineSessionReadinessWorkflow({
|
||||
readReadiness: readCurrentMachineSessionReadiness,
|
||||
});
|
||||
const workflow = await loadMachineSessionIntoWasmWorkflow({
|
||||
loadSession: () => loadMachineSessionIntoWasm(),
|
||||
});
|
||||
loadedSession = workflow.loadedSession;
|
||||
updatePanelMachineSessionState({
|
||||
sessionReadiness: readinessWorkflow.readiness,
|
||||
sessionLoad: workflow.loadSummary,
|
||||
fields: workflow.fields,
|
||||
fields: {
|
||||
...readinessWorkflow.fields,
|
||||
...workflow.fields,
|
||||
},
|
||||
lastAction: "load-session",
|
||||
error: null,
|
||||
});
|
||||
setLog(workflow.logLines.join("\n"));
|
||||
setLog([
|
||||
...readinessWorkflow.logLines,
|
||||
...workflow.logLines,
|
||||
].join("\n"));
|
||||
} catch (error) {
|
||||
updatePanelMachineSessionState({
|
||||
lastAction: "load-session",
|
||||
@@ -736,6 +760,7 @@ document.getElementById("restore-load-session").addEventListener("click", async
|
||||
snapshotLabel: sessionSnapshotLabel(UI_SESSION),
|
||||
loadMachineSessionSnapshot,
|
||||
loadMachineTextFiles,
|
||||
readReadiness: readCurrentMachineSessionReadiness,
|
||||
loadSession: () => loadMachineSessionIntoWasm(),
|
||||
});
|
||||
editor.value = workflow.editorIniText;
|
||||
@@ -750,6 +775,7 @@ document.getElementById("restore-load-session").addEventListener("click", async
|
||||
}
|
||||
updatePanelMachineSessionState({
|
||||
sessionSnapshot: workflow.summary,
|
||||
sessionReadiness: workflow.readiness,
|
||||
sessionLoad: workflow.loadSummary,
|
||||
selectedProgram: null,
|
||||
fields: workflow.fields,
|
||||
|
||||
Reference in New Issue
Block a user