import { AppExtensionService } from '@alfresco/aca-shared' ; import { ContentActionRef , ContentActionType } from '@alfresco/adf-extensions' ; import { Component , Input , OnDestroy , OnInit } from '@angular/core' ; import { Observable , Subject } from 'rxjs' ; import { takeUntil } from 'rxjs/operators' ; @ Component ( { selector : 'app-main-action' , templateUrl : './main-action.component.html' , styleUrls : [ './main-action.component.scss' ] } ) export class MainActionComponent implements OnInit , OnDestroy { @ Input ( ) expanded : boolean ; mainAction$ : Observable < ContentActionRef > ; actionTypes = ContentActionType ; private onDestroy$ = new Subject < boolean > ( ) ; constructor ( private extensions ) { } ngOnDestroy ( ) { this . onDestroy$ . next ( true ) ; } ngOnInit ( ) { this . mainAction$ = this . extensions . getMainAction ( ) . pipe ( takeUntil ( this . onDestroy$ ) ) ; } runAction ( action ) { this . extensions . runActionById ( action ) ; } }