Skip to content

Fix the month view on CI usage by minutes bar chart

What does this MR do and why?

It adds the year along with the month in the dropdown of monthly CI usage quota bar chart. Previously it was showing only month which was causing a confusion when the chart range covers multiple years (with same month).

It makes use of existing formatDate method used in the monthly minutes usage chart page to show the year along with the month for the respective data. Internally the dropdown would be using the monthIso8601 property for mapping the proper values.

Screenshots or screen recordings

image

How to set up and validate locally

  1. Create a new projected under root user.
  2. Run the below script with the created project ID.
[[2021, 4, 1], [2021, 6, 1], [2021, 8, 1], [2021, 10, 1], [2021, 12, 1], [2022, 1, 1],[2022, 2, 1],[2022, 4, 1],[2022, 6, 1],[2022, 8, 1]].each.with_index(1) do |n, i|
  begin
    namespace_usage = Ci::Minutes::ProjectMonthlyUsage.new(project_id: <new project id>, date: Date.new(*n), amount_used: i*2)
    namespace_usage.save
  rescue ActiveRecord::RecordNotUnique
  end
end
  1. Go to preferences -> Usage quota and check the second bar chart.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #353088 (closed)

Edited by Simon Knox

Merge request reports