Skip to content

Make Profile Usage Quotas use the new Usage Quotas Layout App

Sheldon Led requested to merge led/440192-use-uq-layout-app-in-profile-view into master

What does this MR do and why?

The Profile Usage Quotas currently shows the pipelines and storage tabs for projects under a User Namespace.

Profile Usage Quotas: https://gitlab.com/-/profile/usage_quotas

This MR accounts for making Profile Usage Quotas use the new Usage Quotas Layout App.

Implements Make Profile Usage Quotas use the new Usage Quo... (#440192 - closed)

MR Cadence

header header
!145638 (merged) Refactor Storage and Pipelines tabs initiation files
!145643 (merged) Switch tab based on URL hash
!145647 (merged) 👈 you're here

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

There should be no UI changes:

Pipelines Tab Storage Tab
440192_pipelines_tab 440192_storage_tab

How to set up and validate locally

  1. Checkout this MR's branch led/440192-use-uq-layout-app-in-profile-view
  2. Visit: https://gdk.test:3443/-/profile/usage_quotas
  3. Make sure the page loads as expected

Generate some data

Take a look at the script below, modify as needed, and execute in rails console:

Click to expand
# Pipelines

n = User.find_by(username: 'sheldonled').namespace
p1 = n.projects.first
p2 = n.projects.second

## ------- Namespace's data ------------

Ci::Minutes::NamespaceMonthlyUsage.new(namespace_id: n.id, date: Date.new(2024, 1, 01), amount_used: 300, shared_runners_duration: 20).save
Ci::Minutes::NamespaceMonthlyUsage.new(namespace_id: n.id, date: Date.new(2024, 2, 01), amount_used: 500, shared_runners_duration: 150).save

# To Update
# Ci::Minutes::NamespaceMonthlyUsage.where(namespace_id: n.id, date: Date.new(2024, 1, 01)).update(amount_used: 300, shared_runners_duration: 20)
# Ci::Minutes::NamespaceMonthlyUsage.where(namespace_id: n.id, date: Date.new(2024, 2, 01)).update(amount_used: 200, shared_runners_duration: 150)


## ------- Projects' data ------------


Ci::Minutes::ProjectMonthlyUsage.new(project_id: p1.id, date: Date.new(2024, 1, 01), amount_used: 100, shared_runners_duration: 5).save
Ci::Minutes::ProjectMonthlyUsage.new(project_id: p2.id, date: Date.new(2024, 1, 01), amount_used: 200, shared_runners_duration: 15).save

Ci::Minutes::ProjectMonthlyUsage.new(project_id: p1.id, date: Date.new(2024, 2, 01), amount_used: 300, shared_runners_duration: 80).save
Ci::Minutes::ProjectMonthlyUsage.new(project_id: p2.id, date: Date.new(2024, 2, 01), amount_used: 200, shared_runners_duration: 70).save

# To Update
# Ci::Minutes::ProjectMonthlyUsage.where(project_id: p1.id, date: Date.new(2024, 1, 01)).update(amount_used: 100, shared_runners_duration: 5)
# Ci::Minutes::ProjectMonthlyUsage.where(project_id: p2.id, date: Date.new(2024, 1, 01)).update(amount_used: 200, shared_runners_duration: 15)

# Ci::Minutes::ProjectMonthlyUsage.where(project_id: p1.id, date: Date.new(2024, 2, 01)).update(amount_used: 80, shared_runners_duration: 80)
# Ci::Minutes::ProjectMonthlyUsage.where(project_id: p2.id, date: Date.new(2024, 2, 01)).update(amount_used: 20, shared_runners_duration: 70)

# Storage

n = User.find_by(username: 'sheldonled').namespace
p1 = n.projects.first
p2 = n.projects.second

p1.statistics.update(repository_size: 8.gigabytes)
p2.statistics.update(repository_size: 6.gigabytes)

Sidekiq.redis(&:flushdb)
Namespaces::ScheduleAggregationWorker.perform_sync(n.id)
Namespaces::RootStatisticsWorker.perform_sync(n.id)
Edited by Sheldon Led

Merge request reports