Add stat display type to GLQL
What does this MR do and why?
Adds a stat display type to GLQL, which renders a single aggregated metric as a large value — the second of the SDLC dashboard visualization types.
- New
StatPresenter(stat.vue) renders@gitlab/ui'sGlSingleStatwith an empty title , so the presenter shows only the value. The title and subtitle (e.g. the time range) are owned by the surrounding container — the dashboard panel or GLQL embed — mirroring the analytics dashboard's existingsingle_stat.vuevisualization. - Validation: the query must have exactly 1 metric and 0 dimensions; otherwise the presenter emits an error (same pattern as the chart presenters).
- Value formatting reuses the chart unit registry (
formatterFor), so counts (1,234), rates (73.5%), and durations render consistently across visualizations. A metric with no registered unit renders its raw value; the fix for a new metric is a one-line registry entry that benefits charts and stats alike.
Bonus:
- I've noticed we are still showing the item count in the CRUD container with mode analytics ( pretty sure we removed it at some point, but we must have accidentally revert it ), so hiding it again here.
Intentionally out of scope (per the issue):
- Trend % change indicator — tracked in #592912 (moved) (
showTrends). It maps ontoGlSingleStat'smeta-text/meta-iconwhen it lands. - Title icon — owned by the container alongside the title.
Screenshots or screen recordings
| Query | Output |
|---|---|
|
|
|
|
|
|
How to set up and validate locally
Render a GLQL block with display: stat and a single metric, e.g.:
```glql
mode: analytics
query: type = codesuggestion and group = "gitlab-duo"
metrics: totalCount
display: stat
```References
- Resolves glql#106 (closed)
Edited by Daniele Rossetti


