ResourceOptionsInput
General options for resource.
Extends
Omit
<AdminForthResourceCommon
["options"
],"allowedActions"
|"bulkActions"
>
Properties
allowedActions?
optional
allowedActions:AllowedActionsInput
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:AdminForthBulkAction
[]
Custom bulk actions list. Bulk actions available in list view when user selects multiple records by using checkboxes.
createFieldGroups?
optional
createFieldGroups:object
[]
Inherited from
Omit.createFieldGroups
defaultSort?
optional
defaultSort:object
Default sort for list view. Example:
import { AdminForthSortDirections } from 'adminforth';
...
defaultSort: {
columnName: 'created_at',
direction: AdminForthSortDirections.ASC,
}
columnName
columnName:
string
Column name which will be used to sort records.
direction
direction:
string
Direction of sorting. Can be 'asc' or 'desc'.
Inherited from
Omit.defaultSort
editFieldGroups?
optional
editFieldGroups:object
[]
Inherited from
Omit.editFieldGroups
fieldGroups?
optional
fieldGroups:object
[]
Allows to make groups of columns in show, create and edit resource pages.
Inherited from
Omit.fieldGroups
listPageSize?
optional
listPageSize:number
Page size for list view
Inherited from
Omit.listPageSize
listRowsAutoRefreshSeconds?
optional
listRowsAutoRefreshSeconds:number
Whether to refresh existing list rows automatically every N seconds.
Inherited from
Omit.listRowsAutoRefreshSeconds
listTableClickUrl()?
optional
listTableClickUrl: (record
,adminUser
) =>Promise
<string
>
Callback to define what happens when user clicks on record in list view.
By default show view will be opened.
If you wish to open custom page, return URL to the custom page (can start with https://, or relative adminforth path)
If you wish to open page in new tab, add target=_blank
get param to returned URL, example:
listTableClickUrl: async (record, adminUser) => {
return `https://google.com/search?q=${record.name}&target=_blank`;
}
If you wish to do nothing on click, return null.
Example:
listTableClickUrl: async (record, adminUser) => {
return null;
}
Parameters
Parameter | Type | Description |
---|---|---|
record | any | record which was clicked |
adminUser | AdminUser | user who clicked |
Returns
Promise
<string
>
Inherited from
Omit.listTableClickUrl
pageInjections?
optional
pageInjections:object
Custom components which can be injected into AdminForth CRUD pages. Each injection is a path to a custom component which will be displayed in the admin panel. Can be also array to render multiple injections one after another.
Example:
pageInjections: {
list: {
beforeBreadcrumbs: '@@/Announcement.vue',
}
}
create?
optional
create:object
Custom components which can be injected into resource create page.
Component accepts next props: [resource, adminUser, meta]
create.afterBreadcrumbs?
optional
afterBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
create.beforeBreadcrumbs?
optional
beforeBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
create.bottom?
optional
bottom:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
create.threeDotsDropdownItems?
optional
threeDotsDropdownItems:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
edit?
optional
edit:object
Custom components which can be injected into resource edit page.
Component accepts next props: [record, resource, adminUser, meta]
edit.afterBreadcrumbs?
optional
afterBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
edit.beforeBreadcrumbs?
optional
beforeBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
edit.bottom?
optional
bottom:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
edit.threeDotsDropdownItems?
optional
threeDotsDropdownItems:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
list?
optional
list:object
Custom components which can be injected into resource list page.
Component accepts next props: [resource, adminUser, meta]
list.afterBreadcrumbs?
optional
afterBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
list.beforeBreadcrumbs?
optional
beforeBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
list.bottom?
optional
bottom:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
list.customActionIcons?
optional
customActionIcons:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
list.threeDotsDropdownItems?
optional
threeDotsDropdownItems:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
show?
optional
show:object
Custom components which can be injected into resource show page.
Component accepts next props: [record, resource, adminUser, meta]
show.afterBreadcrumbs?
optional
afterBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
show.beforeBreadcrumbs?
optional
beforeBreadcrumbs:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
show.bottom?
optional
bottom:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
show.threeDotsDropdownItems?
optional
threeDotsDropdownItems:AdminForthComponentDeclaration
|AdminForthComponentDeclaration
[]
Inherited from
Omit.pageInjections
showFieldGroups?
optional
showFieldGroups:object
[]
Inherited from
Omit.showFieldGroups