Skip to content

Update UI for Duo Pro trial errors

Roy Liu requested to merge 451023-fix-ui-for-duo-pro-trial-errors into master

What does this MR do and why?

Related to #451023

Update the error alert and add the support link to it when the error is from CusomtersDot, when applying trials.

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

Updated error alert Updated error alert on lead form
Screenshot_2024-04-15_at_4.31.23_PM Screenshot_2024-04-16_at_2.36.55_PM

How to set up and validate locally

  1. Setup GDK to simulate SaaS
  2. Apply the following patch to avoid setting up CustomersDot
Click to expand
diff --git a/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb b/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb
index 82a11fd24e6d..e4d5c10fa4ca 100644
--- a/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb
+++ b/ee/app/controllers/subscriptions/trials/duo_pro_controller.rb
@@ -35,29 +35,11 @@ def create
           step: params[:step], lead_params: lead_params, trial_params: trial_params, user: current_user
         ).execute
 
-        if @result.success?
-          # lead and trial created
-          flash[:success] = success_flash_message
-
-          redirect_to group_usage_quotas_path(@result.payload[:namespace], anchor: 'code-suggestions-usage-tab')
-        elsif @result.reason == GitlabSubscriptions::Trials::CreateDuoProService::NO_SINGLE_NAMESPACE
-          # lead created, but we now need to select namespace and then apply a trial
-          redirect_to new_trials_duo_pro_path(@result.payload[:trial_selection_params])
-        elsif @result.reason == GitlabSubscriptions::Trials::CreateDuoProService::NOT_FOUND
-          # namespace not found/not permitted to create
-          render_404
-        elsif @result.reason == GitlabSubscriptions::Trials::CreateDuoProService::LEAD_FAILED
-          render :step_lead_failed
-        elsif @result.reason == GitlabSubscriptions::Trials::CreateDuoProService::NAMESPACE_CREATE_FAILED
-          # namespace creation failed
-          params[:namespace_id] = @result.payload[:namespace_id]
-
-          render :step_namespace_failed
-        else
-          # trial creation failed
-          params[:namespace_id] = @result.payload[:namespace_id]
+        if @result.reason == GitlabSubscriptions::Trials::ApplyTrialService::GENERIC_TRIAL_ERROR
 
           render :trial_failed
+        else
+          redirect_to new_trials_duo_pro_path(step: GitlabSubscriptions::Trials::CreateDuoProService::TRIAL)
         end
       end
 
  1. Go to /-/trials/duo_pro/new, submit the lead form, you should see the group select form next
  2. Submit the group select form, you should see the error alert.
  3. To view the alert on lead form page, restore the patch and submit lead form again.
Edited by Roy Liu

Merge request reports