Skip to content

Hide storage limits copy when limit is 0

Sheldon Led requested to merge led/425109-fix-copy-storage-included-in-plan into master

What does this MR do and why?

This hides confusing copy when there's no limits applied. Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/425109

Screenshots or screen recordings

Self-Managed
Before After
133016_self-managed_before 133016_self-managed_after
SaaS with Project Limits
Before After
133016_saas_project-limits_before 133016_saas_projectAndNamespace-limits_after
SaaS with Namespace Limits
Before After
133016_saas_namespace-limits_before 133016_saas_projectAndNamespace-limits_after

How to set up and validate locally

The UI changed is accessed by https://gdk.test:3443/groups/<my-group>/-/usage_quotas#storage-quota-tab

  • Replace my-group with your group id 😉

Reproducing steps for a group in a Self-Managed instance

Click to expand
  1. Make sure you're NOT simulating SaaS in your GDK
  2. Access your Group Usage Quotas Page
  3. Make sure that the message is not appearing (This namespace has 0 B of storage. How are limits applied?)

Reproducing steps for a group in Project Storage Limits

Click to expand
  1. Make sure you ARE simulating SaaS in your GDK
  2. In rails console, add a repository size limit:
    1. Gitlab::CurrentSettings.update!(repository_size_limit: 10.gigabytes)
  3. Go back to the browser and check the Usage Quotas page:
    1. Note the texts:
      1. Projects under this namespace have 10.0 GiB of storage. How are limits applied?
      2. Inside the left-hand side card: 10.0 GiB Storage per project included in Free subscription
  4. In rails console, remove the repository size limit:
    1. Gitlab::CurrentSettings.update!(repository_size_limit: 0)
  5. Go back to the browser and make sure the 2 texts disappeared.

Reproducing steps for a group in Namespace Storage Limits

Click to expand
  1. Make sure you ARE simulating SaaS in your GDK
  2. Enable the setting that tells your GitLab instance that it has the purchase storage feature
    1. Gitlab::CurrentSettings.update!(automatic_purchased_storage_allocation: true)
  3. Enable the setting that tells your GitLab instance that it is enforcing namespace limits
    1. Gitlab::CurrentSettings.update!(enforce_namespace_storage_limit: true)
  4. Enable the namespace limits for your group (replace the command below by your group id)
    1. Feature.enable(:namespace_storage_limit, Group.find(89))
  5. Add a limit to the Free Plan:
    1. Plan.free.actual_limits.update!(storage_size_limit: 5 * 1024)
  6. Go back to the browser and check the Usage Quotas page. Note the text:
    1. This namespace has 5.0 GiB of storage. How are limits applied?
  7. Remove the plan limit:
    1. Plan.free.actual_limits.update!(storage_size_limit: 0)
  8. Go back to the browser and note that the text disappeared:
    1. Also, the cards displayed are now the same as the Project Limits cards.

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