Main provide the 'main' area of admin site.
//main settingsconst mainConfig = {folder: {actions: [(actionProps:ActionProps)=><SetPriority {...actionProps} />]},frontpage: {list: ['frontpage_block'],},role: {view: true,},article: {view: true,metainfo:true,actions: [(actionProps:ActionProps)=><Move {...actionProps} />],},user: {view: true,viewComponent: UserRoles,},};const getMainConfig =(content:any)=>{return mainConfig[content.content_type]}//list settingsconst getListConfig = (_parent: any, contenttype: string)=>{const commonSettings = {show_header: true,show_table_header: true,pagination: 10,sort:[],row_actions: [{link: '/edit/{_contenttype_id}?from=/main/{_from_id}',name: 'Edit',icon: 'icon-edit',},(actionProps:ActionProps)=><Delete {...actionProps} />]}return commonSettings;}//main in route<Routepath='/main/:id'exact={true}render={(route) => (<MainonLoad={(content)=>{//set current content for left menu use.setCurrent(content);}}id={parseInt(route.match.params.id)}getMainConfig={getMainConfig}getListConfig={getListConfig}redirect={(url: string) =>commonAfterAction(route.history, 0, [url])}/>)}/>
Prop name | Type | Default | Required | Description |
---|---|---|---|---|
id | number | — | true | id of the content |
contenttype | string | — | false | Content type, used for non-location content |
getMainConfig | (content: any) => MainSettings | — | true | Callback to get main config, return MainSettings |
getListConfig | (parent: any, contenttype: string) => ListProps | — | true | Callback to get list on this main, return ListProps |
onLoad | (content: any) => void | — | false | Invoked when content is fetched. Useful for leftmenu selection for example |
redirect | (url: string) => void | — | true | Redirect callback. for route use. |