Display membership type
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 |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Needs both
gdk
and CustomersDot running (setup guide) - In Rails console, enable Code Suggestions
Feature.enable(:hamilton_seat_management)
- In Rails console, enable the filtering capabilities
Feature.enable(:enable_add_on_users_filtering)
To assign Code Suggestions seats to your group:
- Pick (or create) a Group with a Subscription (e.g.,
Premium
) - In Rails console,
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
- 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')
- Visit any group or project member pages such as
http://127.0.0.1:3000/groups/flightjs/-/usage_quotas#code-suggestions-usage-tab
- 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);