mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 17:59:28 +08:00
feat: add temperatures to dashboard
- Refactor temperature related code and move to standalone function
This commit is contained in:
@@ -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`,
|
||||
|
4
beszel/site/src/types.d.ts
vendored
4
beszel/site/src/types.d.ts
vendored
@@ -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 {
|
||||
|
Reference in New Issue
Block a user