Change group usage quota UX to follow user namespace
What does this MR do and why?
- Aligns group namespace UX with personal namespace UX for usage quotas
- Removes shared runner usage tab for main tabs on usage quotas view
- Adds shared runner usage by project to the graph
Related to: #360805 (closed) and #355666 (closed)
Screenshots or screen recordings
before | after |
---|---|
![]() |
![]() |
Screen Recording
How to set up and validate locally
Visit Group > Settings > Usage Quotas
Ensure the group namespace and projects have used CI/CD minutes / Shared Runners to expose data in the graphs.
Edit CI minutes
ApplicationSetting.current.update(shared_runners_minutes: 400)
project = Project.find(20)
root_namespace = project.root_namespace
namespace_usage = Ci::Minutes::NamespaceMonthlyUsage.find_or_create_current(namespace_id: root_namespace)
Ci::Minutes::NamespaceMonthlyUsage.update_counters(namespace_usage, amount_used: 100, shared_runners_duration: 100)
project_usage = Ci::Minutes::ProjectMonthlyUsage.find_or_create_current(project_id: project)
Ci::Minutes::ProjectMonthlyUsage.update_counters(project_usage, amount_used: 100, shared_runners_duration: 100)
Helper method (add to rails console)
def increase_ci_usage(project:, date:, amount_used:, shared_runners_duration:)
date = date.utc.beginning_of_month
project_usage = Ci::Minutes::ProjectMonthlyUsage.where(date: date).safe_find_or_create_by(project_id: project.id)
Ci::Minutes::ProjectMonthlyUsage.update_counters(project_usage, amount_used: amount_used, shared_runners_duration: shared_runners_duration)
root_namespace = project.root_namespace
namespace_usage = Ci::Minutes::NamespaceMonthlyUsage.where(date: date).safe_find_or_create_by(namespace_id: root_namespace.id)
Ci::Minutes::NamespaceMonthlyUsage.update_counters(namespace_usage, amount_used: amount_used, shared_runners_duration: shared_runners_duration)
end
Use helper method
increase_ci_usage(project: project, date: 1.month.ago, amount_used: 10, shared_runners_duration: 20)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Payton Burdette