fix: gpu display index

This commit is contained in:
hamster1963 2024-12-06 22:16:28 +08:00
parent 0257d24c75
commit 1d9e59a9df

View File

@ -93,7 +93,7 @@ export default function ServerDetailChart({
return ( return (
<section className="grid md:grid-cols-2 lg:grid-cols-3 grid-cols-1 gap-3"> <section className="grid md:grid-cols-2 lg:grid-cols-3 grid-cols-1 gap-3">
<CpuChart now={nezhaWsData.now} data={server} /> <CpuChart now={nezhaWsData.now} data={server} />
{gpuStats.length > 1 && gpuList.length === gpuStats.length ? ( {gpuStats.length >= 1 && gpuList.length === gpuStats.length ? (
gpuList.map((gpu, index) => ( gpuList.map((gpu, index) => (
<GpuChart <GpuChart
now={nezhaWsData.now} now={nezhaWsData.now}
@ -103,8 +103,15 @@ export default function ServerDetailChart({
/> />
)) ))
) : gpuStats.length > 0 ? ( ) : gpuStats.length > 0 ? (
<GpuChart now={nezhaWsData.now} gpuStat={gpuStats[0]} /> gpuStats.map((gpu, index) => (
) : ( <GpuChart
now={nezhaWsData.now}
gpuStat={gpu}
gpuName={`#${index + 1}`}
key={index}
/>
)
)) : (
<></> <></>
)} )}
<ProcessChart now={nezhaWsData.now} data={server} /> <ProcessChart now={nezhaWsData.now} data={server} />