Update URL for work items with type issue
Related to #415549 (closed)
What does this MR do and why?
The change updates the URL for work items with type 'issue'. The URL will now be in the format <project_url>/-/issues/#{work_item.iid}
rather than <project_url>/-/work_items/#{work_item.iid}
.
We are not changing the route for the work item, just the URL that we return when fetching the webUrl
field in WorkItemType
.
We need this change because the work items' view doesn't support all issues features yet, so we want to view items with the type Issue
in the legacy-issue view until we close the gap. See #415549 (comment 1560798684) for more context.
Example query
query getWorkItems {
project(fullPath: "group-a/project-a") {
workItems {
edges {
node {
title
webUrl
}
}
}
}
}
Example response
Click to expand
{
"data": {
"project": {
"workItems": {
"edges": [
{
"node": {
"title": "Work Item of type Task",
"webUrl": "https://gdk.test:3000/group-a/project-a/-/work_items/1"
}
},
{
"node": {
"title": "Work Item of type Objective",
"webUrl": "https://gdk.test:3000/group-a/project-a/-/work_items/2"
}
},
{
"node": {
"title": "Work Item of type Issue",
"webUrl": "https://gdk.test:3000/group-a/project-a/-/issues/3"
}
}
]
}
}
}
}
Screenshots or screen recordings
Example of both views for the same record. The webUrl
field will now direct us to the view on the left:
How to set up and validate locally
- Visit
https://GDK_URL/-/graphql-explorer
and use the following query to fetch work item types. Take note of the global ID of theIssue
type (e.g."gid://gitlab/WorkItems::Type/1"
) and theTask
type.
Click to expand
query gettWorkItemTypes {
project(fullPath: "flightjs/Flight") {
id
workItemTypes {
nodes {
id
name
}
}
}
}
- Create two work items, one with the type
Issue
and one with the typeTask
:
Click to expand
mutation createIssue {
workItemCreate(input: {projectPath: "flightjs/Flight", title: "Test Issue WI", workItemTypeId: "gid://gitlab/WorkItems::Type/1"}) {
errors
workItem {
id
}
}
}
mutation createTask {
workItemCreate(input: {projectPath: "flightjs/Flight", title: "Test Task WI", workItemTypeId: "gid://gitlab/WorkItems::Type/2"}) {
errors
workItem {
id
}
}
}
- Query the project's work items and verify that the
webUrl
for "Test Issue WI" usesissues
instead ofwork_items
.
Click to expand
query getWorkItems {
project(fullPath: "flightjs/Flight") {
workItems {
edges {
node {
title
webUrl
}
}
}
}
}
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.