Add printer control actions: restart, start, pause, and stop
This commit is contained in:
parent
835804286c
commit
5434b10923
@ -3,6 +3,8 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||
import ReloadIcon from '../../components/Icons/ReloadIcon'
|
||||
import EditIcon from '../../components/Icons/EditIcon'
|
||||
import PlayCircleIcon from '../../components/Icons/PlayCircleIcon'
|
||||
import PauseCircleIcon from '../../components/Icons/PauseCircleIcon'
|
||||
import StopCircleIcon from '../../components/Icons/StopCircleIcon'
|
||||
|
||||
export const Printer = {
|
||||
name: 'printer',
|
||||
@ -40,6 +42,97 @@ export const Printer = {
|
||||
icon: EditIcon,
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/info?printerId=${_id}&action=edit`
|
||||
},
|
||||
{ type: 'divider' },
|
||||
{
|
||||
name: 'restartSubmenu',
|
||||
label: 'Restart',
|
||||
icon: ReloadIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.online == false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'restart',
|
||||
label: 'Restart',
|
||||
icon: ReloadIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.online == false
|
||||
},
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/control?printerId=${_id}&action=restart`
|
||||
},
|
||||
{
|
||||
name: 'restartFirmware',
|
||||
label: 'Restart Firmware',
|
||||
icon: ReloadIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.online == false
|
||||
},
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/control?printerId=${_id}&action=restartFirmware`
|
||||
},
|
||||
{ type: 'divider' },
|
||||
{
|
||||
name: 'restartMoonraker',
|
||||
label: 'Restart Moonraker',
|
||||
icon: ReloadIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.online == false
|
||||
},
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/control?printerId=${_id}&action=restartMoonraker`
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'queue',
|
||||
label: 'Queue',
|
||||
icon: PlayCircleIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.online == false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'Start',
|
||||
label: 'Start',
|
||||
icon: PlayCircleIcon,
|
||||
disabled: (objectData) => {
|
||||
console.log(objectData?.subJobs?.length)
|
||||
return (
|
||||
objectData?.state?.type == 'error' ||
|
||||
objectData?.state?.type == 'printing' ||
|
||||
objectData?.subJobs?.length == 0 ||
|
||||
objectData?.subJobs?.length == undefined
|
||||
)
|
||||
},
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/control?printerId=${_id}&action=startQueue`
|
||||
},
|
||||
{
|
||||
name: 'pause',
|
||||
label: 'Pause',
|
||||
icon: PauseCircleIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.state?.type != 'printing'
|
||||
},
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/control?printerId=${_id}&action=pauseQueue`
|
||||
},
|
||||
{
|
||||
name: 'Stop',
|
||||
label: 'Stop',
|
||||
icon: StopCircleIcon,
|
||||
disabled: (objectData) => {
|
||||
return (
|
||||
objectData?.state?.type != 'printing' ||
|
||||
objectData?.state?.type != 'error'
|
||||
)
|
||||
},
|
||||
url: (_id) =>
|
||||
`/dashboard/production/printers/control?printerId=${_id}&action=stopQueue`
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
columns: ['name', '_id', 'state', 'tags', 'connectedAt'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user