Skip to content

Add count field to WorkItemConnection

Eugenia Grieff requested to merge eg-add-count-field-to-work-items into master

What does this MR do and why?

Add the count field to WorkItemConnection in GraphQL. This field wasn't included when introducing WorkItemType::Types because there was no use for it yet but now it's needed for work item children pagination (see Slack discussion (internal) for more context).

Example queries

query projectWorkItemsCount {
  workspace: project(fullPath: "group-a/project-a") {
    workItems {
      count
    }
  }
}

# {
#   "data": {
#     "workspace": {
#       "workItems": {
#         "count": 23
#       }
#     }
#   }
# }
query groupWorkItemsCount {
  workspace: group(fullPath: "group-b") {
    workItems {
      count
    }
  }
}

# {
#   "data": {
#     "workspace": {
#       "workItems": {
#         "count": 30
#       }
#     }
#   }
# }

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.

How to set up and validate locally

  1. Enable feature flag with Feature.enable(:namespace_level_work_items)
  2. Visit a group with a project and create work items at group and project levels by visiting http://gdk.test:3000/groups/<group_path>/-/work_items and http://gdk.test:3000/<project_full_path>/-/issues.
  3. Use GraphQL explorer (https://gdk.test:3000/-/graphql-explorer) to test the example queries and verify that they return the correct counts.
Edited by Eugenia Grieff

Merge request reports