Skip to content

Fixed empty tooltips in usage trends count charts

Rudy Crespo requested to merge 439704-fix-admin-usage-trends-chart into master

What does this MR do and why?

Fixes bug on the Usage trends page in which the tooltips in the Total projects & groups, Pipelines and Issues & Merge Requests charts were empty upon fetching paginated data. It also refactors the tests in usage_trends_count_chart_spec.js.

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

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screen Recording 2024-07-18 at 10.51.01 AM.mov Screen Recording 2024-07-18 at 10.50.13 AM.mov

How to set up and validate locally

  1. Please make sure that you're on the GitLab Ultimate plan.
  2. Apply the seed file patch below and run it: FILTER=usage_trends bundle exec rake db:seed_fu
  3. Navigate to the Usage trends page: http://${YOUR_LOCAL_INSTANCE}/admin/usage_trends
  4. Hover over the Total projects & groups, Pipelines and Issues & Merge Requests charts and verify that the tooltips are populated

Seed File Patch

diff --git a/db/fixtures/development/29_usage_trends.rb b/db/fixtures/development/29_usage_trends.rb
index f6496e5cd3dc..ff9642b5f65d 100644
--- a/db/fixtures/development/29_usage_trends.rb
+++ b/db/fixtures/development/29_usage_trends.rb
@@ -11,11 +11,11 @@
 
   # Skip generating data for billable_users, to avoid license check problems
   measurements = model_class.identifiers.except(:billable_users).each_value.flat_map do |id|
-    recorded_at = 60.days.ago
+    recorded_at = 400.days.ago
     current_count = rand(1_000_000)
 
     # Insert random counts for the last 60 days
-    Array.new(60) do
+    Array.new(400) do
       recorded_at = (recorded_at + 1.day).end_of_day - 5.minutes
 
       # Normally our counts should slowly increase as the gitlab instance grows.

Related to #439704 (closed)

Edited by Rudy Crespo

Merge request reports

Loading