[AAE-6309] New process start button (#2353)

* [AEE-6309] New start process button

* [AEE-6309] Added documentation

* [AEE-6309] Change main action to object

* [AEE-6309] Clean code

* [AEE-6309] Linting fix

* [AEE-6309] Fix trashcan translation

* [AEE-6309] Fix tests
This commit is contained in:
Bartosz Sekuła
2021-11-22 08:23:10 +01:00
committed by GitHub
parent e9d5ab753a
commit 60446dc36e
17 changed files with 380 additions and 13 deletions

View File

@@ -56,7 +56,7 @@ import { RepositoryInfo, NodeEntry } from '@alfresco/js-api';
import { ViewerRules } from '../models/viewer.rules';
import { SettingsGroupRef } from '../models/types';
import { NodePermissionService } from '../services/node-permission.service';
import { map } from 'rxjs/operators';
import { filter, map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
@@ -78,6 +78,7 @@ export class AppExtensionService implements RuleContext {
private _contextMenuActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _openWithActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _createActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _mainActions = new BehaviorSubject<ContentActionRef>(null);
private _sidebarActions = new BehaviorSubject<Array<ContentActionRef>>([]);
documentListPresets: {
@@ -156,6 +157,7 @@ export class AppExtensionService implements RuleContext {
this._contextMenuActions.next(this.loader.getContentActions(config, 'features.contextMenu'));
this._openWithActions.next(this.loader.getContentActions(config, 'features.viewer.openWith'));
this._createActions.next(this.loader.getElements<ContentActionRef>(config, 'features.create'));
this._mainActions.next(this.loader.getFeatures(config).mainAction);
this.navbar = this.loadNavBar(config);
this.sidebarTabs = this.loader.getElements<SidebarTabRef>(config, 'features.sidebar.tabs');
@@ -364,6 +366,17 @@ export class AppExtensionService implements RuleContext {
);
}
getMainAction(): Observable<ContentActionRef> {
return this._mainActions.pipe(
filter((mainAction) => mainAction && this.filterVisible(mainAction)),
map((mainAction) => {
let actionCopy = this.copyAction(mainAction);
actionCopy = this.setActionDisabledFromRule(actionCopy);
return actionCopy;
})
);
}
private buildMenu(actionRef: ContentActionRef): ContentActionRef {
if (actionRef.type === ContentActionType.menu && actionRef.children && actionRef.children.length > 0) {
const children = actionRef.children.filter((action) => this.filterVisible(action)).map((action) => this.buildMenu(action));