AdminConfig
The AdminConfig Type allows you to influence the generated views and actions.
| Option | Type | default | description |
|---|---|---|---|
| routes | {[key:string]:RouteConfigType|string} | replaces a route to a generated view with a specific route to a custom component | |
| entities | {[name:string]:EntityViewConfig} | configuration of the views for a specific entity | |
| dateOptions | Intl.DateTimeFormatOptions | Javascript defaults | used for localization of dates |
| fileBaseUrl | string | http://localhost:4000/files (opens in a new tab) | should point to the base url for your stored files |
| orderFields | {field:string, direction:'asc'|'desc'}[] | which fields should be used to order tables - 1st hit | |
| resources | key/value | resources used by the Admin UI | |
| fieldDefaults | Function | override default behavior independent from specific entities | |
| locale | string | en | used for localization |
| selectAsAutoCompleteFrom | number | 20 | in forms the selection of a value is rendered as select when <= 20 entries, and autocomplete when larger than 20 |
Routes
const commonConfig:AdminConfig = {
routes: {
Car: {
show: '/my/car/:id',
index: '/my/cars'
}
}
}Instead of rendering the default components you can route to any custom route and render your own component. For more details see Custom Components
Entities
The generated views are based on the index, show, edit, create actions for an entity. You can influence these generated views and actions per entity.
const commonConfig:AdminConfig = {
entities: {
Car: {
listTitle: 'Vehicles',
itemTitle: 'Vehice',
index: {
fields: ['license','color', 'Driver']
}
}
}For more details see Entity View.
DateOptions
When rendering dates, this options will be used
const commonConfig:AdminConfig = {
dateOptions: { year:'numeric', month: '2-digit', day: '2-digit' }
}fileBaseUrl
Point this to where your GraphQL API would store files.
const commonConfig:AdminConfig = {
fileBaseUrl: 'http://localhost:4000/files'
}