mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1631] more application ngrx actions (#540)
* delete action * library path evaluator * extension for sharing files * upload actions * delete library * use extensions for experimental library actions * unshare nodes * fix icons and titles * "create menu" backed by core extension * support for descriptions, update upload selector * update code and tests * support disabled tooltips for navbar * fix selector * [ACA-1486] remove double fetch call * migrate to trashcan actions, element IDs * cleanup code, remove deprecated directives * add/remove favorite * improve rendering performance * update favorites without reload * support for adding Sites to favorites * disable favorites for Libraries for now * copy action * move node * manage versions and permissions * cleanup code * toggle info drawer * card view mode * use extension layer for favorites toolbar * fix menu tooltips * fix 'remove as favorite' tests * update tests * test fixes * fix edit folder for favorites * fix test * cleanup favorites layout * upgrade recent files layout * update evaluators for shared nodes * test fixes * test fixes * restore recent files layout * workaround for "favorite" toggle and recent files * upgrade shared files page * upgrade files page layout * fix library evaluator * workaround for shared files and permissions * cleanup code * upgrade search results * upgrade sidebar and viewer actions * code cleanup * code cleanup * code cleanup
This commit is contained in:
@@ -36,6 +36,7 @@ import { RouteRef } from './routing.extensions';
|
||||
import { RuleContext, RuleRef, RuleEvaluator } from './rule.extensions';
|
||||
import { ActionRef, ContentActionRef, ContentActionType } from './action.extensions';
|
||||
import * as core from './evaluators/core.evaluators';
|
||||
import { NodePermissionService } from '../services/node-permission.service';
|
||||
|
||||
@Injectable()
|
||||
export class ExtensionService implements RuleContext {
|
||||
@@ -52,6 +53,7 @@ export class ExtensionService implements RuleContext {
|
||||
actions: Array<ActionRef> = [];
|
||||
|
||||
contentActions: Array<ContentActionRef> = [];
|
||||
viewerActions: Array<ContentActionRef> = [];
|
||||
openWithActions: Array<ContentActionRef> = [];
|
||||
createActions: Array<ContentActionRef> = [];
|
||||
navbar: Array<NavBarGroupRef> = [];
|
||||
@@ -63,7 +65,10 @@ export class ExtensionService implements RuleContext {
|
||||
selection: SelectionState;
|
||||
navigation: NavigationState;
|
||||
|
||||
constructor(private http: HttpClient, private store: Store<AppStore>) {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private store: Store<AppStore>,
|
||||
public permissions: NodePermissionService) {
|
||||
|
||||
this.evaluators = {
|
||||
'core.every': core.every,
|
||||
@@ -118,6 +123,7 @@ export class ExtensionService implements RuleContext {
|
||||
this.actions = this.loadActions(config);
|
||||
this.routes = this.loadRoutes(config);
|
||||
this.contentActions = this.loadContentActions(config);
|
||||
this.viewerActions = this.loadViewerActions(config);
|
||||
this.openWithActions = this.loadViewerOpenWith(config);
|
||||
this.createActions = this.loadCreateActions(config);
|
||||
this.navbar = this.loadNavBar(config);
|
||||
@@ -158,6 +164,15 @@ export class ExtensionService implements RuleContext {
|
||||
return [];
|
||||
}
|
||||
|
||||
protected loadViewerActions(config: ExtensionConfig) {
|
||||
if (config && config.features && config.features.viewer) {
|
||||
return (config.features.viewer.actions || []).sort(
|
||||
this.sortByOrder
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
protected loadNavBar(config: ExtensionConfig): any {
|
||||
if (config && config.features) {
|
||||
return (config.features.navbar || [])
|
||||
@@ -296,7 +311,6 @@ export class ExtensionService implements RuleContext {
|
||||
return this.contentActions
|
||||
.filter(this.filterEnabled)
|
||||
.filter(action => this.filterByRules(action))
|
||||
.reduce(this.reduceSeparators, [])
|
||||
.map(action => {
|
||||
if (action.type === ContentActionType.menu) {
|
||||
const copy = this.copyAction(action);
|
||||
@@ -311,7 +325,14 @@ export class ExtensionService implements RuleContext {
|
||||
}
|
||||
return action;
|
||||
})
|
||||
.reduce(this.reduceEmptyMenus, []);
|
||||
.reduce(this.reduceEmptyMenus, [])
|
||||
.reduce(this.reduceSeparators, []);
|
||||
}
|
||||
|
||||
getViewerActions(): Array<ContentActionRef> {
|
||||
return this.viewerActions
|
||||
.filter(this.filterEnabled)
|
||||
.filter(action => this.filterByRules(action));
|
||||
}
|
||||
|
||||
reduceSeparators(
|
||||
@@ -320,6 +341,12 @@ export class ExtensionService implements RuleContext {
|
||||
i: number,
|
||||
arr: ContentActionRef[]
|
||||
): ContentActionRef[] {
|
||||
// remove leading separator
|
||||
if (i === 0) {
|
||||
if (arr[i].type === ContentActionType.separator) {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
// remove duplicate separators
|
||||
if (i > 0) {
|
||||
const prev = arr[i - 1];
|
||||
|
Reference in New Issue
Block a user