Update machine-api for modified api schema (#3572)

update to new machine-api format
This commit is contained in:
Paul Tagliamonte
2024-08-28 15:15:37 -04:00
committed by GitHub
parent 5e8227ead8
commit 1162ff3b03
7 changed files with 197 additions and 2880 deletions

View File

@ -25,7 +25,7 @@ export type ModelingCommandSchema = {
storage?: StorageUnion
}
Make: {
machine: components['schemas']['Machine']
machine: components['schemas']['MachineInfoResponse']
}
Extrude: {
selection: Selections // & { type: 'face' } would be cool to lock that down
@ -179,21 +179,25 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
machine: {
inputType: 'options',
required: true,
valueSummary: (machine: components['schemas']['Machine']) =>
machine.model || machine.manufacturer,
valueSummary: (machine: components['schemas']['MachineInfoResponse']) =>
machine.make_model.model ||
machine.make_model.manufacturer ||
'Unknown Machine',
options: () => {
return Object.entries(machineManager.machines).map(
([hostname, machine]) => ({
name: `${machine.model || machine.manufacturer}, ${hostname}`,
([_, machine]) => ({
name: `${machine.id} (${
machine.make_model.model || machine.make_model.manufacturer
}) via ${machineManager.machineApiIp || 'the local network'}`,
isCurrent: false,
value: machine as components['schemas']['Machine'],
value: machine as components['schemas']['MachineInfoResponse'],
})
)
},
defaultValue: () => {
return Object.values(
machineManager.machines
)[0] as components['schemas']['Machine']
)[0] as components['schemas']['MachineInfoResponse']
},
},
},