Replace namespace query with instance query to fetch purchase details

What does this MR do and why?

Replaces namespace query with instance query for addOnPurchase to get add-on purchase details on Code Suggestions tab on Usage Quotas page.

  • Injects and accepts an optional group ID property in code_suggestions_usage.vue to make the component generic for both SaaS and SM instances
  • Update response data structure to match the new query response
  • Add/update corresponding tests and mock data

Changelog not required as all changes are behind a feature flag.

Screenshots or screen recordings

No visual changes are introduced in this MR. Screenshots below are making sure that the existing functionality still works.

Scenario Screenshot
When add-on purchase exists

Screenshot 2023-12-07 at 2.55.35 PM.png

Screenshot 2023-12-07 at 2.56.07 PM.png

When no add-on purchase exists

Screenshot 2023-12-07 at 2.55.09 PM.png

Screenshot 2023-12-07 at 2.56.18 PM.png

How to set up and validate locally

Application setup

  1. Customers Dot needs to be setup in order to view the billing page for a group
  2. Start GDK in SaaS mode GITLAB_SIMULATE_SAAS=1 gdk start

Group setup

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

Feature flag

Run the following in your rails console

Feature.enable(:hamilton_seat_management, Namespace.find(your-group-id))

Add-on purchase

Purchase an add-on for the subscription purchased above in Group setup step by following the instructions here (under Add Code Suggestions Add-On to a subscription section).

Code Suggestions tab

  1. Visit /groups/<your-namespace-name>/-/usage_quotas#code-suggestions-usage-tab

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #432433

Edited by Vamsi Vempati

Merge request reports

Loading