Skip to content

Show storage pre-enforcement banner only to impacted namespaces

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/367531

This show's the banner only to affected namespaces, i.e. the namespace has 5+ GB of storage

Screenshots or screen recordings

There are no UI changes, so putting just the banner for reference

(Obs: some images show usage below 5GB because I didn't mock the data in my GDK in all scenarios)

User accessing their own namespace preenforcement_banner_user_namespace
User as a project maintainer on other user's namespace preenforcement_banner_project_user_namespace
Subgroup preenforcement_banner_subgroup
Project preenforcement_banner_project
Root Group preenforcement_banner_root_namespace

How to set up and validate locally

  1. Create a new Group, take note of the Group ID (e.g. 123)
  2. Make sure the banner does NOT show on this group's page
  3. Add namespace storage that reaches the limit
     n = Group.find(166)
     n.root_storage_statistics&.destroy!
     s = Namespace::RootStorageStatistics.new(
       namespace: n,
       build_artifacts_size: 0,
       wiki_size: 0,
       repository_size: 0,
       packages_size: 0,
       lfs_objects_size: 5.gigabytes
     )
     s.storage_size = s.repository_size + s.lfs_objects_size + s.wiki_size + s.build_artifacts_size + s.packages_size
     s.save!
  4. Make sure the banner appears

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 Sheldon Led

Merge request reports