AdminForthResourceInputCommon
Resource describes one table or collection in database. AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
Extended by
Properties
columns
columns:
AdminForthResourceColumnInputCommon
[]
Array of columns which will be displayed in the admin panel. Each column has its own configuration.
dataSource
dataSource:
string
ID of datasource which will be used to fetch data from.
label?
optional
label:string
Label for resource which will be displayed in the admin panel. By default it equals to table name in database.
options?
optional
options:object
General options for resource.
allowedActions?
optional
allowedActions:AllowedActionsResolved
Allowed actions for resource.
Example:
allowedActions: {
create: ({ resource, adminUser }) => {
// Allow only superadmin to create records
return adminUser.dbUser.role === 'superadmin';
},
delete: false, // disable delete action for all users
}
bulkActions?
optional
bulkActions:AdminForthBulkActionCommon
[]
Custom bulk actions list. Bulk actions available in list view when user selects multiple records by using checkboxes.
createFieldGroups?
optional
createFieldGroups:object
[]
defaultSort?
optional
defaultSort:object
Default sort for list view. Example:
import { AdminForthSortDirections } from 'adminforth';
...
defaultSort: {
columnName: 'created_at',
direction: AdminForthSortDirections.ASC,
}
defaultSort.columnName
columnName:
string
Column name which will be used to sort records.