From 50dc7bb6bade3b0fea13006dad03cd358e1ebaa5 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:05:19 -0500 Subject: [PATCH] improve display of gpu graphs in system metrics --- web/src/views/system/GeneralMetrics.tsx | 39 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/web/src/views/system/GeneralMetrics.tsx b/web/src/views/system/GeneralMetrics.tsx index 4cba965298..1a7767ffb5 100644 --- a/web/src/views/system/GeneralMetrics.tsx +++ b/web/src/views/system/GeneralMetrics.tsx @@ -540,6 +540,36 @@ export default function GeneralMetrics({ return Object.keys(series).length > 0 ? Object.values(series) : undefined; }, [statsHistory]); + // Number of cards the hardware grid renders. Which ones appear depends on + // the vendor, so the column count follows the count rather than assuming a + // fixed set is present. + const hardwareCardCount = useMemo(() => { + if (!statsHistory[0]?.gpu_usages) { + return 0; + } + + const hasNpu = statsHistory[0].npu_usages != undefined; + + return ( + 1 + // gpu usage always renders alongside gpu_usages + (gpuMemSeries ? 1 : 0) + + (gpuEncSeries?.length ? 1 : 0) + + (gpuComputeSeries?.length ? 1 : 0) + + (gpuDecSeries?.length ? 1 : 0) + + (gpuTempSeries?.length ? 1 : 0) + + (hasNpu ? 1 : 0) + + (hasNpu && npuTempSeries?.length ? 1 : 0) + ); + }, [ + statsHistory, + gpuMemSeries, + gpuEncSeries, + gpuComputeSeries, + gpuDecSeries, + gpuTempSeries, + npuTempSeries, + ]); + // other processes stats const hardwareType = useMemo(() => { @@ -763,12 +793,9 @@ export default function GeneralMetrics({