From b91130fd85b9dcadb167bac4218c4089b2aff4aa Mon Sep 17 00:00:00 2001 From: Jack Chapman <jachapman@gitlab.com> Date: Thu, 24 Oct 2024 14:48:43 +0100 Subject: [PATCH] Allow router navigation for children If the child item link is displayed in the drawer use Vue Router to navigate to it --- .../work_items/components/work_item_detail.vue | 1 + .../components/work_item_links/work_item_tree.vue | 11 +++++++++-- app/assets/javascripts/work_items/constants.js | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/work_items/components/work_item_detail.vue b/app/assets/javascripts/work_items/components/work_item_detail.vue index 1592cb02a2d96..037c95a42549a 100644 --- a/app/assets/javascripts/work_items/components/work_item_detail.vue +++ b/app/assets/javascripts/work_items/components/work_item_detail.vue @@ -864,6 +864,7 @@ export default { :can-update-children="canUpdateChildren" :confidential="workItem.confidential" :allowed-child-types="allowedChildTypes" + :is-drawer="isDrawer" @show-modal="openInModal" @addChild="$emit('addChild')" @childrenLoaded="hasChildren = $event" diff --git a/app/assets/javascripts/work_items/components/work_item_links/work_item_tree.vue b/app/assets/javascripts/work_items/components/work_item_links/work_item_tree.vue index 3a08895259da4..c7edd4a9a5534 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/work_item_tree.vue +++ b/app/assets/javascripts/work_items/components/work_item_links/work_item_tree.vue @@ -49,8 +49,10 @@ export default { WorkItemRolledUpData, }, inject: ['hasSubepicsFeature'], - provide: { - [INJECTION_LINK_CHILD_PREVENT_ROUTER_NAVIGATION]: true, + provide() { + return { + [INJECTION_LINK_CHILD_PREVENT_ROUTER_NAVIGATION]: !this.isDrawer, + }; }, props: { fullPath: { @@ -100,6 +102,11 @@ export default { required: false, default: () => [], }, + isDrawer: { + type: Boolean, + required: false, + default: false, + }, }, data() { return { diff --git a/app/assets/javascripts/work_items/constants.js b/app/assets/javascripts/work_items/constants.js index d337fb10a5eff..5f59a6b42ef87 100644 --- a/app/assets/javascripts/work_items/constants.js +++ b/app/assets/javascripts/work_items/constants.js @@ -373,4 +373,6 @@ export const WORKITEM_LINKS_SHOWLABELS_LOCALSTORAGEKEY = 'workItemLinks.showLabe export const WORKITEM_TREE_SHOWLABELS_LOCALSTORAGEKEY = 'workItemTree.showLabels'; export const WORKITEM_RELATIONSHIPS_SHOWLABELS_LOCALSTORAGEKEY = 'workItemRelationships.showLabels'; -export const INJECTION_LINK_CHILD_PREVENT_ROUTER_NAVIGATION = 'injection:prevent-router-navigation'; +export const INJECTION_LINK_CHILD_PREVENT_ROUTER_NAVIGATION = Symbol( + 'injection:prevent-router-navigation', +); -- GitLab