Skip to content

Add seat count usage alerts to group pages

Josianne Hyson requested to merge jh-seat_count_alerts into master

️ This MR was originally merged here: !79563 (merged) but had to be reverted due to this failing spec https://gitlab.com/gitlab-org/gitlab/-/jobs/2537486792.

This spec started failing after merge because, right before it was merged, another MR (!76686 (merged)) was merged that altered the spec data setup in that file. After those changes, the user in that spec file was no longer a member of the group so the controller was returning a 404.

The fix for this specifically is at this commit: !89204 (5320c103).


What does this MR do and why?

Addresses the final part of #348481 (closed).

Adds a hook to several of the common group controllers to show the seat count alert to group owners when they are approaching their purchased seat count.

What triggers the alert?

When a user is added that increases the number of Max seats used:

  • If Max seats used < Seats in subscription, trigger the alert based on the percentage of Seats currently in use / Seats in subscription per the table below
  • If Max seats used >= Seats in subscription, the alert should not be triggered.
Seats in subscription Notified at
0-15 No percentage, notify at 1 seat left
16-25 No percentage, notify at 2 seats left
26-99 10 %
100-999 8%
1000+ 5%

How to set up and validate locally

Have both Gitlab and the CustomersDot instance running. The GDK should be running with GITLAB_SIMULATE_SAAS=1

  1. Purchase a subscription for a group with three seats
  2. Enable the feature flag for the group
    • Feature.enable(:seat_count_alerts, group)
  3. Update the namespace statistics
    • UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker.new.perform
  4. View the group homepage - the alert should not be displayed
  5. Add a developer to the group
  6. Update the namespace statistics
    • UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker.new.perform
  7. View the group homepage - the alert should be displayed
  8. Click the close button on the alert and refresh the page - the alert should not be displayed

Screenshots or screen recordings

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 Josianne Hyson

Merge request reports

Loading