111 lines
3.4 KiB
JavaScript
111 lines
3.4 KiB
JavaScript
export function createIniPanelStateSummary({
|
|
badges = {},
|
|
machine = null,
|
|
machineFiles = null,
|
|
sessionSnapshot = null,
|
|
sessionLoad = null,
|
|
run = null,
|
|
fiveaxisRemap = null,
|
|
} = {}) {
|
|
return {
|
|
badges: {
|
|
ini: badges.ini ?? null,
|
|
interp: badges.interp ?? null,
|
|
opfs: badges.opfs ?? null,
|
|
},
|
|
machine,
|
|
machineFiles,
|
|
sessionSnapshot,
|
|
sessionLoad,
|
|
run,
|
|
fiveaxisRemap: fiveaxisRemap ?? null,
|
|
};
|
|
}
|
|
|
|
export function createMachineSessionStateSnapshot({
|
|
badges = {},
|
|
machine = null,
|
|
machineFiles = null,
|
|
sessionSnapshot = null,
|
|
sessionLoad = null,
|
|
selectedProgram = null,
|
|
run = null,
|
|
fields = {},
|
|
lastAction = null,
|
|
error = null,
|
|
fiveaxisRemap = null,
|
|
} = {}) {
|
|
return {
|
|
...createIniPanelStateSummary({
|
|
badges,
|
|
machine,
|
|
machineFiles,
|
|
sessionSnapshot,
|
|
sessionLoad,
|
|
run,
|
|
fiveaxisRemap,
|
|
}),
|
|
selectedProgram,
|
|
fields: {
|
|
sessionIni: fields.sessionIni ?? null,
|
|
sessionParameters: fields.sessionParameters ?? null,
|
|
sessionToolTable: fields.sessionToolTable ?? null,
|
|
sessionGcode: fields.sessionGcode ?? null,
|
|
sessionSnapshot: fields.sessionSnapshot ?? null,
|
|
runStatus: fields.runStatus ?? null,
|
|
runSource: fields.runSource ?? null,
|
|
runSnapshot: fields.runSnapshot ?? null,
|
|
runWorkflow: fields.runWorkflow ?? null,
|
|
runOpfsPath: fields.runOpfsPath ?? null,
|
|
runWasmPath: fields.runWasmPath ?? null,
|
|
},
|
|
lastAction: lastAction ?? null,
|
|
error: error ?? null,
|
|
};
|
|
}
|
|
|
|
export function createMachineSessionStateReport(state = {}) {
|
|
const badges = state.badges ?? {};
|
|
const fields = state.fields ?? {};
|
|
const sessionSnapshot = state.sessionSnapshot ?? {};
|
|
const sessionLoad = state.sessionLoad ?? {};
|
|
const selectedProgram = state.selectedProgram ?? {};
|
|
const run = state.run ?? {};
|
|
return {
|
|
readiness: {
|
|
ini: badges.ini ?? null,
|
|
interp: badges.interp ?? null,
|
|
opfs: badges.opfs ?? null,
|
|
},
|
|
session: {
|
|
snapshotLabel: sessionSnapshot.snapshotLabel ?? fields.sessionSnapshot ?? null,
|
|
workflow: sessionSnapshot.workflow ?? fields.runWorkflow ?? null,
|
|
ini: fields.sessionIni ?? sessionSnapshot.iniOpfsPath ?? sessionLoad.iniWasmPath ?? null,
|
|
parameters: fields.sessionParameters ?? sessionSnapshot.parameterOpfsPath ?? sessionLoad.parameterWasmPath ?? null,
|
|
toolTable: fields.sessionToolTable ?? sessionSnapshot.toolTableOpfsPath ?? sessionLoad.toolTableWasmPath ?? null,
|
|
gcode: fields.sessionGcode ?? sessionSnapshot.gcodeOpfsPath ?? null,
|
|
},
|
|
loaded: {
|
|
iniWasmPath: sessionLoad.iniWasmPath ?? null,
|
|
parameterWasmPath: sessionLoad.parameterWasmPath ?? null,
|
|
toolTableWasmPath: sessionLoad.toolTableWasmPath ?? null,
|
|
},
|
|
program: {
|
|
source: selectedProgram.source ?? run.programSource ?? fields.runSource ?? null,
|
|
opfsPath: selectedProgram.opfsPath ?? run.programOpfsPath ?? fields.runOpfsPath ?? null,
|
|
wasmPath: selectedProgram.wasmPath ?? run.programWasmPath ?? fields.runWasmPath ?? null,
|
|
},
|
|
run: {
|
|
status: run.runStatus ?? fields.runStatus ?? null,
|
|
canonicalEventCount: run.canonicalEventCount ?? 0,
|
|
motionSnapshotCount: run.motionSnapshotCount ?? 0,
|
|
iniWasmPath: run.iniWasmPath ?? null,
|
|
},
|
|
status: {
|
|
lastAction: state.lastAction ?? null,
|
|
error: state.error ?? null,
|
|
fiveaxisRemap: state.fiveaxisRemap ?? null,
|
|
},
|
|
};
|
|
}
|