Add pagination to projects DORA comparison table
What does this MR do and why?
Fixes a bug where groups with over 100 projects would not render all of their projects in the DORA comparison table on the Value Streams analytics dashboard.
The data fetching logic will now recursively paginate until all groups have been loaded
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
No visible changes
How to set up and validate locally
- Ensure you are using GitLab Ultimate
- Navigate to Analytics dashboards for any group (ex. http://gdk.test:3000/groups/flightjs/-/analytics/dashboards)
- Select the Value streams Dashboard from the list and scroll down to the last panel (
Projects by DORA categories) - By default you should see the
No data availablemessage - Create mock DORA data for two or more projects within the group
project = Group.find(GROUP_ID).projects.first
# generate mock DORA metrics for the last 2 months
# project must have a default environment set first, or this will error
[
[1.month.ago, 12, 10, 2, 5],
[2.month.ago, 16, 7, 1, 9]
].each do |date, deploys, lead_time_for_changes, time_to_restore_service, incidents_count|
Dora::DailyMetrics.create!(
deployment_frequency: deploys,
lead_time_for_changes_in_seconds: lead_time_for_changes * 1.day.to_i,
time_to_restore_service_in_seconds: time_to_restore_service * 1.day.to_i,
incidents_count: incidents_count,
environment: project.default_environment,
date: date
)
end
- Reduce the page size to 1 to test the pagination logic
diff --git a/ee/app/assets/javascripts/analytics/dashboards/graphql/dora_metrics_by_project.query.graphql b/ee/app/assets/javascripts/analytics/dashboards/graphql/dora_metrics_by_project.query.graphql
index 7fbddba48389..9de227a8cc55 100644
--- a/ee/app/assets/javascripts/analytics/dashboards/graphql/dora_metrics_by_project.query.graphql
+++ b/ee/app/assets/javascripts/analytics/dashboards/graphql/dora_metrics_by_project.query.graphql
@@ -9,7 +9,7 @@ query doraMetricsByProjectQuery(
) {
group(fullPath: $fullPath) {
id
- projects(after: $after) {
+ projects(after: $after, first: 1) {
pageInfo {
endCursor
hasNextPage
- Verify that data loads and can be sorted as expected
Related to #504574 (closed)
Edited by Alex Pennells