1818 */
1919
2020import { assign } from 'lodash' ;
21- import { IndexedArray } from '../indexed_array' ;
22- import { capabilities } from '../capabilities' ;
21+ import { IndexedArray } from '../../../../legacy/ui/public/indexed_array' ;
2322
2423const listeners = [ ] ;
2524
@@ -37,7 +36,7 @@ export class ManagementSection {
3736 * @returns {ManagementSection }
3837 */
3938
40- constructor ( id , options = { } ) {
39+ constructor ( id , options = { } , capabilities ) {
4140 this . display = id ;
4241 this . id = id ;
4342 this . items = new IndexedArray ( {
@@ -49,13 +48,14 @@ export class ManagementSection {
4948 this . tooltip = '' ;
5049 this . icon = '' ;
5150 this . url = '' ;
51+ this . capabilities = capabilities ;
5252
5353 assign ( this , options ) ;
5454 }
5555
5656 get visibleItems ( ) {
5757 return this . items . inOrder . filter ( item => {
58- const capabilityManagementSection = capabilities . get ( ) . management [ this . id ] ;
58+ const capabilityManagementSection = this . capabilities . management [ this . id ] ;
5959 const itemCapability = capabilityManagementSection
6060 ? capabilityManagementSection [ item . id ]
6161 : null ;
@@ -83,7 +83,7 @@ export class ManagementSection {
8383 */
8484
8585 register ( id , options = { } ) {
86- const item = new ManagementSection ( id , assign ( options , { parent : this } ) ) ;
86+ const item = new ManagementSection ( id , assign ( options , { parent : this } ) , this . capabilities ) ;
8787
8888 if ( this . hasItem ( id ) ) {
8989 throw new Error ( `'${ id } ' is already registered` ) ;
0 commit comments