Skip to content

Display membership type

Angelo Gulina requested to merge ag/431478-display-membership-type into master

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/431478. This MR adds the code to render the membership type to the Duo Pro Code Suggestions user list. (The backend is not yet implemented. Here, we're providing only frontend scaffolding/implementation.) Additionally, it provides a new slot on the AddOnEligibleUserList to allow for different use of the user cell (i.e., SaaS VS SM user list).

Note that the feature does not impact current UI, as the FF is disabled.

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.

Group Invite Project Invite
Screenshot_2024-02-01_at_09.19.53 Screenshot_2024-02-01_at_09.43.07

How to set up and validate locally

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

  1. Needs both gdk and CustomersDot running (setup guide)
  2. In Rails console, enable Code Suggestions Feature.enable(:hamilton_seat_management)
  3. In Rails console, enable the filtering capabilities Feature.enable(:enable_add_on_users_filtering)

To assign Code Suggestions seats to your group:

  1. Pick (or create) a Group with a Subscription (e.g., Premium)
  2. In Rails console, add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
  3. In Rails console, GitlabSubscriptions::AddOnPurchase.create!(add_on: add_on, namespace: Namespace.find(<you-name-space-id>), expires_on: 21.month.from_now, quantity: 5, purchase_xid: 'A-S0002')
  4. Visit any group or project member pages such as http://127.0.0.1:3000/groups/flightjs/-/usage_quotas#code-suggestions-usage-tab
  5. Add the following patch to display the badge
<+>UTF-8
===================================================================
diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue
--- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue	(revision 0316615d4ec8f1bda45e8c5a9d4f19b5b619a20e)
+++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/saas_add_on_eligible_user_list.vue	(date 1706867543327)
@@ -70,7 +70,10 @@
},
update({ namespace }) {
this.pageInfo = namespace?.addOnEligibleUsers?.pageInfo;
-        return namespace?.addOnEligibleUsers?.nodes;
+        return namespace?.addOnEligibleUsers?.nodes.map((user) => ({
+          ...user,
+          membershipType: 'project_invite',
+        }));
},
error(error) {
this.handleAddOnUsersFetchError(error);
Edited by Angelo Gulina

Merge request reports