mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-22 13:36:16 +01:00
consolidate info bar data
This commit is contained in:
@@ -7,7 +7,6 @@ import { cn, formatBytes, getHostDisplayValue, secondsToString, toFixedFloat } f
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import {
|
||||
AppleIcon,
|
||||
BinaryIcon,
|
||||
ChevronRightSquareIcon,
|
||||
ClockArrowUp,
|
||||
CpuIcon,
|
||||
@@ -22,6 +21,7 @@ import type { ChartData, SystemDetailsRecord, SystemRecord } from "@/types"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import { useLingui } from "@lingui/react/macro"
|
||||
import { pb } from "@/lib/api"
|
||||
import { plural } from "@lingui/core/macro"
|
||||
|
||||
export default function InfoBar({
|
||||
system,
|
||||
@@ -70,7 +70,7 @@ export default function InfoBar({
|
||||
const hostname = details?.hostname ?? system.info.h
|
||||
const kernel = details?.kernel ?? system.info.k
|
||||
const cores = details?.cores ?? system.info.c
|
||||
const threads = details?.threads ?? system.info.t
|
||||
const threads = details?.threads ?? system.info.t ?? 0
|
||||
const cpuModel = details?.cpu ?? system.info.m
|
||||
const os = details?.os ?? system.info.os ?? Os.Linux
|
||||
const osName = details?.os_name
|
||||
@@ -119,7 +119,12 @@ export default function InfoBar({
|
||||
},
|
||||
{ value: uptime, Icon: ClockArrowUp, label: t`Uptime`, hide: !system.info.u },
|
||||
osInfo[os],
|
||||
{ value: arch, Icon: BinaryIcon, hide: !arch },
|
||||
{
|
||||
value: cpuModel,
|
||||
Icon: CpuIcon,
|
||||
hide: !cpuModel,
|
||||
label: `${plural(cores, { one: "# core", other: "# cores" })} / ${plural(threads, { one: "# thread", other: "# threads" })}${arch ? ` / ${arch}` : ""}`,
|
||||
},
|
||||
] as {
|
||||
value: string | number | undefined
|
||||
label?: string
|
||||
@@ -127,12 +132,6 @@ export default function InfoBar({
|
||||
hide?: boolean
|
||||
}[]
|
||||
|
||||
info.push({
|
||||
value: `${cpuModel} (${cores}c${threads ? `/${threads}t` : ""})`,
|
||||
Icon: CpuIcon,
|
||||
hide: !cpuModel,
|
||||
})
|
||||
|
||||
if (memory) {
|
||||
const memValue = formatBytes(memory, false, undefined, false)
|
||||
info.push({
|
||||
|
||||
Reference in New Issue
Block a user