feat: add temperatures to dashboard

- Refactor temperature related code and move to standalone function
This commit is contained in:
henrygd
2025-02-07 21:27:15 -05:00
parent 31d52d5e15
commit e6054058b9
4 changed files with 82 additions and 33 deletions

View File

@@ -66,7 +66,7 @@ import { useStore } from "@nanostores/react"
import { cn, copyToClipboard, decimalString, isReadOnlyUser, useLocalStorage } from "@/lib/utils"
import AlertsButton from "../alerts/alert-button"
import { $router, Link, navigate } from "../router"
import { EthernetIcon } from "../ui/icons"
import { EthernetIcon, ThermometerIcon } from "../ui/icons"
import { Trans, t } from "@lingui/macro"
import { useLingui } from "@lingui/react"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card"
@@ -180,6 +180,30 @@ export default function SystemsTable() {
icon: HardDriveIcon,
header: ({ column }) => sortableHeader(column),
},
{
accessorKey: "info.ht",
id: t`Temp`,
invertSorting: true,
sortUndefined: 0,
size: 50,
icon: ThermometerIcon,
header: ({ column }) => sortableHeader(column),
cell(info) {
const val = info.getValue() as number
if (!val) {
return null
}
return (
<span
className={cn("tabular-nums whitespace-nowrap", {
"ps-1": viewMode === "table",
})}
>
{decimalString(val)} °C
</span>
)
},
},
{
accessorFn: (originalRow) => originalRow.info.b || 0,
id: t`Net`,

View File

@@ -43,6 +43,10 @@ export interface SystemInfo {
v: string
/** system is using podman */
p?: boolean
/** highest gpu utilization */
g?: number
/** highest temperature */
ht?: number
}
export interface SystemStats {