diff --git a/frontend/providers/costcenter/src/components/table/PriceTable.tsx b/frontend/providers/costcenter/src/components/table/PriceTable.tsx index af2a541ea35..cbae2dc6277 100644 --- a/frontend/providers/costcenter/src/components/table/PriceTable.tsx +++ b/frontend/providers/costcenter/src/components/table/PriceTable.tsx @@ -15,6 +15,7 @@ export type PricePayload = { price: number; title: string; unit: string; + isGpu: boolean; icon: typeof Img; }; export function PriceTable({ data }: { data: PricePayload[] }) { diff --git a/frontend/providers/costcenter/src/components/valuation/PriceTablePanel.tsx b/frontend/providers/costcenter/src/components/valuation/PriceTablePanel.tsx index f834077d1b0..041ace5a4d6 100644 --- a/frontend/providers/costcenter/src/components/valuation/PriceTablePanel.tsx +++ b/frontend/providers/costcenter/src/components/valuation/PriceTablePanel.tsx @@ -9,7 +9,7 @@ export function PriceTablePanel({ priceData }: { priceData: PricePayload[] }) { const gpuEnabled = useEnvStore((state) => state.gpuEnabled); const baseData = priceData.filter((x) => x.title !== 'network' && !x.title.startsWith('gpu-')); const networkData = priceData.filter((x) => x.title === 'network'); - const gpuData = priceData.filter((x) => x.title.startsWith('gpu-')); + const gpuData = priceData.filter((x) => x.isGpu); return ( diff --git a/frontend/providers/costcenter/src/pages/valuation/index.tsx b/frontend/providers/costcenter/src/pages/valuation/index.tsx index e4798028443..a1b71aa1d1b 100644 --- a/frontend/providers/costcenter/src/pages/valuation/index.tsx +++ b/frontend/providers/costcenter/src/pages/valuation/index.tsx @@ -26,6 +26,7 @@ type CardItem = { unit: string; idx: number; // used to sort icon: typeof Img; + isGpu: boolean; }; // 1 ,24, export const PRICE_CYCLE_SCALE = [1, 24, 168, 720, 8760]; @@ -57,6 +58,7 @@ function Valuation() { props = gpuprops; } let icon: typeof Img; + let isGpu = x.name.startsWith('gpu-'); let title = x.name; let unit = [t(props.unit), t(CYCLE[cycleIdx])].join('/'); if (x.name === 'cpu') icon = CpuIcon; @@ -69,18 +71,18 @@ function Valuation() { icon = PortIcon; title = 'Port'; } else if (x.name.startsWith('gpu-')) { - // const reg = /nvidia/g icon = NvidiaIcon; + x.alias && (title = x.alias); } else return []; const price = (x.unit_price || 0) * (props.scale || 1); - console.log(x.name, x.unit_price, price); return [ { title, price, unit, idx: props.idx, - icon + icon, + isGpu } ]; }) @@ -113,8 +115,6 @@ function Valuation() { 、