Skip to content

Create StorageUsageStatistics in CE

Sheldon Led requested to merge led/371824-move-storage-usage-overview-to-ce into master

What does this MR do and why?

This is the second of a series of MRs that aim to migrate the Namespace Storage Vue App to CE so that this view is available for all GitLab Editions and Distributions. Related to: Move storage app to CE (#371824 - closed)

Here we're moving/creating StorageUsageStatistics in CE, while we move code that's 100% CE to /app, and create overrides in EE whenever necessary:

  • Create StorageUsageStatistics in /app
    • StorageUsageOverviewCard is used here, so we need to move it to /app too.
  • Add StorageUsageStatistics to be rendered using ee_else_ce strategy
  • Adjusts the tests in ee/spec/frontend/usage_quotas/storage/
  • Some tests that should be migrated to spec/frontend/usage_quotas/storage/ will be done in a separate MR because this MR is already big
  • Because this is a transitional state, the EE NamespaceStorageApp loads the CE NamespaceStorageApp and passes all the data down via props, and whenever necessary we emit events up so the logic is handled in the parent app. This will be removed in !139568 (merged)

MR Cadence

Description MR
Introduce NamespaceStorageApp in core !138689 (merged)
Create StorageUsageStatistics in CE 👈 you're here
Move DependencyProxyUsage to CE !139248 (merged)
Move ContainerRegistryUsage to CE !139252 (merged)
Move Usage Quotas test fixtures to CE !142067 (merged)
Move SearchAndSortBar to CE !139434 (merged)
Move ProjectList to CE !139449 (merged)
Finish moving NamespaceStorageApp to CE !139568 (merged)
Replace placeholder with NamespaceStorageApp !140209 (closed)

Previous MRs:

Description MR
Move :read_usage_quotas policy to Core app !103021 (merged)
Create Usage Quotas route/controller/view in Core !102906 (merged)
Add menu entry on sidebar !106083 (merged)
Create usage quotas Vue app !107359 (merged)
Reorganize Backend code for storage tab !109806 (merged)

Screenshots or screen recordings

All the changes here are behind a Feature Flag: usage_quotas_for_all_editions, so there should be no UI or behavior change for now.

How to set up and validate locally

We need to validate this in 4 scenarios:

  1. GitLab EE Unlicensed: this is probably how your GDK is right now. If you have a license in your GDK, remove it in https://gdk.test:3443/admin/subscription
  2. GitLab EE: by having a test license in your GDK.
  3. GitLab SaaS: setup a license like the above and simulate SaaS
  4. GitLab CE: by executing
    1. export FOSS_ONLY=1
    2. gdk restart
    3. Tanuki gdk website icon (the one in the browser tab) should be blue, then you're in CE

Now go to any Group Usage Quotas: https://gdk.test:3443/groups/flightjs/-/usage_quotas and check if your local setup matches the expected behavior.

  • To enable the FF: Feature.enable(:usage_quotas_for_all_editions)
  • To disable the FF: Feature.disable(:usage_quotas_for_all_editions)

Expected behavior:

  • Expected behavior with Feature Flag on: Page loads a placeholder (storage_app_placeholder) for all the scenarios.
GitLab Distribution Expected behavior FF off
GitLab EE Unlicensed Renders a 404 page
GitLab EE Loads the page normally, hiding SaaS UI (e.g. the right hand side card in Namespace overview)
GitLab SaaS Page loads normally, like it is on master/GitLab.com
GitLab CE Renders a 404 page

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