[ACA-3257] Add actions extension capability to info drawer (#1471)

* info drawer action added

* actions added

* * improved docs

* * added unit test

* fixed e2e

* * rename actions to toolbar

* * minor changes

* Update application-features.md

Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
dhrn
2020-05-19 22:16:11 +05:30
committed by GitHub
parent 234b41b917
commit 3b4579c19c
16 changed files with 336 additions and 236 deletions

View File

@@ -36,14 +36,17 @@ import {
MinimalNodeEntryEntity,
SiteEntry
} from '@alfresco/js-api';
import { SidebarTabRef } from '@alfresco/adf-extensions';
import { ContentActionRef, SidebarTabRef } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store';
import {
getAppSelection,
SetInfoDrawerStateAction,
ToggleInfoDrawerAction
} from '@alfresco/aca-shared/store';
import { AppExtensionService } from '../../services/app.extension.service';
import { ContentApiService } from '../../services/content-api.service';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'aca-info-drawer',
@@ -58,6 +61,8 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
isLoading = false;
displayNode: MinimalNodeEntryEntity | SiteEntry;
tabs: Array<SidebarTabRef> = [];
actions: Array<ContentActionRef> = [];
onDestroy$ = new Subject<boolean>();
@HostListener('keydown.escape')
onEscapeKeyboardEvent(): void {
@@ -72,9 +77,17 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
ngOnInit() {
this.tabs = this.extensions.getSidebarTabs();
this.store
.select(getAppSelection)
.pipe(takeUntil(this.onDestroy$))
.subscribe(() => {
this.actions = this.extensions.getAllowedSidebarActions();
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
this.store.dispatch(new SetInfoDrawerStateAction(false));
}
@@ -91,6 +104,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
}
}
trackByActionId(_: number, action: ContentActionRef) {
return action.id;
}
private close() {
this.store.dispatch(new ToggleInfoDrawerAction());
}