Skip to content

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:

Click to expand
Issue View Work Item View
Screenshot_2023-09-19_at_10.28.27 Screenshot_2023-09-19_at_10.30.04

How to set up and validate locally

  1. Visit https://GDK_URL/-/graphql-explorer and use the following query to fetch work item types. Take note of the global ID of the Issue type (e.g. "gid://gitlab/WorkItems::Type/1") and the Task type.
Click to expand
query gettWorkItemTypes {
  project(fullPath: "flightjs/Flight") {
    id
    workItemTypes {
      nodes {
        id
        name
      }
    }
  }
}
  1. Create two work items, one with the type Issue and one with the type Task:
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
    }
  }
}
  1. Query the project's work items and verify that the webUrl for "Test Issue WI" uses issues instead of work_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.

Edited by Eugenia Grieff

Merge request reports

Loading