File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { TransformOptions as BabelConfig } from 'babel-core'
33
44import BaseResource from './backend/adapters/resource/base-resource'
55import BaseDatabase from './backend/adapters/database/base-database'
6- import { PageContext } from './backend/actions/action.interface'
6+ import { IsFunction , PageContext } from './backend/actions/action.interface'
77import { ResourceOptions } from './backend/decorators/resource/resource-options.interface'
88import { Locale } from './locale/config'
99import { CurrentAdmin } from './current-admin.interface'
@@ -389,6 +389,11 @@ export type AdminPage = {
389389 * Page icon
390390 */
391391 icon ?: string ;
392+
393+ /**
394+ * Page visibility
395+ */
396+ isVisible ?: boolean | IsFunction
392397}
393398
394399/**
Original file line number Diff line number Diff line change 1+ import { IsFunction } from 'src/backend'
2+ import { ActionJSON } from './action'
3+
14/**
25 * Representing the page in the sidebar
36 * @subcategory Frontend
@@ -6,14 +9,19 @@ export interface PageJSON {
69 /**
710 * Page name
811 */
9- name : string ;
12+ name : string
1013 /**
1114 * Page component. Bundled with {@link AdminJS.bundle}
1215 */
13- component : string ;
16+ component : string
1417
1518 /**
1619 * Page icon
1720 */
18- icon ?: string ;
21+ icon ?: string
22+
23+ /**
24+ * Page visibility
25+ */
26+ isVisible : boolean | IsFunction
1927}
Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ import { AdminJSOptions } from '../../adminjs-options.interface'
22
33import { PageJSON } from '../interfaces'
44
5- const pagesToStore = ( pages : AdminJSOptions [ 'pages' ] = { } ) : Array < PageJSON > => Object . entries ( pages )
6- . map ( ( [ key , adminPage ] ) => ( {
5+ const pagesToStore = ( pages : AdminJSOptions [ 'pages' ] = { } ) : Array < PageJSON > =>
6+ Object . entries ( pages ) . map ( ( [ key , adminPage ] ) => ( {
77 name : key ,
88 component : adminPage . component ,
99 icon : adminPage . icon ,
10+ isVisible : adminPage . isVisible ,
1011 } ) )
1112
1213export default pagesToStore
You can’t perform that action at this time.
0 commit comments