Update storage-overview.tsx

This commit is contained in:
MacRimi
2025-10-14 23:42:00 +02:00
parent 9ef83a59c7
commit b6e0052013

View File

@@ -344,10 +344,10 @@ export function StorageOverview() {
} }
const disksWithTemp = storageData.disks.filter((disk) => disk.temperature > 0) const disksWithTemp = storageData.disks.filter((disk) => disk.temperature > 0)
const avgTemp = const hottestDisk =
disksWithTemp.length > 0 disksWithTemp.length > 0
? Math.round(disksWithTemp.reduce((sum, disk) => sum + disk.temperature, 0) / disksWithTemp.length) ? disksWithTemp.reduce((hottest, disk) => (disk.temperature > hottest.temperature ? disk : hottest))
: 0 : null
const totalProxmoxUsed = const totalProxmoxUsed =
proxmoxStorage && proxmoxStorage.storage proxmoxStorage && proxmoxStorage.storage
@@ -402,14 +402,21 @@ export function StorageOverview() {
</CardContent> </CardContent>
</Card> </Card>
{/* Hottest Disk */}
<Card> <Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2"> <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Avg Temperature</CardTitle> <CardTitle className="text-sm font-medium">Hottest Disk</CardTitle>
<Thermometer className="h-4 w-4 text-muted-foreground" /> <Thermometer className="h-4 w-4 text-muted-foreground" />
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<div className={`text-2xl font-bold ${getTempColor(avgTemp)}`}>{avgTemp > 0 ? `${avgTemp}°C` : "N/A"}</div> <div
<p className="text-xs text-muted-foreground mt-1">Across all disks</p> className={`text-2xl font-bold ${hottestDisk ? getTempColor(hottestDisk.temperature, hottestDisk.name, hottestDisk.rotation_rate) : "text-gray-500"}`}
>
{hottestDisk ? `${hottestDisk.temperature}°C` : "N/A"}
</div>
<p className="text-xs text-muted-foreground mt-1">
{hottestDisk ? `/dev/${hottestDisk.name}` : "No temperature data"}
</p>
</CardContent> </CardContent>
</Card> </Card>
</div> </div>