Skip to content

Limit storage banners to namespaces with project storage enforced

What does this MR do and why?

It limit the storage notifications to namespaces with project-level storage enforcement enabled.

Screenshots or screen recordings

project-level storage enforcement namespace-level storage enforcement
Screenshot_2022-12-16_at_18.16.54 Screenshot_2022-12-16_at_18.03.30

How to set up and validate locally

The namespace storage page have different views (that's being consolidated into one with #375651), to make sure you're always on the correct "cards" view apply this patch (e.g. copy the whole code then in terminal run pbpaste | git apply -):

diff --git a/ee/app/assets/javascripts/usage_quotas/storage/components/namespace_storage_app.vue b/ee/app/assets/javascripts/usage_quotas/storage/components/namespace_storage_app.vue
index 4df6d0636ab0..1846f39e6d54 100644
--- a/ee/app/assets/javascripts/usage_quotas/storage/components/namespace_storage_app.vue
+++ b/ee/app/assets/javascripts/usage_quotas/storage/components/namespace_storage_app.vue
@@ -216,7 +216,7 @@ export default {
       :additional-purchased-storage-size="namespace.additionalPurchasedStorageSize"
       :actual-repository-size-limit="namespace.actualRepositorySizeLimit"
     />
-    <div v-if="isAdditionalStorageFlagEnabled && storageStatistics">
+    <div v-if="storageStatistics">
       <storage-usage-statistics
         v-if="shouldUseNewStorageDesign"
         :storage-limit-enforced="storageLimitEnforced"
  1. Navigate to a namespace that has a project (where you're the owner of)
  2. From left sidebar go to: Settings > Usage Quotas > Storage tab

To have project-level storage enforcement enabled

  1. Disable namespace_storage_limit feature flag, in rails console run: Feature.disable(:namespace_storage_limit)
  2. Make sure ::Gitlab::CurrentSettings.automatic_purchased_storage_allocation? is false (in console run: ::Gitlab::CurrentSettings.update(automatic_purchased_storage_allocation: false))
  3. Ensure the notification is showing (above the cards)

To have namespace-level storage enforcement enabled

  1. Enable namespace_storage_limit feature flag, in rails console run: Feature.enable(:namespace_storage_limit)
  2. Make sure ::Gitlab::CurrentSettings.automatic_purchased_storage_allocation? is true (in console run: ::Gitlab::CurrentSettings.update(automatic_purchased_storage_allocation: true))
  3. Ensure the notification is not showing

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 #371963

Edited by Ammar Alakkad

Merge request reports