Add Code Suggestions related cards
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:
-
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 -
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 | |
Loading state |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
In your rails console:
- 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
- Create a Group
- Buy a Subscription for your group from
Settings
>Billing
Purchase Add-on
Run the following in Rails console:
- Find the namespace
namespace = Namespace.find(your-group-id)
- Create an Addon
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
- 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')
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vamsi Vempati