Tom Butcher e730e2c832
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
Update columnWidth properties across multiple models for consistency
- Increased the columnWidth from 250 or 120 to 260 in various models including DocumentJob, DocumentPrinter, FilamentStock, Host, Invoice, Job, and others.
- This change ensures a uniform width for better alignment and presentation in the UI.
2026-07-26 20:03:00 +01:00

243 lines
5.5 KiB
JavaScript

import HostIcon from '../../components/Icons/HostIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import BinIcon from '../../components/Icons/BinIcon'
import OTPIcon from '../../components/Icons/OTPIcon'
export const Host = {
name: 'host',
label: 'Host',
labelPlural: 'Hosts',
url: '/dashboard/management/hosts',
prefix: 'HST',
icon: HostIcon,
actions: [
{
name: 'info',
label: 'Info',
default: true,
row: true,
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/hosts/info?hostId=${_id}`
},
{
name: 'edit',
label: 'Edit',
row: true,
icon: EditIcon,
url: (_id) =>
`/dashboard/management/hosts/info?hostId=${_id}&action=edit`,
visible: (objectData) => {
return !(objectData?._isEditing && objectData?._isEditing == true)
}
},
{
name: 'finishEdit',
label: 'Save Edits',
icon: CheckIcon,
url: (_id) =>
`/dashboard/management/hosts/info?hostId=${_id}&action=finishEdit`,
visible: (objectData) => {
return objectData?._isEditing && objectData?._isEditing == true
}
},
{
name: 'cancelEdit',
label: 'Cancel Edits',
icon: XMarkIcon,
url: (_id) =>
`/dashboard/management/hosts/info?hostId=${_id}&action=cancelEdit`,
visible: (objectData) => {
return objectData?._isEditing && objectData?._isEditing == true
}
},
{
type: 'divider'
},
{
name: 'connect',
label: 'Connect',
icon: OTPIcon,
url: (_id) =>
`/dashboard/management/hosts/info?hostId=${_id}&action=hostOTP`
},
{
name: 'delete',
label: 'Delete',
icon: BinIcon,
danger: true,
url: (_id) =>
`/dashboard/management/hosts/info?hostId=${_id}&action=delete`
}
],
columns: ['_reference', 'name', 'state', 'tags', 'connectedAt'],
filters: ['name', '_id', 'state', 'tags'],
sorters: ['name', 'state', 'connectedAt'],
group: ['tags'],
properties: [
{
name: '_id',
label: 'ID',
type: 'id',
objectType: 'host',
showCopy: true,
columnWidth: 140
},
{
name: 'createdAt',
label: 'Created At',
type: 'dateTime',
readOnly: true,
columnWidth: 175
},
{
name: '_reference',
label: 'Reference',
type: 'reference',
columnFixed: 'left',
objectType: 'host',
showCopy: true,
readOnly: true,
columnWidth: 180
},
{
name: 'updatedAt',
label: 'Updated At',
type: 'dateTime',
readOnly: true,
columnWidth: 175
},
{
name: 'name',
label: 'Name',
required: true,
type: 'text',
columnWidth: 200,
columnFixed: 'left'
},
{
name: 'connectedAt',
label: 'Connected At',
type: 'dateTime',
readOnly: true,
columnWidth: 175
},
{
name: 'state',
label: 'State',
type: 'state',
objectType: 'host',
showName: false,
readOnly: true,
columnWidth: 260
},
{
name: 'online',
label: 'Online',
type: 'bool',
readOnly: true,
columnWidth: 150
},
{
name: 'active',
label: 'Active',
type: 'bool',
required: true,
columnWidth: 125
},
{
name: 'deviceInfo.os',
label: 'Operating System',
type: 'text',
required: false,
readOnly: true,
columnWidth: 220,
value: (objectData) => {
if (
objectData.deviceInfo?.os?.type &&
objectData.deviceInfo?.os?.release &&
objectData.deviceInfo?.os?.arch
) {
return `${objectData.deviceInfo.os.type} ${objectData.deviceInfo.os.release} (${objectData.deviceInfo.os.arch})`
}
}
},
{
name: 'deviceInfo.os.hostname',
label: 'Hostname',
type: 'text',
required: false,
readOnly: true,
columnWidth: 180
},
{
name: 'deviceInfo.cpu.model',
label: 'CPU Model',
type: 'text',
required: false,
readOnly: true,
columnWidth: 200
},
{
name: 'deviceInfo.cpu',
label: 'CPU Info',
type: 'text',
required: false,
readOnly: true,
columnWidth: 150,
value: (objectData) => {
if (
objectData.deviceInfo?.cpu?.cores &&
objectData.deviceInfo?.cpu?.speedMHz
) {
return `Cores: ${objectData.deviceInfo.cpu.cores}, Speed: ${objectData.deviceInfo.cpu.speedMHz} MHz`
}
}
},
{
name: 'deviceInfo.user.username',
label: 'User',
type: 'text',
required: false,
readOnly: true,
columnWidth: 120
},
{
name: 'deviceInfo.user.homedir',
label: 'User Home',
type: 'text',
required: false,
readOnly: true,
columnWidth: 200
},
{
name: 'deviceInfo.process.nodeVersion',
label: 'NodeJS Version',
type: 'text',
required: false,
readOnly: true,
columnWidth: 150
},
{
name: 'tags',
label: 'Tags',
type: 'tags',
required: false,
columnWidth: 200
},
{
name: 'files',
label: 'Files',
type: 'objectList',
objectType: 'file',
required: false,
readOnly: true,
columnWidth: 200
}
]
}