- Updated filters in multiple models such as AppPassword, AuditLog, Client, Courier, and others to include '_reference' and other relevant fields like 'createdAt' and 'updatedAt'. - This change improves data handling and consistency across the application, ensuring that all necessary fields are available for filtering.
160 lines
3.9 KiB
JavaScript
160 lines
3.9 KiB
JavaScript
import AppPasswordIcon from '../../components/Icons/AppPasswordIcon'
|
|
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 LockIcon from '../../components/Icons/LockIcon'
|
|
|
|
export const AppPassword = {
|
|
name: 'appPassword',
|
|
label: 'App Password',
|
|
labelPlural: 'App Passwords',
|
|
url: '/dashboard/management/apppasswords',
|
|
prefix: 'APP',
|
|
icon: AppPasswordIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/apppasswords/info?appPasswordId=${_id}`
|
|
},
|
|
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/apppasswords/info?appPasswordId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
},
|
|
disabled: (objectData) => {
|
|
return objectData?._user?._id != objectData?.user?._id
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/apppasswords/info?appPasswordId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/apppasswords/info?appPasswordId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{ type: 'divider' },
|
|
{
|
|
name: 'regenerateSecret',
|
|
label: 'Regenerate Secret',
|
|
type: 'button',
|
|
row: true,
|
|
icon: LockIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/apppasswords/info?appPasswordId=${_id}&action=regenerateSecret`,
|
|
disabled: (objectData) => {
|
|
return objectData?._user?._id != objectData?.user?._id
|
|
}
|
|
}
|
|
],
|
|
columns: ['_reference', 'name', 'user', 'active', 'createdAt', 'updatedAt'],
|
|
filters: [
|
|
'_id',
|
|
'name',
|
|
'user',
|
|
'active',
|
|
'user._id',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: ['name', 'user', 'active', 'createdAt', 'updatedAt'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
columnFixed: 'left',
|
|
type: 'id',
|
|
objectType: 'appPassword',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'appPassword',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
columnFixed: 'left',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200
|
|
},
|
|
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: 'user',
|
|
label: 'User',
|
|
required: true,
|
|
readOnly: (objectData) => {
|
|
return objectData?.createdAt != null
|
|
},
|
|
type: 'object',
|
|
objectType: 'user',
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'active',
|
|
label: 'Active',
|
|
required: true,
|
|
type: 'bool',
|
|
columnWidth: 125
|
|
},
|
|
{
|
|
name: 'secret',
|
|
label: 'Secret',
|
|
type: 'password',
|
|
required: false,
|
|
readOnly: true,
|
|
value: (objectData) =>
|
|
objectData?._id ? '••••••••••••••••••••••••••••••••' : undefined,
|
|
columnWidth: 200
|
|
}
|
|
]
|
|
}
|