Paginate Project > Members > Group tab

What does this MR do and why?

Add pagination to Project > Members > Groups tab to prevent timeouts due to loading large amount of data at once.

This MR touches a lot of old code which resulted into a relatively complex change. I categorized the changes in the commits to hopefully make it easier to review:

  1. Add paginate_group_members feature flag
  2. Create methods/scopes to return group links with highest access level
  3. Create custom collection model with pagination info for group links
  4. Paginate the Project > Group members page

Note: There is a known bug in the frontend where the page number doesn't change when switching tabs. This would be tackled in a follow up to avoid increasing the size of this MR further.

Query Plans

Direct Members

Before After
No filter https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143028 https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143014
No filter (count) https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143016
With search https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143030 https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143019
With search (count) https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143020

Inherited Members

Before After
No filter https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143031 https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143022
No filter (count) https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143023
With search https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143033 https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143025
With search (count) https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47169/commands/143026

References

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. Enable the paginate_group_members feature flag
  2. Go to Project > Manage > Members > Groups tab.
  3. Invite 20+ groups into the project or apply the the following patch to limit the page size:
Index: app/controllers/projects/project_members_controller.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb
--- a/app/controllers/projects/project_members_controller.rb	(revision cd37516d89eff4154b9ac6783d71a598b414075f)
+++ b/app/controllers/projects/project_members_controller.rb	(date 1768363842282)
@@ -48,13 +48,14 @@
   end
 
   def group_member_links
-    paginator = Gitlab::MultiCollectionPaginator.new(project_group_links, group_group_links)
+    paginator = Gitlab::MultiCollectionPaginator.new(project_group_links, group_group_links, per_page: 5)
     result = paginator.paginate(pagination_params[:page])
 
     Members::GroupLinksCollection.new(
       result,
       page: pagination_params[:page].to_i,
-      total_count: paginator.total_count
+      total_count: paginator.total_count,
+      per_page: 5
     )
   end

Note: You may invite groups into the project or its ancestor groups to test out different cases.

MR acceptance checklist

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

Related to #581339

Edited by Shane Maglangit

Merge request reports

Loading