mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-24 14:36:17 +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 { Separator } from "@/components/ui/separator"
|
||||||
import {
|
import {
|
||||||
AppleIcon,
|
AppleIcon,
|
||||||
BinaryIcon,
|
|
||||||
ChevronRightSquareIcon,
|
ChevronRightSquareIcon,
|
||||||
ClockArrowUp,
|
ClockArrowUp,
|
||||||
CpuIcon,
|
CpuIcon,
|
||||||
@@ -22,6 +21,7 @@ import type { ChartData, SystemDetailsRecord, SystemRecord } from "@/types"
|
|||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
import { useLingui } from "@lingui/react/macro"
|
import { useLingui } from "@lingui/react/macro"
|
||||||
import { pb } from "@/lib/api"
|
import { pb } from "@/lib/api"
|
||||||
|
import { plural } from "@lingui/core/macro"
|
||||||
|
|
||||||
export default function InfoBar({
|
export default function InfoBar({
|
||||||
system,
|
system,
|
||||||
@@ -70,7 +70,7 @@ export default function InfoBar({
|
|||||||
const hostname = details?.hostname ?? system.info.h
|
const hostname = details?.hostname ?? system.info.h
|
||||||
const kernel = details?.kernel ?? system.info.k
|
const kernel = details?.kernel ?? system.info.k
|
||||||
const cores = details?.cores ?? system.info.c
|
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 cpuModel = details?.cpu ?? system.info.m
|
||||||
const os = details?.os ?? system.info.os ?? Os.Linux
|
const os = details?.os ?? system.info.os ?? Os.Linux
|
||||||
const osName = details?.os_name
|
const osName = details?.os_name
|
||||||
@@ -119,7 +119,12 @@ export default function InfoBar({
|
|||||||
},
|
},
|
||||||
{ value: uptime, Icon: ClockArrowUp, label: t`Uptime`, hide: !system.info.u },
|
{ value: uptime, Icon: ClockArrowUp, label: t`Uptime`, hide: !system.info.u },
|
||||||
osInfo[os],
|
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 {
|
] as {
|
||||||
value: string | number | undefined
|
value: string | number | undefined
|
||||||
label?: string
|
label?: string
|
||||||
@@ -127,12 +132,6 @@ export default function InfoBar({
|
|||||||
hide?: boolean
|
hide?: boolean
|
||||||
}[]
|
}[]
|
||||||
|
|
||||||
info.push({
|
|
||||||
value: `${cpuModel} (${cores}c${threads ? `/${threads}t` : ""})`,
|
|
||||||
Icon: CpuIcon,
|
|
||||||
hide: !cpuModel,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (memory) {
|
if (memory) {
|
||||||
const memValue = formatBytes(memory, false, undefined, false)
|
const memValue = formatBytes(memory, false, undefined, false)
|
||||||
info.push({
|
info.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user