Add new 'deploy' action to Job model and enhance Printer model with additional fields for 'active', 'online', 'currentJob', 'currentSubJob', and 'alerts'; update existing fields for improved data handling.

This commit is contained in:
Tom Butcher 2025-09-05 23:19:56 +01:00
parent f90eb4ed37
commit 1b7fd77a99
2 changed files with 64 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import JobIcon from '../../components/Icons/JobIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
export const Job = {
name: 'job',
@ -16,6 +17,19 @@ export const Job = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/production/jobs/info?jobId=${_id}`
},
{
name: 'deploy',
label: 'Deploy',
default: true,
row: true,
icon: CheckIcon,
url: (_id) =>
`/dashboard/production/jobs/info?jobId=${_id}?action=deploy`,
disabled: (objectData) => {
console.log('Should be disabled', objectData?.state?.type != 'draft')
return objectData?.state?.type != 'draft'
}
},
{
name: 'reload',
label: 'Reload',

View File

@ -76,12 +76,24 @@ export const Printer = {
showName: false,
readOnly: true
},
{
name: 'active',
label: 'Active',
type: 'bool',
required: true
},
{
name: 'online',
label: 'Online',
type: 'bool',
readOnly: true
},
{
name: 'vendor',
label: 'Vendor',
type: 'object',
objectType: 'vendor',
required: true
required: false
},
{
name: 'vendor._id',
@ -149,7 +161,7 @@ export const Printer = {
label: 'Filament Stock',
type: 'object',
objectType: 'filamentStock',
required: true
required: false
},
{
name: 'currentFilamentStock._id',
@ -158,6 +170,42 @@ export const Printer = {
objectType: 'filamentStock',
showHyperlink: true,
readOnly: true
},
{
name: 'currentJob',
label: 'Current Job',
type: 'object',
objectType: 'job',
required: false
},
{
name: 'currentJob._id',
label: 'Current Job ID',
type: 'id',
objectType: 'job',
showHyperlink: true,
readOnly: true
},
{
name: 'currentSubJob',
label: 'Current Sub Job',
type: 'object',
objectType: 'subJob',
required: false
},
{
name: 'currentSubJob._id',
label: 'Current Sub Job ID',
type: 'id',
objectType: 'subJob',
showHyperlink: true,
readOnly: true
},
{
name: 'alerts',
label: 'Alerts',
type: 'alerts',
required: false
}
]
}