Skip to main content

AdminForthResource

AdminForthResource: object

Resource describes one table or collection in database. AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.

Type declaration

columns

columns: AdminForthResourceColumn[]

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.

dataSourceColumns?

optional dataSourceColumns: AdminForthResourceColumn[]

hooks?

optional hooks: object

hooks.create?

optional create: object

hooks.create.afterSave?

optional afterSave: AfterSaveFunction | AfterSaveFunction[]

hooks.create.beforeSave?

optional beforeSave: BeforeSaveFunction | BeforeSaveFunction[]

hooks.delete?

optional delete: object

hooks.delete.afterSave?

optional afterSave: BeforeSaveFunction | BeforeSaveFunction[]

hooks.delete.beforeSave?

optional beforeSave: BeforeSaveFunction | BeforeSaveFunction[]

hooks.edit?

optional edit: object

hooks.edit.afterSave?

optional afterSave: AfterSaveFunction | AfterSaveFunction[]

hooks.edit.beforeSave?

optional beforeSave: BeforeSaveFunction | BeforeSaveFunction[]

hooks.list?

optional list: object

hooks.list.afterDatasourceResponse?

optional afterDatasourceResponse: AfterDataSourceResponseFunction | AfterDataSourceResponseFunction[]

hooks.list.beforeDatasourceRequest?

optional beforeDatasourceRequest: BeforeDataSourceRequestFunction | BeforeDataSourceRequestFunction[]

hooks.show?

optional show: object

hooks.show.afterDatasourceResponse?

optional afterDatasourceResponse: AfterDataSourceResponseFunction | AfterDataSourceResponseFunction[]

hooks.show.beforeDatasourceRequest?

optional beforeDatasourceRequest: BeforeDataSourceRequestFunction | BeforeDataSourceRequestFunction[]

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

options.allowedActions?

optional allowedActions: AllowedActions

options.bulkActions?

optional bulkActions: object[]

options.defaultSort?

optional defaultSort: object

options.defaultSort.columnName

columnName: string

options.defaultSort.direction

direction: AdminForthSortDirections | string

options.listPageSize?

optional listPageSize: number

Page size for list view

options.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',
}
}

options.pageInjections.create?

optional create: object

Custom components which can be injected into resource create page.

Component accepts next props: [resource, adminUser, meta]

options.pageInjections.create.afterBreadcrumbs?

optional afterBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.create.beforeBreadcrumbs?

optional beforeBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.create.bottom?

optional bottom: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.edit?

optional edit: object

Custom components which can be injected into resource edit page.

Component accepts next props: [record, resource, adminUser, meta]

options.pageInjections.edit.afterBreadcrumbs?

optional afterBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.edit.beforeBreadcrumbs?

optional beforeBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.edit.bottom?

optional bottom: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.list?

optional list: object

Custom components which can be injected into resource list page.

Component accepts next props: [resource, adminUser, meta]

options.pageInjections.list.afterBreadcrumbs?

optional afterBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.list.beforeBreadcrumbs?

optional beforeBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.list.bottom?

optional bottom: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.show?

optional show: object

Custom components which can be injected into resource show page.

Component accepts next props: [record, resource, adminUser, meta]

options.pageInjections.show.afterBreadcrumbs?

optional afterBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.show.beforeBreadcrumbs?

optional beforeBreadcrumbs: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

options.pageInjections.show.bottom?

optional bottom: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

plugins?

optional plugins: AdminForthPluginType[]

Array of plugins which will be used to modify resource configuration.

recordLabel?

optional recordLabel: Function

Hook which allow you to modify record label

Example:

recordLabel: (record) => `${record.name} - ${record.id}`,

resourceId?

optional resourceId: string

Unique identifier of resource. By default it equals to table name in database. If you wish you can explicitly set it to any string. We added to support cases when 2 datasources have tables with the same name.

table

table: string

Table name in database which will be used to fetch data from. Might be case sensitive.