Skip to content

Add ability to manage Code Suggestions seats on SM instance

What does this MR do and why?

Add ability to manage Code Suggestions seats on SM instance

  • Reuses existing components to implement SM version
    • Comes with pagination, search, loading state and error handling
  • Also displays an introductory text with Contact Sales CTA when no add-on purchase exists

No changelog required, all changes behind feature flag.

Related to #432434

Screenshots or screen recordings

Code Suggestions add-on purchase exists for a paid plan

Scenario Screenshot

SM Code Suggestions Seat Management

  • Display eligible user list
  • Pagination
  • Search
  • Assignment change
  • No seats available error
Screen recording

Screen Recording 2023-12-15 at 8.35.18 AM.mov

No search results
Screenshot

Screenshot_2023-12-15_at_8.36.18_AM

Min character count requirement for search
Screenshot

Screenshot_2023-12-15_at_8.36.25_AM

Loading state
Screenshot

Screenshot_2023-12-15_at_8.39.01_AM

Error assigning seat
Screenshot

Screenshot_2023-12-15_at_8.41.43_AM

Error un-assigning seat
Screenshot

Screenshot_2023-12-15_at_8.41.32_AM

No Code Suggestions add-on purchase exists for a paid plan

Scenario Screenshot
Introductory text with CTA to contact sales
Screen recording

Screen Recording 2023-12-15 at 8.42.59 AM.mov

SaaS - no change

Scenario Screenshot
Displays add-on list for SaaS as before
Screenshot

Screenshot 2023-12-15 at 7.51.43 AM.png

How to set up and validate locally

Application setup

  1. Customers Dot needs to be setup
  2. Start GDK in SM mode GITLAB_SIMULATE_SAAS=0 gdk start

Feature flag

Run the following in your rails console using GITLAB_SIMULATE_SAAS=0 rails c

Feature.enable(:self_managed_code_suggestions)

Subscription setup

  1. Buy Self-Managed Ultimate 1 Year subscription on Zuora Sandbox
  2. Copy the license key from the subscription details page on local Customers Dot instance
  3. Paste the license key on your SM instance at Admin Area > Settings > General > Add license
  4. Refresh the page to see the Code Suggestions Menu item appear under Admin Area

Add-on purchase

Purchase add-on seats by running the following on rails console GITLAB_SIMULATE_SAAS=0 rails c

# create an add_on record if not already created
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
# create add_on_purchase record without the namespace, mimicking SM instance
add_on_purchase = GitlabSubscriptions::AddOnPurchase.create!(add_on: add_on, expires_on: 1.year.from_now, quantity: 10, purchase_xid: 'A-12345')

Code Suggestions menu item

  1. Log in to the SM instance as an admin, eg. root
  2. Visit Code Suggestions Seat management page by clicking on Code Suggestions menu item under Admin Area

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