[AAE-5874] Re-evaluate extension rules when context changes (#2296)

* [AAE-5874] Re-evaluate extension rules when context changes

* [AAE-5874] Add disabled attribute to toolbar actions

* [AAE-5874] Fix unit tests
This commit is contained in:
Pablo Martinez Garcia
2021-09-16 15:48:43 +02:00
committed by Denys Vuika
parent 46a179c75a
commit c4e4b50f8a
17 changed files with 408 additions and 238 deletions

View File

@@ -23,12 +23,13 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, ViewEncapsulation, Output, EventEmitter, OnInit, Input } from '@angular/core';
import { Component, ViewEncapsulation, Output, EventEmitter, OnInit, Input, OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { Observable, Subject } from 'rxjs';
import { ContentActionRef } from '@alfresco/adf-extensions';
import { AppStore, getHeaderColor, getAppName, getLogoPath, getHeaderImagePath } from '@alfresco/aca-shared/store';
import { AppExtensionService } from '@alfresco/aca-shared';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-header',
@@ -37,7 +38,8 @@ import { AppExtensionService } from '@alfresco/aca-shared';
encapsulation: ViewEncapsulation.None,
host: { class: 'app-header' }
})
export class AppHeaderComponent implements OnInit {
export class AppHeaderComponent implements OnInit, OnDestroy {
private onDestroy$: Subject<boolean> = new Subject<boolean>();
@Output()
toggleClicked = new EventEmitter();
@@ -60,7 +62,17 @@ export class AppHeaderComponent implements OnInit {
}
ngOnInit() {
this.actions = this.appExtensions.getHeaderActions();
this.appExtensions
.getHeaderActions()
.pipe(takeUntil(this.onDestroy$))
.subscribe((actions) => {
this.actions = actions;
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
trackByActionId(_: number, action: ContentActionRef) {