Some checks are pending
farmcontrol/farmcontrol-ui/pipeline/head Build queued...
133 lines
3.3 KiB
JavaScript
133 lines
3.3 KiB
JavaScript
import MaterialIcon from '../../components/Icons/MaterialIcon'
|
|
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 ReloadIcon from '../../components/Icons/ReloadIcon'
|
|
import BinIcon from '../../components/Icons/BinIcon'
|
|
|
|
export const Material = {
|
|
name: 'material',
|
|
label: 'Material',
|
|
prefix: 'MAT',
|
|
icon: MaterialIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/management/materials/info?materialId=${_id}`
|
|
},
|
|
{
|
|
name: 'reload',
|
|
label: 'Reload',
|
|
icon: ReloadIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/materials/info?materialId=${_id}&action=reload`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/materials/info?materialId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/materials/info?materialId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/materials/info?materialId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{ type: 'divider' },
|
|
{
|
|
name: 'delete',
|
|
label: 'Delete',
|
|
icon: BinIcon,
|
|
danger: true,
|
|
url: (_id) =>
|
|
`/dashboard/management/materials/info?materialId=${_id}&action=delete`
|
|
}
|
|
],
|
|
url: (id) => `/dashboard/management/materials/info?materialId=${id}`,
|
|
columns: ['_reference', 'name', 'tags', 'createdAt', 'updatedAt'],
|
|
filters: ['_id', 'name', 'tags'],
|
|
sorters: ['name', 'createdAt', 'updatedAt', '_id'],
|
|
group: ['tags'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
columnFixed: 'left',
|
|
type: 'id',
|
|
objectType: 'material',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'material',
|
|
showCopy: true,
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
columnFixed: 'left',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: 'tags',
|
|
label: 'Tags',
|
|
required: false,
|
|
type: 'tags',
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'url',
|
|
label: 'Link',
|
|
required: false,
|
|
type: 'url',
|
|
columnWidth: 300
|
|
}
|
|
]
|
|
}
|