Add color and health status GraphQL arguments for creating a work item
What does this MR do and why?
Related to #456119 (closed)
Add support for setting health status and color when creating a work item. These arguments are needed for !144705 (closed) (see !144705 (comment 1861625817) for more context).
Summary of changes:
-
Health status widget: We were using a service to update this widget and didn't have a create service so instead of creating it I took the opportunity to move the update logic to a callback class so it can be reused when creating the work item (this work was planned as part of #412801). Also, delete
WorkItems::Widgets::HealthStatusService::UpdateService
file and the corresponding specs, as well as removing the file name from therubocop_todo
lists. -
Color widget: Add argument to the create mutation, we already added an
after_initialize
callback for setting the value of this widget.
MR acceptance checklist
Screenshots or screen recordings
mutation | result |
---|---|
How to set up and validate locally
- Enable feature flag
namespace_level_work_items
- Visit
https://gdk.test:3000/-/graphql-explorer
and test the following query using the corresponding ID forworkItemTypeId
:
query
query getWorkItemTypeId{
workspace: group(fullPath: "group-a") {
workItemTypes(name: EPIC) {
edges {
node {
id #=> E.g. "gid://gitlab/WorkItems::Type/8" but can be different in your local environment
}
}
}
}
}
mutation createWIEpic {
workItemCreate(input: {
namespacePath: "group-a", title: "Epic WI with color and health status",
workItemTypeId: "gid://gitlab/WorkItems::Type/8",
colorWidget: {color: "#CCFFCC"},
healthStatusWidget: { healthStatus: atRisk }
}) {
errors
workItem {
id
webUrl
widgets {
... on WorkItemWidgetHealthStatus {
healthStatus
}
... on WorkItemWidgetColor {
color
}
}
}
}
}
response
{
"data": {
"workItemCreate": {
"errors": [],
"workItem": {
"id": "gid://gitlab/WorkItem/602",
"webUrl": "http://127.0.0.1:3000/groups/group-a/-/work_items/138",
"widgets": [
{
"healthStatus": "atRisk"
},
{
"color": "#CCFFCC"
}
]
}
}
}
}
- Visit the work item list using
http://gdk.test:3000/groups/GROUP_PATH/-/work_items
and verify that the the work item was created with the set arguments
Edited by Eugenia Grieff