1
1
import { EventEmitter , Injectable , OnDestroy } from '@angular/core' ;
2
2
import { BehaviorSubject , Observable , of , Subscription } from 'rxjs' ;
3
- import {
4
- GroupNavigationConstants , MENU_IDENTIFIERS , MenuItemClickEvent ,
5
- MenuOrder ,
6
- NavigationItem ,
7
- RIGHT_SIDE_INIT_PAGE_SIZE , SETTINGS_TRANSITION_ID ,
8
- UriNodeResource
9
- } from '../../public-api' ;
10
3
import { UriService } from "../../service/uri.service" ;
11
4
import { LoadingEmitter } from "../../../utility/loading-emitter" ;
12
5
import { filter , map , take } from "rxjs/operators" ;
@@ -29,7 +22,16 @@ import {AccessService} from "../../../authorization/permission/access.service";
29
22
import { ActivatedRoute } from "@angular/router" ;
30
23
import { ConfigurationService } from "../../../configuration/configuration.service" ;
31
24
import { View } from "../../../../commons/schema" ;
32
- import { RIGHT_SIDE_NEW_PAGE_SIZE } from '../../model/navigation-configs' ;
25
+ import {
26
+ MENU_IDENTIFIERS ,
27
+ MenuOrder ,
28
+ NavigationItem , RIGHT_SIDE_INIT_PAGE_SIZE ,
29
+ RIGHT_SIDE_NEW_PAGE_SIZE ,
30
+ SETTINGS_TRANSITION_ID
31
+ } from '../../model/navigation-configs' ;
32
+ import { UriNodeResource } from '../../model/uri-resource' ;
33
+ import { MenuItemClickEvent , MenuItemLoadedEvent } from '../../model/navigation-menu-events' ;
34
+ import { GroupNavigationConstants } from "../../model/group-navigation-constants" ;
33
35
34
36
/**
35
37
* Service for managing navigation in double-drawer
@@ -77,6 +79,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
77
79
protected customItemsInitialized : boolean ;
78
80
protected hiddenCustomItemsInitialized : boolean ;
79
81
protected itemClicked : EventEmitter < MenuItemClickEvent > ;
82
+ protected itemLoaded : EventEmitter < MenuItemLoadedEvent > ;
80
83
81
84
constructor ( protected _uriService : UriService ,
82
85
protected _log : LoggerService ,
@@ -100,6 +103,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
100
103
this . customItemsInitialized = false ;
101
104
this . hiddenCustomItemsInitialized = false ;
102
105
this . itemClicked = new EventEmitter < MenuItemClickEvent > ( ) ;
106
+ this . itemLoaded = new EventEmitter < MenuItemLoadedEvent > ( ) ;
103
107
104
108
this . _currentNodeSubscription = this . _uriService . activeNode$ . subscribe ( node => {
105
109
this . currentNode = node ;
@@ -112,6 +116,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
112
116
this . _rightLoading$ . complete ( ) ;
113
117
this . _nodeLoading$ . complete ( ) ;
114
118
this . itemClicked . complete ( ) ;
119
+ this . itemLoaded . complete ( ) ;
115
120
}
116
121
117
122
public get canGoBackLoading$ ( ) : Observable < boolean > {
@@ -157,6 +162,10 @@ export class DoubleDrawerNavigationService implements OnDestroy {
157
162
return this . itemClicked ;
158
163
}
159
164
165
+ public get itemLoaded$ ( ) : EventEmitter < MenuItemLoadedEvent > {
166
+ return this . itemLoaded ;
167
+ }
168
+
160
169
public get rightItems$ ( ) : BehaviorSubject < Array < NavigationItem > > {
161
170
return this . _rightItems$ ;
162
171
}
@@ -380,7 +389,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
380
389
this . _leftItems$ . next ( result . sort ( ( a , b ) => orderedChildCaseIds . indexOf ( a . resource . stringId ) - orderedChildCaseIds . indexOf ( b . resource . stringId ) ) ) ;
381
390
this . resolveCustomViewsInLeftSide ( ) ;
382
391
this . _leftLoading$ . off ( ) ;
383
- // this.itemLoaded.emit({menu: 'left', items: this.leftItems});
392
+ this . itemLoaded . emit ( { menu : 'left' , items : this . leftItems } ) ;
384
393
} , error => {
385
394
this . _log . error ( error ) ;
386
395
this . _leftItems$ . next ( [ ] )
@@ -423,9 +432,8 @@ export class DoubleDrawerNavigationService implements OnDestroy {
423
432
this . _rightItems$ . next ( result . map ( folder => this . resolveItemCaseToNavigationItem ( folder ) ) . filter ( i => ! ! i ) ) ;
424
433
}
425
434
this . resolveCustomViewsInRightSide ( ) ;
426
- // this.isRightSideInitialized = true;
427
435
this . _rightLoading$ . off ( ) ;
428
- // this.itemLoaded.emit({menu: 'right', items: this.rightItems});
436
+ this . itemLoaded . emit ( { menu : 'right' , items : this . rightItems } ) ;
429
437
} , error => {
430
438
this . _log . error ( error ) ;
431
439
this . _rightItems$ . next ( [ ] ) ;
0 commit comments