Add button for adding additional seats to error messages
What does this MR do and why?
What: Add a button link to the Duo add-on assignment error alerts for manually purchasing additional Duo add-on seats via CDot.
Why: We previously introduced the ability for customers to self-service purchase Duo add-on seats. We want the user to be redirected to this flow so the customer doesn't have to contact sales.
Screenshots
| Before | 
|---|
| After | 
|---|
|    | 
Special cases
There are two scenarios where we hide the button link for the self-service purchase:
- The current subscription is managed by a reseller
- The current subscription is a via sales customized subscription
| Before | 
|---|
| After | 
|---|
|  | 
How to set up and validate locally
Requirements
- Have GitLab, CustomersDot, and ZSim locally installed and running
- Having experience in using the CustomersDot checkout
- Having experience in finding order numbers in Zuora
Validation
- Go to http://localhost:3000/dashboard/groups
- Click only any group
- If you don't have a group, then click on New groupand create a group
 
- If you don't have a group, then click on 
- Click on Settings -> Usage Quotas in the sidebar
- Click on GitLab Duo
- If you don't see a tab Gitlab Duoplease enable it- Make sure you are running your local GitLab instance as SaaS by executing the following in your terminal: export GITLAB_SIMULATE_SAAS=1; gdk restart
- Enable the feature flag for Duo in the rails console: Feature.enable(:hamilton_seat_management)
- Make sure you are using a Premium or Ultimate license
- If you are using a free plan, then go to Settings -> Billing -> Upgrade to Premium or Upgrade to Ultimate
- You will be redirected to your local CustomersDot installation
- Purchase the chosen plan
- Synchronize the purchase to GitLab with ZSim
- Execute ./bin/zsimin your terminal
- Choose Replay callouts for Zuora Order
- Enter the order number of the purchase from Zuora
- Hit enter
 
- Execute 
 
- Now you should see the GitLab Duotab
 
- Make sure you are running your local GitLab instance as SaaS by executing the following in your terminal: 
 
- If you don't see a tab 
- 
Test error alert No seats available- Activate the GitLab Duo toggles in the table for more users than there are available Duo seats
- If you get a CTA for purchasing seats, add Duo seats to your subscription
- Click on the Purchase seatsbutton and- you will be redirected to your local CustomersDot installation
- Purchase a Duo seat
- Synchronize the purchase to GitLab with ZSim
- Execute ./bin/zsimin your terminal
- Choose Replay callouts for Zuora Order
- Enter the order number of the purchase from Zuora
- Hit enter
 
- Execute 
 
- Now the CTA for purchasing seats at the GitLab Duotab at theUsage Quotassite at GitLab should be gone
 
- Click on the 
- If you have only one user listed, add further users to your group. Add the user with higher privileges, for example, as a developer.
 
- If you get a CTA for purchasing seats, add Duo seats to your subscription
- You should now see the error alert No seats availablewith theAdd seatsbutton
 
- Activate the GitLab Duo toggles in the table for more users than there are available Duo seats
- 
Test error alert Not enough seats- Use bulk assignment by selecting more users in the table than there are available Duo seats via the checkboxes on the left
- If you don't see any checkboxes, activate the bulk assignment feature: Feature.enable(:gitlab_com_duo_pro_bulk_user_assignment)
 
- If you don't see any checkboxes, activate the bulk assignment feature: 
- Click on Assign seat
- Confirm the modal by clicking on Assign seats
- You should now see the error alert Not enough seatswith theAdd seatsbutton
 
- Use bulk assignment by selecting more users in the table than there are available Duo seats via the checkboxes on the left
- 
Test special cases
- 
To test the two special cases mentioned above, you can temporarily adapt the response from the GraphQL API of CustomersDot for this site. Use the following patch at the CustomersDot project: diff --git a/app/models/subscription.rb b/app/models/subscription.rb index fc2a488db..6dc74b08b 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -205,9 +205,7 @@ def can_buy_code_suggestions_seats? end def limited_access_reason - return LIMITED_ACCESS_REASON[:reseller_managed] if managed_by_reseller? - - LIMITED_ACCESS_REASON[:ramp_subscription] if ramp_enabled? + LIMITED_ACCESS_REASON[:ramp_subscription] end
- 
When you now follow 5. and 6. you should see the error alert, but without the Add seatsbutton.
 
- 
Related to #455364
Edited  by Lukas Wanko

