diff --git a/app/assets/javascripts/work_items/components/work_item_assignees.vue b/app/assets/javascripts/work_items/components/work_item_assignees.vue index 7342f215b5e69b7e591204ece8165c8e7365c7f9..9e5403bb416811831c50e57261e6e9aab83d83ad 100644 --- a/app/assets/javascripts/work_items/components/work_item_assignees.vue +++ b/app/assets/javascripts/work_items/components/work_item_assignees.vue @@ -52,7 +52,6 @@ export default { GlDropdownDivider, }, mixins: [Tracking.mixin()], - inject: ['fullPath'], props: { workItemId: { type: String, @@ -80,6 +79,10 @@ export default { required: false, default: false, }, + fullPath: { + type: String, + required: true, + }, }, data() { return { diff --git a/app/assets/javascripts/work_items/components/work_item_description.vue b/app/assets/javascripts/work_items/components/work_item_description.vue index cf59789ce2df792d701be812477fe57ccd0cc05a..c18ea3ddb00c1568b8f79c606aa231005793e0d0 100644 --- a/app/assets/javascripts/work_items/components/work_item_description.vue +++ b/app/assets/javascripts/work_items/components/work_item_description.vue @@ -21,12 +21,15 @@ export default { MarkdownField, }, mixins: [Tracking.mixin()], - inject: ['fullPath'], props: { workItemId: { type: String, required: true, }, + fullPath: { + type: String, + required: true, + }, }, markdownDocsPath: helpPagePath('user/markdown'), data() { 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 a5580c14a7ac31128d882f327a1e759a41c8a027..5cc93f0a767767098f188b308fde0ce667188496 100644 --- a/app/assets/javascripts/work_items/components/work_item_detail.vue +++ b/app/assets/javascripts/work_items/components/work_item_detail.vue @@ -121,6 +121,9 @@ export default { canDelete() { return this.workItem?.userPermissions?.deleteWorkItem; }, + fullPath() { + return this.workItem?.project.fullPath; + }, workItemsMvc2Enabled() { return this.glFeatures.workItemsMvc2; }, @@ -326,12 +329,14 @@ export default { :allows-multiple-assignees="workItemAssignees.allowsMultipleAssignees" :work-item-type="workItemType" :can-invite-members="workItemAssignees.canInviteMembers" + :full-path="fullPath" @error="error = $event" /> <work-item-labels v-if="workItemLabels" :work-item-id="workItem.id" :can-update="canUpdate" + :full-path="fullPath" @error="error = $event" /> </template> @@ -347,6 +352,7 @@ export default { <work-item-description v-if="hasDescriptionWidget" :work-item-id="workItem.id" + :full-path="fullPath" class="gl-pt-5" @error="error = $event" /> diff --git a/app/assets/javascripts/work_items/components/work_item_labels.vue b/app/assets/javascripts/work_items/components/work_item_labels.vue index e73488bbd701ecf42db2028759805d43676b4ff6..e608e4ad57e09fc2293bf8f4774a6379d405de7d 100644 --- a/app/assets/javascripts/work_items/components/work_item_labels.vue +++ b/app/assets/javascripts/work_items/components/work_item_labels.vue @@ -31,7 +31,6 @@ export default { LabelItem, }, mixins: [Tracking.mixin()], - inject: ['fullPath'], props: { workItemId: { type: String, @@ -41,6 +40,10 @@ export default { type: Boolean, required: true, }, + fullPath: { + type: String, + required: true, + }, }, data() { return { diff --git a/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql b/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql index 4cc23fa00718c9aa12280bce5edcc231b9697250..1228c876a556c2f29263bf1c6a13847e80385d79 100644 --- a/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql @@ -1,4 +1,4 @@ -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" mutation createWorkItem($input: WorkItemCreateInput!) { workItemCreate(input: $input) { diff --git a/app/assets/javascripts/work_items/graphql/create_work_item_from_task.mutation.graphql b/app/assets/javascripts/work_items/graphql/create_work_item_from_task.mutation.graphql index 1f98cd4fa2b8d19f445cfab1f6985f6c51a3dc6f..ccfe62cc58562468779159b22bd5814a25c4d0b6 100644 --- a/app/assets/javascripts/work_items/graphql/create_work_item_from_task.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/create_work_item_from_task.mutation.graphql @@ -1,4 +1,4 @@ -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" mutation workItemCreateFromTask($input: WorkItemCreateFromTaskInput!) { workItemCreateFromTask(input: $input) { diff --git a/app/assets/javascripts/work_items/graphql/local_update_work_item.mutation.graphql b/app/assets/javascripts/work_items/graphql/local_update_work_item.mutation.graphql index 790b8e60b6a7dacabe8418fa478c5b7c9f5ad500..43c92cf89eccdd2a205759962a3bea7ad659cba8 100644 --- a/app/assets/javascripts/work_items/graphql/local_update_work_item.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/local_update_work_item.mutation.graphql @@ -1,4 +1,4 @@ -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" mutation localUpdateWorkItem($input: LocalUpdateWorkItemInput) { localUpdateWorkItem(input: $input) @client { diff --git a/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql b/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql index 0a887fcfc00a0ab0c2fc08fea685c26968f69259..25eb8099251e8dd5ec2cef5023109f16fdb4b8a4 100644 --- a/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql @@ -1,4 +1,4 @@ -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" mutation workItemUpdate($input: WorkItemUpdateInput!) { workItemUpdate(input: $input) { diff --git a/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql b/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql index fad5a9fa5bc9f3eb0200bf16773eee1ced650d56..ad861a60d1509dda0dc1d42559f9b6eaf9715be2 100644 --- a/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql @@ -1,4 +1,4 @@ -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" mutation workItemUpdateTask($input: WorkItemUpdateTaskInput!) { workItemUpdate: workItemUpdateTask(input: $input) { diff --git a/app/assets/javascripts/work_items/graphql/update_work_item_widgets.mutation.graphql b/app/assets/javascripts/work_items/graphql/update_work_item_widgets.mutation.graphql index 6a94c96b34740395cf640b0c06b26da24ff9429c..148b340b439d85b67b49eb2fb9f1b57252ebfcc4 100644 --- a/app/assets/javascripts/work_items/graphql/update_work_item_widgets.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/update_work_item_widgets.mutation.graphql @@ -1,4 +1,4 @@ -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" mutation workItemUpdateWidgets($input: WorkItemUpdateWidgetsInput!) { workItemUpdateWidgets(input: $input) { diff --git a/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql b/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql index e8ef27ec7789617a805a6118088d42c5a380fce3..e77f577c897bb1eee33a245fa040d7c0326a494b 100644 --- a/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql @@ -1,4 +1,5 @@ #import "~/graphql_shared/fragments/user.fragment.graphql" +#import "ee_else_ce/work_items/graphql/work_item_widgets.fragment.graphql" fragment WorkItem on WorkItem { id @@ -6,6 +7,10 @@ fragment WorkItem on WorkItem { state description confidential + project { + id + fullPath + } workItemType { id name @@ -16,34 +21,6 @@ fragment WorkItem on WorkItem { updateWorkItem } widgets { - ... on WorkItemWidgetDescription { - type - description - descriptionHtml - } - ... on WorkItemWidgetAssignees { - type - allowsMultipleAssignees - canInviteMembers - assignees { - nodes { - ...User - } - } - } - ... on WorkItemWidgetHierarchy { - type - parent { - id - iid - title - confidential - } - children { - nodes { - id - } - } - } + ...WorkItemWidgets } } diff --git a/app/assets/javascripts/work_items/graphql/work_item.query.graphql b/app/assets/javascripts/work_items/graphql/work_item.query.graphql index a9f7b7145516a90644b3deda7e9edc927a097a08..276061af1932ec40884717005e7a6296a01ee4ce 100644 --- a/app/assets/javascripts/work_items/graphql/work_item.query.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item.query.graphql @@ -1,5 +1,5 @@ #import "~/graphql_shared/fragments/label.fragment.graphql" -#import "ee_else_ce/work_items/graphql/work_item.fragment.graphql" +#import "./work_item.fragment.graphql" query workItem($id: WorkItemID!) { workItem(id: $id) { diff --git a/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql b/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql index df62ca1c143158f9b1377e6c61fd231a7f1e848a..2ca4450f89258fef3567af1edfe227ebeee1399f 100644 --- a/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql @@ -1,4 +1,4 @@ -query workItemQuery($id: WorkItemID!) { +query workItemLinksQuery($id: WorkItemID!) { workItem(id: $id) { id workItemType { diff --git a/app/assets/javascripts/work_items/graphql/work_item_widgets.fragment.graphql b/app/assets/javascripts/work_items/graphql/work_item_widgets.fragment.graphql new file mode 100644 index 0000000000000000000000000000000000000000..510788217ca9178cc7b84ca9bb87e5bc2f780ec2 --- /dev/null +++ b/app/assets/javascripts/work_items/graphql/work_item_widgets.fragment.graphql @@ -0,0 +1,31 @@ +fragment WorkItemWidgets on WorkItemWidget { + ... on WorkItemWidgetDescription { + type + description + descriptionHtml + } + ... on WorkItemWidgetAssignees { + type + allowsMultipleAssignees + canInviteMembers + assignees { + nodes { + ...User + } + } + } + ... on WorkItemWidgetHierarchy { + type + parent { + id + iid + title + confidential + } + children { + nodes { + id + } + } + } +} diff --git a/ee/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql b/ee/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql deleted file mode 100644 index 86bd7c8cdf982e717afaeec6187d4292bbaabcee..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql +++ /dev/null @@ -1,53 +0,0 @@ -#import "~/graphql_shared/fragments/user.fragment.graphql" - -fragment WorkItem on WorkItem { - id - title - state - description - confidential - workItemType { - id - name - iconName - } - userPermissions { - deleteWorkItem - updateWorkItem - } - widgets { - ... on WorkItemWidgetDescription { - type - description - descriptionHtml - } - ... on WorkItemWidgetAssignees { - type - allowsMultipleAssignees - canInviteMembers - assignees { - nodes { - ...User - } - } - } - ... on WorkItemWidgetWeight { - type - weight - } - ... on WorkItemWidgetHierarchy { - type - parent { - id - iid - title - confidential - } - children { - nodes { - id - } - } - } - } -} diff --git a/ee/app/assets/javascripts/work_items/graphql/work_item_widgets.fragment.graphql b/ee/app/assets/javascripts/work_items/graphql/work_item_widgets.fragment.graphql new file mode 100644 index 0000000000000000000000000000000000000000..28b2d14c01066c49b882f53687f2ebf669916918 --- /dev/null +++ b/ee/app/assets/javascripts/work_items/graphql/work_item_widgets.fragment.graphql @@ -0,0 +1,37 @@ +#import "~/graphql_shared/fragments/user.fragment.graphql" + +fragment WorkItemWidgets on WorkItemWidget { + ... on WorkItemWidgetDescription { + type + description + descriptionHtml + } + ... on WorkItemWidgetAssignees { + type + allowsMultipleAssignees + canInviteMembers + assignees { + nodes { + ...User + } + } + } + ... on WorkItemWidgetWeight { + type + weight + } + ... on WorkItemWidgetHierarchy { + type + parent { + id + iid + title + confidential + } + children { + nodes { + id + } + } + } +} diff --git a/spec/frontend/work_items/components/work_item_assignees_spec.js b/spec/frontend/work_items/components/work_item_assignees_spec.js index b00a9efa9329dc529a1fa62b2fd5d52012485a09..897992df1e10e2bfaacfcafb9c9bc42ec50efcd7 100644 --- a/spec/frontend/work_items/components/work_item_assignees_spec.js +++ b/spec/frontend/work_items/components/work_item_assignees_spec.js @@ -82,9 +82,6 @@ describe('WorkItemAssignees component', () => { }); wrapper = mountExtended(WorkItemAssignees, { - provide: { - fullPath: 'test-project-path', - }, propsData: { assignees, workItemId, @@ -92,6 +89,7 @@ describe('WorkItemAssignees component', () => { workItemType: TASK_TYPE_NAME, canUpdate, canInviteMembers, + fullPath: 'test-project-path', }, attachTo: document.body, apolloProvider, diff --git a/spec/frontend/work_items/components/work_item_description_spec.js b/spec/frontend/work_items/components/work_item_description_spec.js index 8017c46dea88f5d7bc3b46091689812ab35f92c9..6ec786507c0337c79ce0cafbe2bbadd7ceb3f824 100644 --- a/spec/frontend/work_items/components/work_item_description_spec.js +++ b/spec/frontend/work_items/components/work_item_description_spec.js @@ -57,9 +57,7 @@ describe('WorkItemDescription', () => { ]), propsData: { workItemId: id, - }, - provide: { - fullPath: '/group/project', + fullPath: 'test-project-path', }, stubs: { MarkdownField, diff --git a/spec/frontend/work_items/components/work_item_labels_spec.js b/spec/frontend/work_items/components/work_item_labels_spec.js index c206afc905ad6ef6f36eeb9d4eb530da0a5d058c..1d976897c1598d17f949415deca3df8bafe3d7ed 100644 --- a/spec/frontend/work_items/components/work_item_labels_spec.js +++ b/spec/frontend/work_items/components/work_item_labels_spec.js @@ -45,13 +45,11 @@ describe('WorkItemLabels component', () => { }); wrapper = mountExtended(WorkItemLabels, { - provide: { - fullPath: 'test-project-path', - }, propsData: { labels, workItemId, canUpdate, + fullPath: 'test-project-path', }, attachTo: document.body, apolloProvider, diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js index d24ac2a9f93edcd0b32a77702f88ebb9ad9b0f8b..8deca5c50b7d833ac28ba63a52934501587d84ad 100644 --- a/spec/frontend/work_items/mock_data.js +++ b/spec/frontend/work_items/mock_data.js @@ -28,6 +28,11 @@ export const workItemQueryResponse = { confidential: false, createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, workItemType: { __typename: 'WorkItemType', id: 'gid://gitlab/WorkItems::Type/5', @@ -93,6 +98,11 @@ export const updateWorkItemMutationResponse = { confidential: false, createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, workItemType: { __typename: 'WorkItemType', id: 'gid://gitlab/WorkItems::Type/5', @@ -157,6 +167,11 @@ export const workItemResponseFactory = ({ confidential, createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, workItemType: { __typename: 'WorkItemType', id: 'gid://gitlab/WorkItems::Type/5', @@ -251,6 +266,11 @@ export const createWorkItemMutationResponse = { confidential: false, createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, workItemType: { __typename: 'WorkItemType', id: 'gid://gitlab/WorkItems::Type/5', @@ -282,6 +302,11 @@ export const createWorkItemFromTaskMutationResponse = { confidential: false, createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, workItemType: { __typename: 'WorkItemType', id: 'gid://gitlab/WorkItems::Type/5', @@ -310,6 +335,11 @@ export const createWorkItemFromTaskMutationResponse = { closedAt: null, description: '', confidential: false, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, workItemType: { __typename: 'WorkItemType', id: 'gid://gitlab/WorkItems::Type/5', @@ -388,6 +418,11 @@ export const workItemHierarchyEmptyResponse = { title: 'New title', createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, userPermissions: { deleteWorkItem: false, updateWorkItem: false, @@ -426,6 +461,11 @@ export const workItemHierarchyNoUpdatePermissionResponse = { deleteWorkItem: false, updateWorkItem: false, }, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, confidential: false, widgets: [ { @@ -475,6 +515,11 @@ export const workItemHierarchyResponse = { updateWorkItem: true, }, confidential: false, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, widgets: [ { type: 'DESCRIPTION', @@ -570,6 +615,11 @@ export const changeWorkItemParentMutationResponse = { confidential: false, createdAt: '2022-08-03T12:41:54Z', closedAt: null, + project: { + __typename: 'Project', + id: '1', + fullPath: 'test-project-path', + }, widgets: [ { __typename: 'WorkItemWidgetHierarchy',