Enhance DocumentJob, DocumentPrinter, and Printer models by adding new fields for state, object IDs, and document size management. Update action labels for clarity and improve data handling with date formatting. Introduce new connection options for printers and enhance the user interface for job management.
This commit is contained in:
parent
8d63b9a84d
commit
afe25c1e09
@ -2,11 +2,12 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|||||||
import ReloadIcon from '../../components/Icons/ReloadIcon'
|
import ReloadIcon from '../../components/Icons/ReloadIcon'
|
||||||
import EditIcon from '../../components/Icons/EditIcon'
|
import EditIcon from '../../components/Icons/EditIcon'
|
||||||
import DocumentJobIcon from '../../components/Icons/DocumentJobIcon'
|
import DocumentJobIcon from '../../components/Icons/DocumentJobIcon'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
export const DocumentJob = {
|
export const DocumentJob = {
|
||||||
name: 'documentJob',
|
name: 'documentJob',
|
||||||
label: 'Document Job',
|
label: 'Document Job',
|
||||||
prefix: 'DSZ',
|
prefix: 'DJB',
|
||||||
icon: DocumentJobIcon,
|
icon: DocumentJobIcon,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
@ -60,7 +61,9 @@ export const DocumentJob = {
|
|||||||
columnWidth: 200,
|
columnWidth: 200,
|
||||||
columnFixed: 'left',
|
columnFixed: 'left',
|
||||||
value: (objectData) => {
|
value: (objectData) => {
|
||||||
return `${objectData?.documentTemplate?.name || 'No template'} (${objectData?.object?.name || 'No name'})`
|
if (objectData?.createdAt == undefined) {
|
||||||
|
return `${objectData?.documentTemplate?.name || 'No template'} ${dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')} (${objectData?.object?.name || objectData?.object?._id})`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -69,6 +72,14 @@ export const DocumentJob = {
|
|||||||
type: 'dateTime',
|
type: 'dateTime',
|
||||||
readOnly: true
|
readOnly: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'state',
|
||||||
|
label: 'Status',
|
||||||
|
type: 'state',
|
||||||
|
objectType: 'printer',
|
||||||
|
showName: false,
|
||||||
|
readOnly: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'objectType',
|
name: 'objectType',
|
||||||
label: 'Object Type',
|
label: 'Object Type',
|
||||||
@ -86,6 +97,15 @@ export const DocumentJob = {
|
|||||||
return objectData?.objectType
|
return objectData?.objectType
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'object._id',
|
||||||
|
label: 'Object ID',
|
||||||
|
type: 'id',
|
||||||
|
showHyperlink: true,
|
||||||
|
objectType: (objectData) => {
|
||||||
|
return objectData?.objectType
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'documentTemplate',
|
name: 'documentTemplate',
|
||||||
label: 'Template',
|
label: 'Template',
|
||||||
@ -101,6 +121,13 @@ export const DocumentJob = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'documentTemplate._id',
|
||||||
|
label: 'Template ID',
|
||||||
|
type: 'id',
|
||||||
|
showHyperlink: true,
|
||||||
|
objectType: 'documentTemplate'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'documentPrinter',
|
name: 'documentPrinter',
|
||||||
label: 'Printer',
|
label: 'Printer',
|
||||||
@ -114,6 +141,13 @@ export const DocumentJob = {
|
|||||||
online: true
|
online: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'documentPrinter._id',
|
||||||
|
label: 'Printer ID',
|
||||||
|
type: 'id',
|
||||||
|
showHyperlink: true,
|
||||||
|
objectType: 'documentPrinter'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,52 +74,88 @@ export const DocumentPrinter = {
|
|||||||
readOnly: true
|
readOnly: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'documentSize',
|
name: 'state',
|
||||||
label: 'Document Size',
|
label: 'Status',
|
||||||
|
type: 'state',
|
||||||
|
objectType: 'printer',
|
||||||
|
showName: false,
|
||||||
|
readOnly: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'active',
|
||||||
|
label: 'Active',
|
||||||
|
type: 'bool',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'online',
|
||||||
|
label: 'Online',
|
||||||
|
type: 'bool',
|
||||||
|
readOnly: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'host',
|
||||||
|
label: 'Host',
|
||||||
required: true,
|
required: true,
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
objectType: 'host',
|
||||||
|
showHyperlink: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'host._id',
|
||||||
|
label: 'Host ID',
|
||||||
|
type: 'id',
|
||||||
|
objectType: 'host',
|
||||||
|
showCopy: true,
|
||||||
|
showHyperlink: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'connection.mode',
|
||||||
|
label: 'Mode',
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{ label: 'Network', value: 'network' },
|
||||||
|
{ label: 'Serial', value: 'serial' }
|
||||||
|
],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'connection.interface',
|
||||||
|
label: 'Interface',
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{ label: 'CUPS', value: 'cups' },
|
||||||
|
{ label: 'Epson Receipt', value: 'epsonReceipt' },
|
||||||
|
{ label: 'Star Receipt', value: 'starReceipt' }
|
||||||
|
],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'connection.host',
|
||||||
|
label: 'Connection String',
|
||||||
|
type: 'text',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'currentDocumentSize',
|
||||||
|
label: 'Current Document Size',
|
||||||
|
required: false,
|
||||||
|
type: 'object',
|
||||||
objectType: 'documentSize'
|
objectType: 'documentSize'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'documentSize._id',
|
name: 'currentDocumentSize._id',
|
||||||
label: 'Document Size ID',
|
label: 'Current Document Size ID',
|
||||||
type: 'id',
|
type: 'id',
|
||||||
objectType: 'documentSize',
|
objectType: 'documentSize',
|
||||||
showCopy: true,
|
showCopy: true,
|
||||||
showHyperlink: true
|
showHyperlink: true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'active',
|
|
||||||
label: 'Active',
|
|
||||||
required: true,
|
|
||||||
type: 'bool'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'tags',
|
name: 'tags',
|
||||||
label: 'Tags',
|
label: 'Tags',
|
||||||
required: false,
|
required: false,
|
||||||
type: 'tags'
|
type: 'tags'
|
||||||
},
|
|
||||||
{ name: 'global', label: 'Global', required: false, type: 'bool' },
|
|
||||||
{
|
|
||||||
name: 'parent',
|
|
||||||
label: 'Parent',
|
|
||||||
required: false,
|
|
||||||
type: 'object',
|
|
||||||
objectType: 'documentPrinter',
|
|
||||||
disabled: (documentPrinter) => {
|
|
||||||
if (documentPrinter.global == true) {
|
|
||||||
documentPrinter.parent = null
|
|
||||||
}
|
|
||||||
return documentPrinter.global
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'parent._id',
|
|
||||||
label: 'Parent ID',
|
|
||||||
required: false,
|
|
||||||
type: 'id',
|
|
||||||
objectType: 'documentPrinter'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import EditIcon from '../../components/Icons/EditIcon'
|
|||||||
import PlayCircleIcon from '../../components/Icons/PlayCircleIcon'
|
import PlayCircleIcon from '../../components/Icons/PlayCircleIcon'
|
||||||
import PauseCircleIcon from '../../components/Icons/PauseCircleIcon'
|
import PauseCircleIcon from '../../components/Icons/PauseCircleIcon'
|
||||||
import StopCircleIcon from '../../components/Icons/StopCircleIcon'
|
import StopCircleIcon from '../../components/Icons/StopCircleIcon'
|
||||||
|
import FilamentStockIcon from '../../components/Icons/FilamentStockIcon'
|
||||||
export const Printer = {
|
export const Printer = {
|
||||||
name: 'printer',
|
name: 'printer',
|
||||||
label: 'Printer',
|
label: 'Printer',
|
||||||
@ -94,8 +94,8 @@ export const Printer = {
|
|||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'Start',
|
name: 'startQueue',
|
||||||
label: 'Start',
|
label: 'Start Queue',
|
||||||
icon: PlayCircleIcon,
|
icon: PlayCircleIcon,
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
console.log(objectData?.subJobs?.length)
|
console.log(objectData?.subJobs?.length)
|
||||||
@ -109,28 +109,60 @@ export const Printer = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/production/printers/control?printerId=${_id}&action=startQueue`
|
`/dashboard/production/printers/control?printerId=${_id}&action=startQueue`
|
||||||
},
|
},
|
||||||
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'pause',
|
name: 'pauseJob',
|
||||||
label: 'Pause',
|
label: 'Pause Job',
|
||||||
icon: PauseCircleIcon,
|
icon: PauseCircleIcon,
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'printing'
|
return objectData?.state?.type != 'printing'
|
||||||
},
|
},
|
||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/production/printers/control?printerId=${_id}&action=pauseQueue`
|
`/dashboard/production/printers/control?printerId=${_id}&action=pauseJob`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Stop',
|
name: 'resumeJob',
|
||||||
label: 'Stop',
|
label: 'Resume Job',
|
||||||
|
icon: PlayCircleIcon,
|
||||||
|
disabled: (objectData) => {
|
||||||
|
return objectData?.state?.type != 'printing'
|
||||||
|
},
|
||||||
|
url: (_id) =>
|
||||||
|
`/dashboard/production/printers/control?printerId=${_id}&action=resumeJob`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cancelJob',
|
||||||
|
label: 'Cancel Job',
|
||||||
icon: StopCircleIcon,
|
icon: StopCircleIcon,
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return (
|
return (
|
||||||
objectData?.state?.type != 'printing' ||
|
objectData?.state?.type != 'printing' &&
|
||||||
objectData?.state?.type != 'error'
|
objectData?.state?.type != 'error'
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/production/printers/control?printerId=${_id}&action=stopQueue`
|
`/dashboard/production/printers/control?printerId=${_id}&action=cancelJob`
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'filamentStock',
|
||||||
|
label: 'Filament Stock',
|
||||||
|
icon: FilamentStockIcon,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'loadFilamentStock',
|
||||||
|
label: 'Load Filament Stock',
|
||||||
|
icon: FilamentStockIcon,
|
||||||
|
url: (_id) =>
|
||||||
|
`/dashboard/production/printers/control?printerId=${_id}&action=loadFilamentStock`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'unloadFilamentStock',
|
||||||
|
label: 'Unload Filament Stock',
|
||||||
|
icon: FilamentStockIcon,
|
||||||
|
url: (_id) =>
|
||||||
|
`/dashboard/production/printers/control?printerId=${_id}&action=unloadFilamentStock`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -299,6 +331,14 @@ export const Printer = {
|
|||||||
label: 'Alerts',
|
label: 'Alerts',
|
||||||
type: 'alerts',
|
type: 'alerts',
|
||||||
required: false
|
required: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'subJobs',
|
||||||
|
label: 'Queue',
|
||||||
|
type: 'objectList',
|
||||||
|
objectType: 'subJob',
|
||||||
|
required: false,
|
||||||
|
readOnly: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user