Skip to content

Add Code Suggestions related cards

Angelo Gulina requested to merge ag/421966-code-suggestions-cards into master

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/421966. This MR introduces two Cards in the Code Suggestions Tab:

  1. CodeSuggestionsUsageStatisticsCard, this is refactored from a previous implementation. The UX has changed (see decision here). Also, the copy differs from the designs based on this requirement
  2. CodeSuggestionsInfoCard, this is a new card, showing some info. Subscription info will be added with https://gitlab.com/gitlab-org/gitlab/-/issues/422789

Screenshots or screen recordings

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

Scenario Screenshot
Purchased add-on state Screenshot_2023-09-11_at_1.02.11_PM
Loading state Screenshot_2023-09-11_at_1.01.38_PM

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')
  1. Assign the add-on purchase
GitlabSubscriptions::AddOnPurchase.first.assigned_users.create!(user: namespace.users.first)

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 Vamsi Vempati

Merge request reports

Loading