Allow to update requirement status widget through GraphQL
What does this MR do and why?
Allows for an update to the status of a Work Item of type Requirement.
Behind the scenes, it creates a new Test Report with the given status.
Passed and Satisfied are functionally equivalent, but only passed
is accepted as a parameter.
How to set up and validate locally
- Create a requirement (you can do this via the UI - you can use https://gdk.test:3443/group/project/-/requirements_management/requirements)
- Get its work item ID:
query {
project(fullPath: "group/project") {
workItems(types: [REQUIREMENT]) {
nodes {
id
title
widgets{
type
... on WorkItemWidgetStatus {
status
}
}
}
}
}
}
You'll get something like:
{
"data": {
"project": {
"workItems": {
"nodes": [
{
"id": "gid://gitlab/WorkItem/464",
"title": "be awesome",
"widgets": [
{
"type": "STATUS",
"status": "failed"
},
{
"type": "DESCRIPTION"
}
]
}
]
}}}}
- Plug that gid (in this case "gid://gitlab/Issue/464") into the mutation below:
mutation updateWorkItem {
workItemUpdate(input: {id: "gid://gitlab/Issue/464", statusWidget: {status: "passed"}}) {
workItem {
widgets {
... on WorkItemWidgetStatus {
status
}
}
}
errors
}
}
- You'll get the following response for
passed
(it comes back assatisfied
)
{
"data": {
"workItemUpdate": {
"workItem": {
"widgets": [
{
"status": "satisfied"
},
{}
]
},
"errors": []
}
}
}
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 #365991 (closed)
Edited by charlie ablett