(value: number | string | null | undefined)
| 52 | } |
| 53 | |
| 54 | function fmtBytes(value: number | string | null | undefined): string { |
| 55 | const bytes = Number(value) || 0; |
| 56 | if (bytes < 1024) return `${bytes} B`; |
| 57 | const units = ["KiB", "MiB", "GiB", "TiB"]; |
| 58 | let scaled = bytes / 1024; |
| 59 | let unit = 0; |
| 60 | while (scaled >= 1024 && unit < units.length - 1) { |
| 61 | scaled /= 1024; |
| 62 | unit += 1; |
| 63 | } |
| 64 | return `${scaled >= 10 ? Math.round(scaled) : scaled.toFixed(1)} ${units[unit]}`; |
| 65 | } |
| 66 | |
| 67 | function healthPillClass(status: string): string { |
| 68 | if (status === "ok") return "hermes-lcm-pill hermes-lcm-pill-accent"; |
no outgoing calls
no test coverage detected