Add compact option to the GLQL stat display type

What does this MR do and why?

Adds a compact: true option to the GLQL stat display type's displayConfig. Large aggregates such as credit totals currently render as seven-digit numbers; the DAP Impact dashboard designs show them as 1.45M.

Compact formatting is unit-aware via a new compactValueFormatterFor: counts and credits gain the compact suffix, rates and durations keep their unit's own short format. A non-boolean compact is rejected as a display config error, consistent with how variant is validated.

References

Needed for the DAP Impact Spend tab: https://gitlab.com/groups/gitlab-org/-/work_items/23470

Screenshots or screen recordings

Seeded GDK dashboard, compact stats with the existing trend badge:

mr_stat_compact

How to set up and validate locally

Add to any GLQL stat block:

displayConfig:
  compact: true

Or run the specs:

yarn jest spec/frontend/glql/components/presenters/stat_spec.js
Edited by Abhinaba Ghosh

Merge request reports

Loading
Loading