Skip to content

Add Intro section to Code Suggestions Tab

Angelo Gulina requested to merge ag/422629-no-purchase-code-sugg into master

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/422629. With this MR we are introducing an empty state for the Code Suggestions tab, for when there is no purchased Add-on. Other states will be introduced with follow-up work. Note that the empty state is missing an illustration. It will be added with: https://gitlab.com/gitlab-org/gitlab/-/issues/423350

This MR also refactors a bit of code to make the location of some files consistent with the new tab approach.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Condition Expectation Screenshot
In SM Mode
No tab should appear
Screenshot Screenshot_2023-08-31_at_20.31.58
In SaaS mode
-- With Feature flag disabled for group
No tab should appear
ScreenshotScreenshot_2023-08-31_at_20.11.55
-- With Feature flag enabled for group
---- With no purchased add-on data
Shows empty state
ScreenshotScreenshot_2023-08-31_at_20.11.36
---- With purchased add-on data
Shows nothing
Screenshot Screenshot_2023-08-31_at_20.19.09
---- With an error in the add-on data request
Shows empty state
Screenshot Screenshot_2023-08-31_at_20.15.03

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

In your rails console:

  1. Customers Dot needs to be setup in order to view the billing page for a group
Feature.enable(:enable_hamilton_in_usage_quotas_ui, Namespace.find(your-group-id)

Group with subscription

  1. Create a Group
  2. Buy a Subscription for your group from Settings > Billing

Purchase Add-on

Run the following in Rails console:

  1. Find the namespace
namespace = Namespace.find(your-group-id)
  1. Create an Addon
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
  1. Create an add-on purchase
GitlabSubscriptions::AddOnPurchase.create!(add_on: add_on, namespace: namespace, expires_on: 1.month.from_now, quantity: 20, purchase_xid: 'A-S0001')

SaaS mode

  1. Start GDK in SaaS mode GITLAB_SIMULATE_SAAS=1 gdk start

SM mode

  • Start GDK in SM mode GITLAB_SIMULATE_SAAS=0 gdk start

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 Angelo Gulina

Merge request reports