Skip to content

Enable overages warnings for custom roles

Eduardo Sanz García requested to merge eduardosanz/overcharges into master

What does this MR do and why?

In the group or project member pages, upgrading from minimal or guest access roles to a custom role could incur in additional charges. This MR sends memberRoleId to the gitlabSubscriptionsPreviewBillableUserChange GraphQL endpoint. If the response has a willIncreaseOverage of true it shows the modal asking for confirmation.

Same logic for inviting team members.

EE: true

Screenshots or screen recordings

For the invite members

Screen_Recording_2023-11-29_at_22.50.36

For role promotions to standard roles

Screen_Recording_2023-12-01_at_00.01.09

For role promotions to custom roles

Screen_Recording_2023-12-01_at_15.45.46
Screen_Recording_2023-12-01_at_15.46.43

For inviting guests

Screen_Recording_2023-11-30_at_23.59.31

How to set up and validate locally

  1. Enable the following feature flags:

    • echo "Feature.enable(:overage_members_modal)" | gdk rails console
    • echo "Feature.enable(:show_overage_on_role_promotion)" | gdk rails console
    • echo 'Feature.enable(:custom_roles_in_members_page)' | gdk rails console
  2. To create a custom role, enable the SaaS simulation and follow these steps.

  3. In the member page, assign a custom role to the member. A modal with a warning should be displayed.

  4. In the member page, invite a member and assign him/her a custom role. A modal with a warning should be displayed.

  5. For local testing if you don't have CustomersDot setup please apply the following change

diff --git a/ee/app/assets/javascripts/invite_members/components/invite_modal_base.vue b/ee/app/assets/javascripts/invite_members/components/invite_modal_base.vue
index e26059e3594b..a7553c341222 100644
--- a/ee/app/assets/javascripts/invite_members/components/invite_modal_base.vue
+++ b/ee/app/assets/javascripts/invite_members/components/invite_modal_base.vue
@@ -216,7 +216,8 @@ export default {
 
       if (this.enabledOverageCheck && !this.willIncreaseOverage && this.hasInput) {
         this.actualFeedbackMessage = '';
-        this.checkEligibility(args);
+        // this.checkEligibility(args);
+        this.checkAndSubmit(args);
       } else {
         this.emitSubmit(args);
       }

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 Eduardo Sanz García

Merge request reports

Loading