GraphQL: Add hierarchyWidget to work item update mutation
What does this MR do and why?
This MR corresponds to the second task of #362213 (closed) and adds the ability to update the parent or children of a work item using the GraphQL mutation workItemUpdate
.
For this functionality we need to add the following services:
-
WorkItems::Widgets::HierarchyService::UpdateService
Called from
WorkItems::UpdateService#execute_widgets
, handles the widget-specific params and callsWorkItems::ParentLinks::CreateService
to update the links. -
WorkItems::ParentLinks::CreateService
Inherits from
IssuableLinks::CreateService
and createsWorkItems::ParentLink
objects.
We are adding extra functionality in the following MRs to keep this MR as small as possible:
- Add the ability to remove a child work item from its parent [!91494 (merged)]
- Add system notes for work item's hierarchy changes [!91495 (merged)]
How to set up and validate locally
-
Enable
:work_items
andwork_items_hierarchy
feature flagsFeature.enable(:work_items) Feature.enable(:work_items_hierarchy)
-
Run GraphQL query with
http://local-url/-/graphql-explorer
updateParent
mutation updateParent {
workItemUpdate(input: { id: "gid://gitlab/Issue/{TASK_ID}", hierarchyWidget: { parentId: "gid://gitlab/Issue/{ISSUE_ID}"}}) {
workItem {
id
description
widgets {
... on WorkItemWidgetHierarchy {
parent {
id
}
}
}
}
}
}
}
updateChildren
mutation updateChildren {
workItemUpdate(input: { id: "gid://gitlab/Issue/{ISSUE_ID}", hierarchyWidget: { childrenIds: ["gid://gitlab/Issue/{TASK_ID}"]}}) {
workItem {
id
description
widgets {
... on WorkItemWidgetHierarchy {
children {
edges {
node {
id
}
}
}
}
}
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #362213 (closed)