Skip to content

Add button for adding additional seats to error messages

Lukas Wanko requested to merge 455364-confidential-issue into master

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

localhost_3000_groups_mr-455364_-_usage_quotas (8).png

localhost_3000_groups_mr-455364_-_usage_quotas (9).png

After
localhost_3000_groups_mr-455364_-_usage_quotas (6).pnglocalhost_3000_groups_mr-455364_-_usage_quotas (5).png

Special cases

There are two scenarios where we hide the button link for the self-service purchase:

  1. The current subscription is managed by a reseller
  2. The current subscription is a via sales customized subscription
Before

localhost_3000_groups_mr-455364_-_usage_quotas (8).png

localhost_3000_groups_mr-455364_-_usage_quotas (9).png

After
image.png

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

  1. Go to http://localhost:3000/dashboard/groups
  2. Click only any group
    1. If you don't have a group, then click on New group and create a group
  3. Click on Settings -> Usage Quotas in the sidebar
  4. Click on GitLab Duo
    1. If you don't see a tab Gitlab Duo please enable it
      1. 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
      2. Enable the feature flag for Duo in the rails console: Feature.enable(:hamilton_seat_management)
      3. Make sure you are using a Premium or Ultimate license
        1. If you are using a free plan, then go to Settings -> Billing -> Upgrade to Premium or Upgrade to Ultimate
        2. You will be redirected to your local CustomersDot installation
        3. Purchase the chosen plan
        4. Synchronize the purchase to GitLab with ZSim
          1. Execute ./bin/zsim in your terminal
          2. Choose Replay callouts for Zuora Order
          3. Enter the order number of the purchase from Zuora
          4. Hit enter
      4. Now you should see the GitLab Duo tab
  5. Test error alert No seats available
    1. Activate the GitLab Duo toggles in the table for more users than there are available Duo seats
      1. If you get a CTA for purchasing seats, add Duo seats to your subscription
        1. Click on the Purchase seats button and
          1. you will be redirected to your local CustomersDot installation
          2. Purchase a Duo seat
          3. Synchronize the purchase to GitLab with ZSim
            1. Execute ./bin/zsim in your terminal
            2. Choose Replay callouts for Zuora Order
            3. Enter the order number of the purchase from Zuora
            4. Hit enter
        2. Now the CTA for purchasing seats at the GitLab Duo tab at the Usage Quotas site at GitLab should be gone
      2. If you have only one user listed, add further users to your group. Add the user with higher privileges, for example, as a developer.
    2. You should now see the error alert No seats available with the Add seats button
  6. Test error alert Not enough seats
    1. Use bulk assignment by selecting more users in the table than there are available Duo seats via the checkboxes on the left
      1. If you don't see any checkboxes, activate the bulk assignment feature: Feature.enable(:gitlab_com_duo_pro_bulk_user_assignment)
    2. Click on Assign seat
    3. Confirm the modal by clicking on Assign seats
    4. You should now see the error alert Not enough seats with the Add seats button
  7. Test special cases
    1. 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
    2. When you now follow 5. and 6. you should see the error alert, but without the Add seats button.

Related to #455364

Edited by Lukas Wanko

Merge request reports

Loading