mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[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:
@@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user