Skip to content

Rename custom status widget to status widget

What does this MR do and why?

As we already renamed the status widget to the verification status widget, we can finally use the status naming as part of the Work Items Custom Status initiative.

No deprecation process is required as we're updating the experimental GraphQL API that is not used in the frontend.

Changes

  • Adjust the GraphQL API to reflect renaming WorkItemWidgetCustomStatus to WorkItemWidgetStatus type.
  • Rename allowedCustomStatuses to allowedStatuses field in the GraphQL API.
  • Update the name column in the work_item_widget_definitions table from Custom status to Status via a regular schema migration.

Scenarios

Below, you can find test queries to fetch allowed statuses for a given work item type:

Scenario 1: when the work_item_status FF is enabled and the work item type is supported

(Note that only task is supported at the moment)

View query
query namespaceWorkItemTypes($fullPath: ID!, $name: IssueType) {
  workspace: namespace(fullPath: $fullPath) {
    id
    workItemTypes(name: $name) {
      nodes {
        id
        name
        widgetDefinitions {
          ... on WorkItemWidgetDefinitionStatus {
            allowedStatuses {
              nodes {
                id
                name
                iconName
                color
                position
              }
            }
          }
        }
        __typename
      }
      __typename
    }
    __typename
  }
}
{
  "fullPath": "gitlab-org",
  "name": "TASK"
}
View response
{
  "data": {
    "workspace": {
      "id": "gid://gitlab/Group/24",
      "workItemTypes": {
        "nodes": [
          {
            "id": "gid://gitlab/WorkItems::Type/5",
            "name": "Task",
            "widgetDefinitions": [
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {
                "allowedStatuses": {
                  "nodes": [
                    {
                      "id": "gid://gitlab/WorkItems::Statuses::SystemDefined::Status/1",
                      "name": "To do",
                      "iconName": "status-waiting",
                      "color": "#737278",
                      "position": 0
                    },
                    {
                      "id": "gid://gitlab/WorkItems::Statuses::SystemDefined::Status/2",
                      "name": "In progress",
                      "iconName": "status-running",
                      "color": "#1f75cb",
                      "position": 0
                    },
                    {
                      "id": "gid://gitlab/WorkItems::Statuses::SystemDefined::Status/3",
                      "name": "Done",
                      "iconName": "status-success",
                      "color": "#108548",
                      "position": 0
                    },
                    {
                      "id": "gid://gitlab/WorkItems::Statuses::SystemDefined::Status/4",
                      "name": "Won't do",
                      "iconName": "status-cancelled",
                      "color": "#DD2B0E",
                      "position": 0
                    },
                    {
                      "id": "gid://gitlab/WorkItems::Statuses::SystemDefined::Status/5",
                      "name": "Duplicate",
                      "iconName": "status-cancelled",
                      "color": "#DD2B0E",
                      "position": 10
                    }
                  ]
                }
              }
            ],
            "__typename": "WorkItemType"
          }
        ],
        "__typename": "WorkItemTypeConnection"
      },
      "__typename": "Namespace"
    }
  },
  "correlationId": "01JNQFQNZJYXR4XCPGPBQPNJ27"
}

Scenario 2: when the work_item_status FF is enabled and the work item type is not supported

(For example, an issue or epic)

View query
query namespaceWorkItemTypes($fullPath: ID!, $name: IssueType) {
  workspace: namespace(fullPath: $fullPath) {
    id
    workItemTypes(name: $name) {
      nodes {
        id
        name
        widgetDefinitions {
          ... on WorkItemWidgetDefinitionStatus {
            allowedStatuses {
              nodes {
                id
                name
                iconName
                color
                position
              }
            }
          }
        }
        __typename
      }
      __typename
    }
    __typename
  }
}
{
  "fullPath": "gitlab-org",
  "name": "EPIC"
}
View response
{
  "data": {
    "workspace": {
      "id": "gid://gitlab/Group/24",
      "workItemTypes": {
        "nodes": [
          {
            "id": "gid://gitlab/WorkItems::Type/8",
            "name": "Epic",
            "widgetDefinitions": [
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {}
            ],
            "__typename": "WorkItemType"
          }
        ],
        "__typename": "WorkItemTypeConnection"
      },
      "__typename": "Namespace"
    }
  },
  "correlationId": "01JNQFS8EERP4V2M4CRV4AR6HT"
}

Scenario 3: when the work_item_status FF is disabled

View query
query namespaceWorkItemTypes($fullPath: ID!, $name: IssueType) {
  workspace: namespace(fullPath: $fullPath) {
    id
    workItemTypes(name: $name) {
      nodes {
        id
        name
        widgetDefinitions {
          ... on WorkItemWidgetDefinitionStatus {
            allowedStatuses {
              nodes {
                id
                name
                iconName
                color
                position
              }
            }
          }
        }
        __typename
      }
      __typename
    }
    __typename
  }
}
{
  "fullPath": "gitlab-org",
  "name": "TASK"
}
View response
{
  "data": {
    "workspace": {
      "id": "gid://gitlab/Group/24",
      "workItemTypes": {
        "nodes": [
          {
            "id": "gid://gitlab/WorkItems::Type/5",
            "name": "Task",
            "widgetDefinitions": [
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {
                "allowedStatuses": {
                  "nodes": []
                }
              }
            ],
            "__typename": "WorkItemType"
          }
        ],
        "__typename": "WorkItemTypeConnection"
      },
      "__typename": "Namespace"
    }
  },
  "correlationId": "01JNQRM5P76HJT98GBFQWH2X4H"
}

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

backend changes only

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Enable the namespace_level_work_items feature flag to have access to work items.
  2. Navigate to the GraphQL Explorer: http://127.0.0.1:3000/-/graphql-explorer.
  3. Use the test queries provided above. Depending on a test scenario, enable or disable work_item_status feature flag.
  4. Verify the fetched statuses for work item types like tasks (supported types), and issues or epics (unsupported types).
Edited by Agnes Slota

Merge request reports

Loading