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

[51170] Gantt: shorten menu and add "Show relations" action (#14287)

Behrokh Satarnejad03f30f37f8f7
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index ad27e8e0dd8..13a46646dd7 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -899,6 +899,7 @@ en:
toggle_description: "Toggle relation description"
update_relation: "Click to change the relation type"
add_follower: "Add follower"
+ show_relations: "Show relations"
add_predecessor: "Add predecessor"
remove: "Remove relation"
save: "Save relation"
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 8185c06803e..7c5bfd72dd1 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
@@ -88,6 +88,14 @@ export class WorkPackageContextMenuHelperService {
allowedActions = allowedActions.concat(this.getAllowedParentActions(workPackage));
+ // remove some actions on Gantt
+ if (this.wpViewTimeline.isVisible) {
+ allowedActions = allowedActions.filter((el) => {
+ const ganttNotAllowedActions = ['log_time', 'copy', 'copy_to_other_project', 'export-pdf', 'export-atom', 'log_costs'];
+ return !(ganttNotAllowedActions.includes(el.key));
+ });
+ }
+
allowedActions = allowedActions.concat(this.getAllowedRelationActions(workPackage, allowSplitScreenActions));
_.each(allowedActions, (allowedAction) => {
@@ -214,6 +222,14 @@ export class WorkPackageContextMenuHelperService {
});
}
+ if (this.wpViewTimeline.isVisible) {
+ allowedActions.push({
+ key: 'relations',
+ text: I18n.t('js.relation_buttons.show_relations'),
+ link: 'relations',
+ });
+ }
+
if (!!workPackage.addChild && allowSplitScreenActions) {
allowedActions.push({
key: 'relation-new-child',
diff --git a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts
index ffa2dec3f56..acddb141de8 100644
--- a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts
+++ b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts
@@ -112,6 +112,12 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
case 'log_time':
this.logTimeForSelectedWorkPackage();
break;
+ case 'relations':
+ void this.$state.go(
+ `${splitViewRoute(this.$state)}.tabs`,
+ { workPackageId: this.workPackageId, tabIdentifier: 'relations' },
+ );
+ break;
default:
window.location.href = link!;
diff --git a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
index a6c7f29a4d1..3503e002523 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
@@ -60,7 +60,7 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
wp_timeline.expect_timeline!(open: false)
open_context_menu.call
- menu.expect_no_options 'Add predecessor', 'Add follower'
+ menu.expect_no_options 'Add predecessor', 'Add follower, Show relations'
# Copy to other project
open_context_menu.call
diff --git a/spec/features/work_packages/table/context_menu/context_menu_spec.rb b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
index 472213a20b7..a885a65034b 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_spec.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
@@ -39,7 +39,11 @@ RSpec.describe 'Work package table context menu', :js, :with_cuprite do
# Open context menu
menu.expect_closed
menu.open_for(work_package)
- menu.expect_options ['Add predecessor', 'Add follower']
+ menu.expect_options ['Add predecessor', 'Add follower', 'Show relations']
+
+ # Show relations tab when selecting show-relations from menu
+ menu.choose('Show relations')
+ expect(page).to have_current_path /details\/#{work_package.id}\/relations/
end
context 'for multiple selected WPs' do