Skip to content

Hiearchy widget - extend work item update mutation with accepting parent/child widget

  • the scope of work might be similar to create mutation (#362206 (closed))
  • TODO clarify need or custom ordering (#358195 (comment 932035936)) - maybe we may need a separate mutation for reordering?. For MVC relative position ordering (and so also mutation) may not be required.
  • hierarchy widget should be developed behind a feature flag
  • TODO: consider if parent link removal could/should be handled as part of UPDATE (just update with parent_id: nil) or if a separate mutation is needed)

Draft: !85700 (diffs)

SPIKE discussion: #358195 (comment 932136343)

UPDATE: there is an ongoing discussion (slack link - https://gitlab.slack.com/archives/C02403NRD40/p1653590052892849 - TODO: replace with an issue link when an issue is created for the proposal), whether we should rather use separate small mutation for each widget - if we would go this path, it would impact also implementation of this task

There is also an upcoming MR for updating description widget - !88955 (merged)

Queries

Update work item's parent
mutation updateParent {
  workItemUpdate(input: { id: "gid://gitlab/WorkItem/{TASK_ID}", hierarchyWidget: { parentId: "gid://gitlab/Issue/{ISSUE_ID}"}}) {
    workItem {
      id
      description
      widgets {
        ... on WorkItemWidgetHierarchy {
          parent {
            id
          }
        }
      }
    }
  }
}
Update work item's children
mutation updateChildren {
  workItemUpdate(input: { id: "gid://gitlab/Issue/{ISSUE_ID}", hierarchyWidget: { childrenIds: ["gid://gitlab/WorkItem/{TASK_ID}", "gid://gitlab/WorkItem/{OTHER_TASK_ID}"]}}) {
    workItem {
      id
      description
      widgets  {
        ... on WorkItemWidgetHierarchy {
          children {
            edges {
              node {
                id
              }
            }
          }
        }
      }
    }
  }
}

Feature flag

work_items_hierarchy (FF issue: #363447 (closed))


Tasks

  • Move widgets update logic from the model layer to the service layer [!90817 (merged)]
  • Add hierarchyWidget argument to to WorkItemUpdate mutation [!90908 (merged)]
  • 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)]
Edited by Eugenia Grieff