Skip to content

Create work item with iteration

euko requested to merge 367456-update-create-work-item-mutation into master

What does this MR do and why?

This MR adds the ability to assign an iteration to a work item on creation via GraphQL mutation workItemCreate.

The change allows us to reduce the complexity on the frontend because we can avoid chaining mutations workItemCreate and workItemUpdate (#367456 (comment 1098107478).)

How to set up and validate locally

  • Prepare an iteration. Visit any group and navigate to Issues -> Iterations in the left sidebar.
    • Create a new iterations cadence by clicking New iteration cadence.
      • For simplicity, uncheck Enable automatic scheduling
    • To the created iterations cadence, add an iteration.
    • Grab the id of the created iteration by running gdk psql -c "SELECT id FROM sprints ORDER BY id DESC LIMIT 1;" in your terminal.
video walkthrough

demo

Sample query

mutation myMutation {
  workItemCreate(input: {
    projectPath: "gitlab-org/gitlab-test"
    workItemTypeId: "gid://gitlab/WorkItems::Type/1" # corresponds to Issue type
    title: "some work item"
    iterationWidget: {
      iterationId: "gid://gitlab/Iteration/4" # you might try out `null` and other values.
    }
  }) {
    errors
    workItem {
      id
      title
      widgets {
        type
        ... on WorkItemWidgetIteration {
          iteration {
            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.

Related to #367456 (closed)

Edited by euko

Merge request reports