- Added a 'list' action to various object models, including AppPassword, AuditLog, Client, and more, to standardize access to list views across the application. - Updated the ObjectModels.js to include a new label for the 'list' action, improving clarity in the permission matrix. - Refactored Sidebar.js to incorporate user profile permissions for sidebar item visibility, enhancing user experience based on access rights. - Introduced utility functions for normalizing paths and filtering sidebar items based on user permissions, streamlining sidebar management. - Improved the overall structure and readability of the Sidebar and ObjectModels components.
132 lines
2.7 KiB
JavaScript
132 lines
2.7 KiB
JavaScript
import AuditLogIcon from '../../components/Icons/AuditLogIcon'
|
|
import ListIcon from '../../components/Icons/ListIcon'
|
|
|
|
export const AuditLog = {
|
|
name: 'auditLog',
|
|
label: 'Audit Log',
|
|
labelPlural: 'Audit Logs',
|
|
url: '/dashboard/management/auditlogs',
|
|
prefix: 'ADL',
|
|
icon: AuditLogIcon,
|
|
actions: [
|
|
{
|
|
name: 'list',
|
|
type: 'page',
|
|
pageName: 'list',
|
|
label: 'List',
|
|
icon: ListIcon
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'owner',
|
|
'parent',
|
|
'operation',
|
|
'changes',
|
|
'createdAt'
|
|
],
|
|
filters: [
|
|
'parent',
|
|
'owner',
|
|
'operation',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: ['createdAt', 'updatedAt'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'auditLog',
|
|
columnFixed: 'left',
|
|
value: null,
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
value: null,
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'auditLog',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
value: null,
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: 'owner',
|
|
label: 'Owner',
|
|
type: 'object',
|
|
objectType: (objectData) => {
|
|
return objectData.ownerType
|
|
},
|
|
columnFixed: 'left',
|
|
value: null,
|
|
showCopy: true,
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'parent',
|
|
label: 'Parent',
|
|
type: 'object',
|
|
objectType: (objectData) => {
|
|
return objectData.parentType
|
|
},
|
|
value: null,
|
|
showCopy: true,
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'operation',
|
|
label: 'Operation',
|
|
columnWidth: 120,
|
|
type: 'operation'
|
|
},
|
|
{
|
|
name: 'changes',
|
|
label: 'Changes',
|
|
columnWidth: 500,
|
|
type: (objectData) => {
|
|
return objectData.operation === 'subscribe' ||
|
|
objectData.operation === 'unsubscribe'
|
|
? 'text'
|
|
: 'propertyChanges'
|
|
},
|
|
objectType: (objectData) => {
|
|
return objectData.parentType
|
|
},
|
|
value: (objectData) => {
|
|
if (objectData.operation === 'subscribe') {
|
|
return 'User subscribed to object.'
|
|
}
|
|
if (objectData.operation === 'unsubscribe') {
|
|
return 'User unsubscribed from object.'
|
|
}
|
|
|
|
return objectData.changes
|
|
},
|
|
showCopy: true
|
|
}
|
|
]
|
|
}
|