diff --git a/internal/site/src/components/routes/system/charts/gpu-charts.tsx b/internal/site/src/components/routes/system/charts/gpu-charts.tsx index fe591cf96..4f05f51ab 100644 --- a/internal/site/src/components/routes/system/charts/gpu-charts.tsx +++ b/internal/site/src/components/routes/system/charts/gpu-charts.tsx @@ -3,7 +3,7 @@ import { Fragment, type ReactNode, useRef, useMemo } from "react" import AreaChartDefault, { type DataPoint } from "@/components/charts/area-chart" import LineChartDefault from "@/components/charts/line-chart" import { Unit } from "@/lib/enums" -import { cn, decimalString, formatBytes, toFixedFloat } from "@/lib/utils" +import { decimalString, formatBytes, toFixedFloat } from "@/lib/utils" import type { ChartData, GPUData, SystemStatsRecord } from "@/types" import { ChartCard } from "../chart-card" @@ -79,7 +79,6 @@ export function GpuPowerChart({ return ( - {children} - {hasGpuEnginesData && ( - - - - )} - {Object.keys(lastGpus).map((id) => { - const gpu = lastGpus[id] as GPUData - return ( - +
+ {(children || hasGpuEnginesData) && ( +
+ {children} + {hasGpuEnginesData && ( - stats?.g?.[id]?.u ?? 0, - color: 1, - opacity: 0.35, - }, - ]} - tickFormatter={(val) => `${toFixedFloat(val, 2)}%`} - contentFormatter={({ value }) => `${decimalString(value)}%`} - /> + + )} +
+ )} + {gpuIds.length > 0 && ( +
+ {gpuIds.map((id) => { + const gpu = lastGpus[id] as GPUData + return ( + + + stats?.g?.[id]?.u ?? 0, + color: 1, + opacity: 0.35, + }, + ]} + tickFormatter={(val) => `${toFixedFloat(val, 2)}%`} + contentFormatter={({ value }) => `${decimalString(value)}%`} + /> + - {(gpu.mt ?? 0) > 0 && ( - - stats?.g?.[id]?.mu ?? 0, - color: 2, - opacity: 0.25, - }, - ]} - max={gpu.mt} - tickFormatter={(val) => { - const { value, unit } = formatBytes(val, false, Unit.Bytes, true) - return `${toFixedFloat(value, value >= 10 ? 0 : 1)} ${unit}` - }} - contentFormatter={({ value }) => { - const { value: convertedValue, unit } = formatBytes(value, false, Unit.Bytes, true) - return `${decimalString(convertedValue)} ${unit}` - }} - /> - - )} - - ) - })} + {(gpu.mt ?? 0) > 0 && ( + + stats?.g?.[id]?.mu ?? 0, + color: 2, + opacity: 0.25, + }, + ]} + max={gpu.mt} + tickFormatter={(val) => { + const { value, unit } = formatBytes(val, false, Unit.Bytes, true) + return `${toFixedFloat(value, value >= 10 ? 0 : 1)} ${unit}` + }} + contentFormatter={({ value }) => { + const { value: convertedValue, unit } = formatBytes(value, false, Unit.Bytes, true) + return `${decimalString(convertedValue)} ${unit}` + }} + /> + + )} + + ) + })} +
+ )}
) }