Skip to content

Show a combined banner when exceeding both storage and user limits

Mohamed Hamda requested to merge combained-users-storage-banner into master

What does this MR do and why?

This MR closes: https://gitlab.com/gitlab-org/gitlab/-/issues/383578

In this MR/Issue:

We are creating a combined alert for free tier namespaces exceeding both storage and user limits.

Q/A:

  • Alert access level?
    • This alert shows to owners and non-owners
  • Dismisable?
    • Yes, every 14 days
  • Are we dismissing the other 2 standalone banners for user/storage alerts when showing this one?
  • Is it a featured flagged?
    • Yes, both user cap and storage limits are feature flagged
  • CTAs?
    • Yes, only to owners.

Screenshots or screen recordings

Owner

Group Screenshot_2023-05-12_at_12.57.25
SubGroup Screenshot_2023-05-12_at_12.58.31
Project Screenshot_2023-05-12_at_12.58.45

Non-owner

Group Screenshot_2023-05-12_at_12.59.05
SubGroup Screenshot_2023-05-12_at_12.59.16
Project Screenshot_2023-05-12_at_12.59.30

How to set up and validate locally

To validate this locally, you should be exceeding both storage and user limits.

A detailed guide for exceeding both storage and user limits:

Exceeding storage limits:
bin/rails c
# Enable feature flag:
::Feature.enable(:namespace_storage_limit_show_preenforcement_banner)

# ensuring we're not enforcing limits, which shows a different banner:
::Gitlab::CurrentSettings.update(enforce_namespace_storage_limit: false)

# Get a testing group
testing_group = Group.find(Group_ID)

# set a notification limit (I adjusted this to test different scenarios over/below/0):
testing_group.actual_limits.update(notification_limit: 100)

# setup testing_group to have a storage size greater than my notification limit
testing_group.root_storage_statistics.update(storage_size: 1024.megabytes) # or override `current_size` in `ee/app/models/namespaces/storage/root_size.rb`
Exceeding user limits:
bin/rails c

ApplicationSetting.first.update(dashboard_limit_enabled: false)
Feature.disable(:free_user_cap)
Feature.disable(:free_user_cap_new_namespaces)
  • Sign in as a free user. Create public groups and private projects inside.
  • Add 4+ members.
bin/rails c

ApplicationSetting.first.update(dashboard_limit_enabled: true, dashboard_limit: 3)
Feature.enable(:free_user_cap)
Feature.enable(:free_user_cap_new_namespaces)

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 Doug Stull

Merge request reports