mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
extension enhancements (#552)
* default action types * move context-menu to the correct folder
This commit is contained in:
committed by
Cilibiu Bogdan
parent
22eac50d27
commit
8f3030760a
@@ -125,7 +125,7 @@ export class ExtensionService implements RuleContext {
|
||||
this.routes = this.loadRoutes(config);
|
||||
this.contentActions = this.loadContentActions(config);
|
||||
this.viewerActions = this.loadViewerActions(config);
|
||||
this.contentContextmenuActions = this.loadContentContextmenuActions(config);
|
||||
this.contentContextmenuActions = this.loadContentContextMenuActions(config);
|
||||
this.openWithActions = this.loadViewerOpenWith(config);
|
||||
this.createActions = this.loadCreateActions(config);
|
||||
this.navbar = this.loadNavBar(config);
|
||||
@@ -159,26 +159,27 @@ export class ExtensionService implements RuleContext {
|
||||
|
||||
protected loadContentActions(config: ExtensionConfig) {
|
||||
if (config && config.features && config.features.content) {
|
||||
return (config.features.content.actions || []).sort(
|
||||
this.sortByOrder
|
||||
);
|
||||
return (config.features.content.actions || [])
|
||||
.sort(this.sortByOrder)
|
||||
.map(this.setActionDefaults);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
protected loadViewerActions(config: ExtensionConfig) {
|
||||
if (config && config.features && config.features.viewer) {
|
||||
return (config.features.viewer.actions || []).sort(
|
||||
this.sortByOrder
|
||||
);
|
||||
return (config.features.viewer.actions || [])
|
||||
.sort(this.sortByOrder)
|
||||
.map(this.setActionDefaults);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
protected loadContentContextmenuActions(config: ExtensionConfig): Array<ContentActionRef> {
|
||||
protected loadContentContextMenuActions(config: ExtensionConfig): Array<ContentActionRef> {
|
||||
if (config && config.features && config.features.content) {
|
||||
return (config.features.content.contextActions || [])
|
||||
.sort(this.sortByOrder);
|
||||
.sort(this.sortByOrder)
|
||||
.map(this.setActionDefaults);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
@@ -351,6 +352,14 @@ export class ExtensionService implements RuleContext {
|
||||
.filter(action => this.filterByRules(action));
|
||||
}
|
||||
|
||||
setActionDefaults(action: ContentActionRef): ContentActionRef {
|
||||
if (action) {
|
||||
action.type = action.type || ContentActionType.default;
|
||||
action.icon = action.icon || 'extension';
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
||||
reduceSeparators(
|
||||
acc: ContentActionRef[],
|
||||
el: ContentActionRef,
|
||||
|
Reference in New Issue
Block a user