Skip to content

Update routing on Add seats flow to use the new cdot controller

Minahil Nichols requested to merge cdot/8557-add-sm-route into master

What does this MR do and why?

Partly solves https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/8557

We currently use namespaces controller within cdot in order to route SM subscriptions. SM subscriptions do not have a namespace attached so we use subscription_name to route, however, we need to move this to it's own controller so we are consistent with our api calls. Once https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/9290 is merged, we want to use the new controller to route SM subscriptions.

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

No UI change

image

How to set up and validate locally

  1. Login as root
  2. Apply the patch - we need to emulate SM with purchased code suggestions addon
8286.patch
diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue
index f4d83897a3e4..eca6e3338025 100644
--- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue
+++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_info_card.vue
@@ -43,9 +43,7 @@ export default {
     shouldShowAddSeatsButton() {
       return (
         !this.isLoading &&
-        this.addDuoProHref &&
-        this.groupId &&
-        this.subscriptionPermissions?.canAddDuoProSeats
+        this.addDuoProHref
       );
     },
     isLoading() {
diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
index 65b0c858d623..c2c29d67f47a 100644
--- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
+++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
@@ -31,7 +31,7 @@ export default {
   addOnErrorDictionary: ADD_ON_ERROR_DICTIONARY,
   data() {
     return {
-      addOnPurchase: undefined,
+      addOnPurchase: { purchasedQuantity: 2, usedQuantity: 3 },
       addOnPurchaseFetchError: undefined,
     };
   },
@@ -73,6 +73,9 @@ export default {
       update({ addOnPurchase }) {
         return addOnPurchase;
       },
+      skip() {
+        return true;
+      },
       error(error) {
         this.handleAddOnPurchaseFetchError(error);
       },
@@ -136,8 +139,6 @@ export default {
           <code-suggestions-statistics-card :total-value="totalValue" :usage-value="usageValue" />
           <code-suggestions-info-card :group-id="groupId" />
         </section>
-        <saas-add-on-eligible-user-list v-if="isSaaS" :add-on-purchase-id="addOnPurchase.id" />
-        <self-managed-add-on-eligible-user-list v-else :add-on-purchase-id="addOnPurchase.id" />
       </section>
       <error-alert
         v-else-if="addOnPurchaseFetchError"
diff --git a/ee/app/controllers/admin/code_suggestions_controller.rb b/ee/app/controllers/admin/code_suggestions_controller.rb
index ef166429631c..63a1f077fa07 100644
--- a/ee/app/controllers/admin/code_suggestions_controller.rb
+++ b/ee/app/controllers/admin/code_suggestions_controller.rb
@@ -19,7 +19,8 @@ def index
     private
 
     def ensure_feature_available!
-      render_404 unless !gitlab_com_subscription? && License.current&.paid? && code_suggestions_available?
+      return true
+      # render_404 unless !gitlab_com_subscription? && License.current&.paid? && code_suggestions_available?
     end
   end
 end
3. Reach `http://localhost:3000/admin/code_suggestions` and check the URL for `Add seats` button. It should be in `http://localhost:5000/gitlab/subscriptions/A-S00XXX/duo_pro_seats` format instead of `http://localhost:5000/gitlab/namespaces/A-S00XXX/duo_pro_seats`
Edited by Minahil Nichols

Merge request reports