Skip to content

Expose work item type widget definitions

Mario Celi requested to merge 431492-mvc-expose-wit-widget-details into master

What does this MR do and why?

Adding a list of widgets enabled for each work item type in the GraphQL API. Some widgets provide additional information

How to set up and validate locally

Use GraphiQL to test the following queries at http://127.0.0.1:3000/-/graphql-explorer

Group level

{
  group(fullPath: "flightjs") {
    workItemTypes {
      nodes {
        id
        name
        widgets {
          type
          ... on WorkItemWidgetDefinitionAssignees {
            canInviteMembers
          }
        }
      }
    }
  }
}

Project level

{
  project(fullPath: "flightjs/flight") {
    workItemTypes {
      nodes {
        id
        name
        widgets {
          type
          ... on WorkItemWidgetDefinitionAssignees {
            canInviteMembers
          }
        }
      }
    }
  }
}
Example response
{
  "data": {
    "project": {
      "workItemTypes": {
        "nodes": [
          {
            "id": "gid://gitlab/WorkItems::Type/8",
            "name": "Epic",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "LABELS"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "START_AND_DUE_DATE"
              },
              {
                "type": "HEALTH_STATUS"
              },
              {
                "type": "STATUS"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/2",
            "name": "Incident",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/1",
            "name": "Issue",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "LABELS"
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "START_AND_DUE_DATE"
              },
              {
                "type": "MILESTONE"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "ITERATION"
              },
              {
                "type": "WEIGHT"
              },
              {
                "type": "HEALTH_STATUS"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/7",
            "name": "Key Result",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "LABELS"
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "START_AND_DUE_DATE"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "HEALTH_STATUS"
              },
              {
                "type": "PROGRESS"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/6",
            "name": "Objective",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "LABELS"
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "MILESTONE"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "HEALTH_STATUS"
              },
              {
                "type": "PROGRESS"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/4",
            "name": "Requirement",
            "widgets": [
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "STATUS"
              },
              {
                "type": "REQUIREMENT_LEGACY"
              },
              {
                "type": "TEST_REPORTS"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/5",
            "name": "Task",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "LABELS"
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "START_AND_DUE_DATE"
              },
              {
                "type": "MILESTONE"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "ITERATION"
              },
              {
                "type": "WEIGHT"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/3",
            "name": "Test Case",
            "widgets": [
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          },
          {
            "id": "gid://gitlab/WorkItems::Type/9",
            "name": "Ticket",
            "widgets": [
              {
                "type": "ASSIGNEES",
                "canInviteMembers": true
              },
              {
                "type": "DESCRIPTION"
              },
              {
                "type": "HIERARCHY"
              },
              {
                "type": "LABELS"
              },
              {
                "type": "MILESTONE"
              },
              {
                "type": "NOTES"
              },
              {
                "type": "START_AND_DUE_DATE"
              },
              {
                "type": "HEALTH_STATUS"
              },
              {
                "type": "WEIGHT"
              },
              {
                "type": "ITERATION"
              },
              {
                "type": "NOTIFICATIONS"
              },
              {
                "type": "AWARD_EMOJI"
              },
              {
                "type": "CURRENT_USER_TODOS"
              },
              {
                "type": "LINKED_ITEMS"
              }
            ]
          }
        ]
      }
    }
  }
}

Work item level

{
  workItem(id: "gid://gitlab/WorkItem/<gid>") {
    id
    namespace {
      fullName
    }
    workItemType {
      name
      widgets {
        type
        ... on WorkItemWidgetDefinitionAssignees {
          canInviteMembers
        }
      } 
    }
  }
}
Example response
{
  "data": {
    "workItem": {
      "id": "gid://gitlab/WorkItem/680",
      "namespace": {
        "fullName": "Flightjs"
      },
      "workItemType": {
        "name": "Issue",
        "widgets": [
          {
            "type": "ASSIGNEES",
            "canInviteMembers": false
          },
          {
            "type": "LABELS"
          },
          {
            "type": "DESCRIPTION"
          },
          {
            "type": "HIERARCHY"
          },
          {
            "type": "START_AND_DUE_DATE"
          },
          {
            "type": "MILESTONE"
          },
          {
            "type": "NOTES"
          },
          {
            "type": "ITERATION"
          },
          {
            "type": "WEIGHT"
          },
          {
            "type": "HEALTH_STATUS"
          },
          {
            "type": "NOTIFICATIONS"
          },
          {
            "type": "CURRENT_USER_TODOS"
          },
          {
            "type": "AWARD_EMOJI"
          },
          {
            "type": "LINKED_ITEMS"
          }
        ]
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #431492 (closed)

Edited by Mario Celi

Merge request reports