Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Allow plugins to link into the WP bulk context menu

Philipp Tessenow2881c14321f3
diff --git a/frontend/src/app/features/plugins/plugin-context.ts b/frontend/src/app/features/plugins/plugin-context.ts
index 2ef51db0886..81286f11766 100644
--- a/frontend/src/app/features/plugins/plugin-context.ts
+++ b/frontend/src/app/features/plugins/plugin-context.ts
@@ -32,6 +32,7 @@ import { DomAutoscrollService } from 'core-app/shared/helpers/drag-and-drop/dom-
*/
export class OpenProjectPluginContext {
private _knownHookNames = [
+ 'workPackageBulkContextMenu',
'workPackageTableContextMenu',
'workPackageSingleContextMenu',
'workPackageNewInitialization',
diff --git a/frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts b/frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts
index 7c3a323c1a9..ae052d1be7a 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts
@@ -103,13 +103,14 @@ export class WorkPackageContextMenuHelperService {
public getIntersectOfPermittedActions(workPackages:any) {
const bulkPermittedActions:any = [];
-
- const permittedActions = _.filter(this.BULK_ACTIONS, (action:any) => _.every(workPackages, (workPackage:WorkPackageResource) => this.isActionAllowed(workPackage, action)));
+ const possibleActions = this.BULK_ACTIONS.concat(this.HookService.call('workPackageBulkContextMenu'));
+ const permittedActions = _.filter(possibleActions, (action:any) => _.every(workPackages, (workPackage:WorkPackageResource) => this.isActionAllowed(workPackage, action)));
_.each(permittedActions, (permittedAction:any) => {
bulkPermittedActions.push({
key: permittedAction.key,
text: permittedAction.text,
+ icon: permittedAction.icon,
link: this.getBulkActionLink(permittedAction, workPackages),
});
});