fix(usage): label instance_type trend series by product name

The grouped-trend legend used the raw group key, which for instance_type is
the flavor slug (e.g. gpustack--generic-ln-x64-40c-160g--nvidia-a100-80g-4d).
Prefer the enriched product name so the chart legend matches the GPU Instances
list (#5700); falls back to the slug for legacy rows without dimension data.
This commit is contained in:
michelia
2026-06-27 22:27:42 +08:00
committed by jialin
parent abe705c034
commit 1a6d1654b2
3 changed files with 93 additions and 0 deletions
+7
View File
@@ -321,6 +321,13 @@ function flattenItem(
if (dims.storage_type) flat.storage_type = dims.storage_type;
if (dims.capacity_mib != null) flat.capacity_mib = dims.capacity_mib;
}
// For an instance_type grouped trend the series label (``group``) defaults to
// the raw flavor slug; prefer the pretty product name so the chart legend
// matches the GPU Instances list (#5700). Falls back to the slug for legacy
// rows that predate dimension enrichment.
if (groupBy === 'instance_type' && flat.product) {
flat.group = flat.product;
}
return flat;
}