From 8f85e9a082392841c505233badb1ce43f81e447f Mon Sep 17 00:00:00 2001 From: michelia Date: Fri, 26 Jun 2026 19:11:03 +0800 Subject: [PATCH] fix(usage): use frontend gpu_type token for instance-type legend flattenItem receives the unmapped frontend dimension; the instance-type grouping is 'gpu_type' (mapped to backend 'instance_type' via GROUP_BY_MAP), so the previous 'instance_type' check never matched and the trend legend kept showing the raw flavor slug. Check 'gpu_type'. (PR #1240 review) --- src/pages/usage/apis/resource.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/usage/apis/resource.ts b/src/pages/usage/apis/resource.ts index 67faf1cf..24cc251a 100644 --- a/src/pages/usage/apis/resource.ts +++ b/src/pages/usage/apis/resource.ts @@ -321,11 +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 + // 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) { + // matches the GPU Instances list (#5700). ``groupBy`` here is the unmapped + // frontend dimension — ``gpu_type`` maps to the backend's ``instance_type`` + // (see GROUP_BY_MAP). Falls back to the slug for legacy rows that predate + // dimension enrichment. + if (groupBy === 'gpu_type' && flat.product) { flat.group = flat.product; } return flat;