feat(hub/agent): alphabetical disk ordering and root disk renaming (#2006)

This commit is contained in:
Sven van Ginkel
2026-08-30 13:09:04 -04:00
committed by GitHub
parent fa9de55433
commit 87620f3251
7 changed files with 46 additions and 33 deletions
+1
View File
@@ -157,6 +157,7 @@ type Info struct {
ExtraFsPct map[string]float64 `json:"efs,omitempty" cbor:"21,keyasint,omitempty"`
Services []uint16 `json:"sv,omitempty" cbor:"22,keyasint,omitempty"` // [totalServices, numFailedServices]
Battery [2]uint8 `json:"bat,omitzero" cbor:"23,keyasint,omitzero"` // [percent, charge state]
RootDiskName string `json:"rdn,omitempty" cbor:"24,keyasint,omitempty"` // custom name for root disk (set via FILESYSTEM=device__name)
}
// Data that does not change during process lifetime and is not needed in All Systems table
@@ -114,8 +114,10 @@ export function DiskUsageChart({ systemData, extraFsName }: { systemData: System
diskSize = Math.round(diskSize)
}
const title = extraFsName ? `${extraFsName} ${t`Usage`}` : t`Disk Usage`
const description = extraFsName ? t`Disk usage of ${extraFsName}` : t`Usage of root partition`
const rootName = systemData.system?.info?.rdn
const rootLabel = rootName ?? t`Root`
const title = extraFsName ? `${extraFsName} ${t`Usage`}` : `${rootLabel} ${t`Usage`}`
const description = extraFsName ? t`Disk usage of ${extraFsName}` : t`Disk usage of ${rootLabel}`
return (
<ChartCard empty={dataEmpty} grid={grid} title={title} description={description}>
@@ -152,8 +154,10 @@ export function DiskIOChart({ systemData, extraFsName }: { systemData: SystemDat
return null
}
const title = extraFsName ? `${extraFsName} I/O` : t`Disk I/O`
const description = extraFsName ? t`Throughput of ${extraFsName}` : t`Throughput of root filesystem`
const rootName = systemData.system?.info?.rdn
const rootLabel = rootName ?? t`Root`
const title = extraFsName ? `${extraFsName} I/O` : `${rootLabel} I/O`
const description = extraFsName ? t`Throughput of ${extraFsName}` : t`Throughput of ${rootLabel}`
const hasMoreIOMetrics = chartData.systemStats?.some((record) => record.stats?.dios?.at(0))
@@ -264,7 +268,7 @@ export function ExtraFsCharts({ systemData }: { systemData: SystemData }) {
return (
<div className="grid xl:grid-cols-2 gap-4">
{Object.keys(extraFs).map((extraFsName) => {
{Object.keys(extraFs).sort((a, b) => a.localeCompare(b)).map((extraFsName) => {
let diskSize = systemStats.at(-1)?.stats.efs?.[extraFsName].d ?? NaN
// round to nearest GB
if (diskSize >= 100) {
@@ -484,9 +484,9 @@ function DiskCellWithMultiple(info: CellContext<SystemRecord, unknown>) {
const { info: sysInfo, status, id } = info.row.original
const extraFs = Object.entries(sysInfo.efs ?? {})
const rootDiskPct = sysInfo.dp
const rootDiskName = sysInfo.rdn
// sort extra disks by percentage descending
extraFs.sort((a, b) => b[1] - a[1])
extraFs.sort((a, b) => a[0].localeCompare(b[0]))
function getIndicatorColor(pct: number) {
const threshold = getMeterStateByThresholds(pct, colorWarn, colorCrit)
@@ -541,8 +541,8 @@ function DiskCellWithMultiple(info: CellContext<SystemRecord, unknown>) {
<TooltipContent side="right" className="max-w-xs pb-2">
<div className="grid gap-1">
<div className="grid gap-0.5">
<div className="text-[0.65rem] text-muted-foreground uppercase tracking-wide tabular-nums">
<Trans context="Root disk label">Root</Trans>
<div className="text-[0.65rem] max-w-40 text-muted-foreground uppercase tracking-wide truncate tabular-nums">
{rootDiskName ?? <Trans context="Root disk label">Root</Trans>}
</div>
<div className="flex gap-2 items-center tabular-nums text-xs">
<span className="min-w-7">{decimalString(rootDiskPct, rootDiskPct >= 10 ? 1 : 2)}%</span>
+2
View File
@@ -78,6 +78,8 @@ export interface SystemInfo {
efs?: Record<string, number>
/** services [totalServices, numFailedServices] */
sv?: [number, number]
/** custom root disk name */
rdn?: string
}
export interface SystemStats {