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'
3
3
4
4
import BaseResource from './backend/adapters/resource/base-resource'
5
5
import BaseDatabase from './backend/adapters/database/base-database'
6
- import { PageContext } from './backend/actions/action.interface'
6
+ import { IsFunction , PageContext } from './backend/actions/action.interface'
7
7
import { ResourceOptions } from './backend/decorators/resource/resource-options.interface'
8
8
import { Locale } from './locale/config'
9
9
import { CurrentAdmin } from './current-admin.interface'
@@ -389,6 +389,11 @@ export type AdminPage = {
389
389
* Page icon
390
390
*/
391
391
icon ?: string ;
392
+
393
+ /**
394
+ * Page visibility
395
+ */
396
+ isVisible ?: boolean | IsFunction
392
397
}
393
398
394
399
/**
Original file line number Diff line number Diff line change
1
+ import { IsFunction } from 'src/backend'
2
+ import { ActionJSON } from './action'
3
+
1
4
/**
2
5
* Representing the page in the sidebar
3
6
* @subcategory Frontend
@@ -6,14 +9,19 @@ export interface PageJSON {
6
9
/**
7
10
* Page name
8
11
*/
9
- name : string ;
12
+ name : string
10
13
/**
11
14
* Page component. Bundled with {@link AdminJS.bundle}
12
15
*/
13
- component : string ;
16
+ component : string
14
17
15
18
/**
16
19
* Page icon
17
20
*/
18
- icon ?: string ;
21
+ icon ?: string
22
+
23
+ /**
24
+ * Page visibility
25
+ */
26
+ isVisible : boolean | IsFunction
19
27
}
Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ import { AdminJSOptions } from '../../adminjs-options.interface'
2
2
3
3
import { PageJSON } from '../interfaces'
4
4
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 ] ) => ( {
7
7
name : key ,
8
8
component : adminPage . component ,
9
9
icon : adminPage . icon ,
10
+ isVisible : adminPage . isVisible ,
10
11
} ) )
11
12
12
13
export default pagesToStore
You can’t perform that action at this time.
0 commit comments