Skip to content

Move year dropdown outside of each usage chart

Jose Ivan Vargas requested to merge jivanvl-move-dropdown-minutes-usage into master

What does this MR do and why?

This moves the year selection dropdown of the pipeline usage charts to the top, allowing to filter all of the charts with a single dropdown, this is behind the move_year_dropdown_usage_charts feature flag

#363046 (closed)

Screenshots or screen recordings

One year dropdown for all charts

Before After
Screenshot_2023-03-23_at_15.52.43 Screenshot_2023-03-23_at_15.53.42

How to set up and validate locally

  1. Start a rails console session, bundle exec rails console or bundle exec rails c
  2. Create a couple of CI/CD minutes usage entries, here's an example for January 2023 and February 2023
user = User.find(1)
project = Project.find(23) # Change this ID to whatever project ID you wish to use

monthly_usage = Ci::Minutes::ProjectMonthlyUsage.new(project_id: project.id, date: Date.new(2023, 01, 01), amount_used: 70, shared_runners_duration: 100)
monthly_usage.save
namespace_usage = Ci::Minutes::NamespaceMonthlyUsage.new(namespace_id: user.namespace.id, date: Date.new(2023, 01, 01), amount_used: 70, shared_runners_duration: 100)
namespace_usage.save

monthly_usage = Ci::Minutes::ProjectMonthlyUsage.new(project_id: project.id, date: Date.new(2023, 02, 01), amount_used: 120, shared_runners_duration: 150)
monthly_usage.save
namespace_usage = Ci::Minutes::NamespaceMonthlyUsage.new(namespace_id: user.namespace.id, date: Date.new(2023, 02, 01), amount_used: 120, shared_runners_duration: 150)
namespace_usage.save
  1. Enable the move_year_dropdown_usage_charts feature flag before closing the rails console session
Feature.enable(:move_year_dropdown_usage_charts)
  1. Close the rails console session by pressing Ctrl + D
  2. Login to your GDK and go to your user preferences -> Usage Quotas and check the graphs and play around with the dropdowns

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 Jose Ivan Vargas

Merge request reports