Skip to content

Show add-on eligible user list on code suggestions tab

Vamsi Vempati requested to merge 421967-show-add-on-eligible-user-list into master

What does this MR do and why?

Show add-on eligible user list on code suggestions tab on Usage Quotas page.

  • Removes the logic around whether add-on is applicable for a user and the corresponding tooltip explaining why since its no longer needed
  • Update code_suggestions_addon_assignment.vue for changes in API structure

The API changes to fetch the user list is being implemented in Create add on eligible users GraphQL API (!129203 - merged). In the meantime, we're using client resolver strategy to resolve the value of addOnEligibleUsers to display the user list on Code Suggestions tab. This will let us deploy frontend code while the API is being implemented. The plan is to remove the client resolvers once the API changes are live.

Note: This feature is behind a feature flag. Pagination, filtering and sorting the user list will be implemented in follow-up MRs.

Related to #421967

MR Notes
Show add-on eligible user list 👈 You are here
Add pagination to add-on user list !132076 (merged)
Add search and sort functionality to add-on user list !132184 (merged)
Update cache with latest add-on assignment status on assignment mutation 🚧
Remove client resolvers and use the API to fetch eligible users list 🚧

Screenshots or screen recordings

Scenario Screenshot
User list table
ScreenshotScreenshot_2023-09-19_at_2.39.39_PM
Tooltip for Private email
ScreenshotScreenshot_2023-09-19_at_2.39.56_PM
Last activity (Date and Never)
ScreenshotScreenshot_2023-09-12_at_1.02.04_PM
Avatar link
ScreenshotScreenshot_2023-09-12_at_1.02.33_PM
Error when fetching user list
ScreenshotScreenshot_2023-09-19_at_2.46.56_PM
Loading state
ScreenshotScreenshot_2023-09-19_at_2.43.42_PM
Error assigning code suggestions add-on
ScreenshotScreenshot_2023-09-19_at_2.42.43_PM
Error un-assigning code suggestions add-on
ScreenshotScreenshot_2023-09-19_at_2.42.48_PM
No seats available error
ScreenshotScreenshot_2023-09-19_at_2.54.47_PM
Loading state when assigning add-on
ScreenshotScreenshot_2023-09-19_at_2.42.15_PM
Loading state when un-assigning add-on
ScreenshotScreenshot_2023-09-19_at_2.41.47_PM
Clearing error on retry
Screen recordingScreen_Recording_2023-09-19_at_2.44.52_PM

How to set up and validate locally

Application setup

  1. Customers Dot needs to be setup in order to view the billing page for a group
  2. Start GDK in SaaS mode GITLAB_SIMULATE_SAAS=1 gdk start

Group setup

  1. Create a Group
  2. Buy a Subscription for your group from Settings > Billing

Feature flag

Run the following in your rails console

Feature.enable(:enable_hamilton_in_usage_quotas_ui, Namespace.find(your-group-id)
Feature.enable(:hamilton_seat_management, Namespace.find(your-group-id)

Add-on purchase

Run the following in your rails console

  1. Find the namespace
namespace = Namespace.find(your-group-id)
  1. Create an Addon
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
  1. Create an add-on purchase
GitlabSubscriptions::AddOnPurchase.create!(add_on: add_on, namespace: namespace, expires_on: 1.month.from_now, quantity: 20, purchase_xid: 'A-S0001')

Client resolvers for add-on user list

  1. Apply patch to resolve user list locally on Client side: Add_On_Eligible_Users.patch

Code Suggestions tab

  1. Visit /groups/<your-namespace-name>/-/usage_quotas#code-suggestions-usage-tab

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vamsi Vempati

Merge request reports