mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-30 21:37:47 +02:00
add signal strength indicator dot to all systems table
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { MeterState } from "@/lib/enums"
|
||||
import type { SystemRecord, WiFi } from "@/types"
|
||||
|
||||
// Current system info is independent of the selected historical chart window.
|
||||
@@ -21,6 +22,11 @@ export function strongestWiFiSignal(system: Pick<SystemRecord, "status" | "info"
|
||||
return strongestWiFi(connectedWiFi(system))?.[1].r
|
||||
}
|
||||
|
||||
/** Signal quality for an RSSI reading: good at -65 dBm or stronger, warn down to -75 dBm, crit below. */
|
||||
export function wifiSignalState(rssi: number): MeterState {
|
||||
return rssi >= -65 ? MeterState.Good : rssi >= -75 ? MeterState.Warn : MeterState.Crit
|
||||
}
|
||||
|
||||
export function wifiColor(id: string): string {
|
||||
let hash = 0
|
||||
for (const char of id) hash = (Math.imul(hash, 31) + char.charCodeAt(0)) | 0
|
||||
|
||||
Reference in New Issue
Block a user