mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-21 08:57:48 +02:00
fix: GPU Power Draw chart renders full-width instead of half-width (#2269)
This commit is contained in:
@@ -11,7 +11,7 @@ import { RootDiskCharts, ExtraFsCharts } from "./system/charts/disk-charts"
|
|||||||
import { ZfsCharts } from "./system/charts/zfs-charts"
|
import { ZfsCharts } from "./system/charts/zfs-charts"
|
||||||
import { BandwidthChart, ContainerNetworkChart } from "./system/charts/network-charts"
|
import { BandwidthChart, ContainerNetworkChart } from "./system/charts/network-charts"
|
||||||
import { TemperatureChart, FanChart, BatteryChart } from "./system/charts/sensor-charts"
|
import { TemperatureChart, FanChart, BatteryChart } from "./system/charts/sensor-charts"
|
||||||
import { GpuPowerChart, GpuDetailCharts } from "./system/charts/gpu-charts"
|
import { GpuPowerChart, GpuCharts } from "./system/charts/gpu-charts"
|
||||||
import { LazyContainersTable, LazySmartTable, LazySystemdTable, LazyZfsTable } from "./system/lazy-tables"
|
import { LazyContainersTable, LazySmartTable, LazySystemdTable, LazyZfsTable } from "./system/lazy-tables"
|
||||||
import { LoadAverageChart } from "./system/charts/load-average-chart"
|
import { LoadAverageChart } from "./system/charts/load-average-chart"
|
||||||
import { ContainerIcon, CpuIcon, HardDriveIcon, TerminalSquareIcon } from "lucide-react"
|
import { ContainerIcon, CpuIcon, HardDriveIcon, TerminalSquareIcon } from "lucide-react"
|
||||||
@@ -133,7 +133,7 @@ export default memo(function SystemDetail({ id }: { id: string }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{hasGpuData && lastGpus && (
|
{hasGpuData && lastGpus && (
|
||||||
<GpuDetailCharts
|
<GpuCharts
|
||||||
chartData={chartData}
|
chartData={chartData}
|
||||||
grid={grid}
|
grid={grid}
|
||||||
dataEmpty={dataEmpty}
|
dataEmpty={dataEmpty}
|
||||||
@@ -219,18 +219,15 @@ export default memo(function SystemDetail({ id }: { id: string }) {
|
|||||||
|
|
||||||
{hasGpu && (
|
{hasGpu && (
|
||||||
<TabsContent value="gpu" forceMount className={activeTab === "gpu" ? "contents" : "hidden"}>
|
<TabsContent value="gpu" forceMount className={activeTab === "gpu" ? "contents" : "hidden"}>
|
||||||
<div className="grid xl:grid-cols-2 gap-4">
|
<GpuCharts
|
||||||
{hasGpuPowerData && <GpuPowerChart chartData={chartData} grid={grid} dataEmpty={dataEmpty} />}
|
|
||||||
</div>
|
|
||||||
{hasGpuData && lastGpus && (
|
|
||||||
<GpuDetailCharts
|
|
||||||
chartData={chartData}
|
chartData={chartData}
|
||||||
grid={grid}
|
grid={grid}
|
||||||
dataEmpty={dataEmpty}
|
dataEmpty={dataEmpty}
|
||||||
lastGpus={lastGpus as Record<string, GPUData>}
|
lastGpus={(lastGpus ?? {}) as Record<string, GPUData>}
|
||||||
hasGpuEnginesData={hasGpuEnginesData}
|
hasGpuEnginesData={hasGpuEnginesData}
|
||||||
/>
|
>
|
||||||
)}
|
{hasGpuPowerData && <GpuPowerChart chartData={chartData} grid={grid} dataEmpty={dataEmpty} />}
|
||||||
|
</GpuCharts>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { t } from "@lingui/core/macro"
|
import { t } from "@lingui/core/macro"
|
||||||
import { useRef, useMemo } from "react"
|
import { Fragment, type ReactNode, useRef, useMemo } from "react"
|
||||||
import AreaChartDefault, { type DataPoint } from "@/components/charts/area-chart"
|
import AreaChartDefault, { type DataPoint } from "@/components/charts/area-chart"
|
||||||
import LineChartDefault from "@/components/charts/line-chart"
|
import LineChartDefault from "@/components/charts/line-chart"
|
||||||
import { Unit } from "@/lib/enums"
|
import { Unit } from "@/lib/enums"
|
||||||
@@ -79,6 +79,7 @@ export function GpuPowerChart({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ChartCard
|
<ChartCard
|
||||||
|
className={cn(grid && "!col-span-1")}
|
||||||
empty={dataEmpty}
|
empty={dataEmpty}
|
||||||
grid={grid}
|
grid={grid}
|
||||||
title={t`GPU Power Draw`}
|
title={t`GPU Power Draw`}
|
||||||
@@ -96,22 +97,26 @@ export function GpuPowerChart({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GPU detail grid (engines + per-GPU usage/VRAM) — rendered outside the main 2-col grid */
|
/** All GPU charts (optional power-draw slot + engines + per-GPU usage/VRAM) in a single 2-col grid, so the
|
||||||
export function GpuDetailCharts({
|
* cards' odd:last-of-type parity rule flows across the whole tab and no row is left half-empty */
|
||||||
|
export function GpuCharts({
|
||||||
chartData,
|
chartData,
|
||||||
grid,
|
grid,
|
||||||
dataEmpty,
|
dataEmpty,
|
||||||
lastGpus,
|
lastGpus,
|
||||||
hasGpuEnginesData,
|
hasGpuEnginesData,
|
||||||
|
children,
|
||||||
}: {
|
}: {
|
||||||
chartData: ChartData
|
chartData: ChartData
|
||||||
grid: boolean
|
grid: boolean
|
||||||
dataEmpty: boolean
|
dataEmpty: boolean
|
||||||
lastGpus: Record<string, GPUData>
|
lastGpus: Record<string, GPUData>
|
||||||
hasGpuEnginesData: boolean
|
hasGpuEnginesData: boolean
|
||||||
|
children?: ReactNode
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="grid xl:grid-cols-2 gap-4">
|
<div className="grid xl:grid-cols-2 gap-4">
|
||||||
|
{children}
|
||||||
{hasGpuEnginesData && (
|
{hasGpuEnginesData && (
|
||||||
<ChartCard
|
<ChartCard
|
||||||
legend={true}
|
legend={true}
|
||||||
@@ -126,9 +131,8 @@ export function GpuDetailCharts({
|
|||||||
{Object.keys(lastGpus).map((id) => {
|
{Object.keys(lastGpus).map((id) => {
|
||||||
const gpu = lastGpus[id] as GPUData
|
const gpu = lastGpus[id] as GPUData
|
||||||
return (
|
return (
|
||||||
<div key={id} className="contents">
|
<Fragment key={id}>
|
||||||
<ChartCard
|
<ChartCard
|
||||||
className={cn(grid && "!col-span-1")}
|
|
||||||
empty={dataEmpty}
|
empty={dataEmpty}
|
||||||
grid={grid}
|
grid={grid}
|
||||||
title={`${gpu.n} ${t`Usage`}`}
|
title={`${gpu.n} ${t`Usage`}`}
|
||||||
@@ -178,7 +182,7 @@ export function GpuDetailCharts({
|
|||||||
/>
|
/>
|
||||||
</ChartCard>
|
</ChartCard>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Fragment>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user