Skip to content

Show Add seats button on admin code suggestions page

Diana Zubova requested to merge dz/8286-add-helper-for-sm-duo-pro into master

What does this MR do and why?

Add Add seats button to Duo Pro info card on Admin page

Related to https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/8286

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

Screenshot_2024-01-26_at_11.27.18

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_usage.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
index fa1b73462817..04982174c07f 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
@@ -24,7 +24,7 @@ export default {
   inject: { isSaaS: {}, groupId: { default: null } },
   data() {
     return {
-      addOnPurchase: undefined,
+      addOnPurchase: { purchasedQuantity: 2, usedQuantity: 3 },
     };
   },
   computed: {
@@ -59,6 +59,9 @@ export default {
       update({ addOnPurchase }) {
         return addOnPurchase;
       },
+      skip() {
+        return true;
+      },
       error(error) {
         this.reportError(error);
       },
diff --git a/ee/app/controllers/admin/code_suggestions_controller.rb b/ee/app/controllers/admin/code_suggestions_controller.rb
index a801673cf5eb..dcb9f759da18 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_sm? && License.current&.paid? && code_suggestions_available?
+      true
+      # render_404 unless gitlab_sm? && 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/namespaces/A-S00XXX/duo_pro_seats` format
Edited by Diana Zubova

Merge request reports