wifi: hide chart without signal data, show unknown signal in table

The line chart never renders without values, leaving an endless spinner
when connected interfaces report no RSSI.
This commit is contained in:
henrygd
2026-09-25 19:59:51 -04:00
parent a042e19549
commit c7f2177b08
3 changed files with 9 additions and 9 deletions

View File

@@ -213,7 +213,6 @@ export default memo(function SystemDetail({ id }: { id: string }) {
<TemperatureChart {...coreProps} setPageBottomExtraMargin={setPageBottomExtraMargin} /> <TemperatureChart {...coreProps} setPageBottomExtraMargin={setPageBottomExtraMargin} />
<FanChart {...coreProps} /> <FanChart {...coreProps} />
<BatteryChart system={system} {...coreProps} /> <BatteryChart system={system} {...coreProps} />
<WiFiChart system={system} {...coreProps} />
{pageBottomExtraMargin > 0 && <div style={{ marginBottom: pageBottomExtraMargin }}></div>} {pageBottomExtraMargin > 0 && <div style={{ marginBottom: pageBottomExtraMargin }}></div>}
</div> </div>
</TabsContent> </TabsContent>
@@ -223,6 +222,7 @@ export default memo(function SystemDetail({ id }: { id: string }) {
<> <>
<div className="grid xl:grid-cols-2 gap-4"> <div className="grid xl:grid-cols-2 gap-4">
<BandwidthChart {...coreProps} systemStats={systemStats} /> <BandwidthChart {...coreProps} systemStats={systemStats} />
<WiFiChart system={system} {...coreProps} />
</div> </div>
{hasNetworkMonitors && <LazyNetworkMonitorsTable systemId={system.id} />} {hasNetworkMonitors && <LazyNetworkMonitorsTable systemId={system.id} />}
</> </>

View File

@@ -16,7 +16,11 @@ export function WiFiChart({
dataEmpty: boolean dataEmpty: boolean
}) { }) {
const interfaces = connectedWiFi(system) const interfaces = connectedWiFi(system)
if (!interfaces.length) return null // Associated interfaces may not report RSSI; without any readings the chart would never render.
const hasSignal = interfaces.some(
([id, wifi]) => wifi.r !== undefined || chartData.systemStats.some((record) => record.stats?.wf?.[id] !== undefined)
)
if (!hasSignal) return null
const dataPoints = interfaces.map(([id, current]) => ({ const dataPoints = interfaces.map(([id, current]) => ({
label: current.s ? `${id} (${current.s})` : id, label: current.s ? `${id} (${current.s})` : id,
color: wifiColor(id), color: wifiColor(id),
@@ -27,12 +31,7 @@ export function WiFiChart({
empty={dataEmpty} empty={dataEmpty}
grid={grid} grid={grid}
title={t`Wi-Fi signal`} title={t`Wi-Fi signal`}
description={interfaces description={t`Signal strength of connected Wi-Fi interfaces`}
.map(
([id, value]) =>
`${id}${value.s ? ` (${value.s})` : ""}: ${value.r == null ? t`Unavailable` : `${value.r} dBm`}`,
)
.join(" · ")}
> >
<LineChartDefault <LineChartDefault
chartData={chartData} chartData={chartData}

View File

@@ -708,9 +708,10 @@ function WiFiSignal({ wifi, className }: { wifi: WiFi; className?: ClassValue })
[STATUS_COLORS[SystemStatus.Up]]: state === MeterState.Good, [STATUS_COLORS[SystemStatus.Up]]: state === MeterState.Good,
[STATUS_COLORS[SystemStatus.Pending]]: state === MeterState.Warn, [STATUS_COLORS[SystemStatus.Pending]]: state === MeterState.Warn,
[STATUS_COLORS[SystemStatus.Down]]: state === MeterState.Crit, [STATUS_COLORS[SystemStatus.Down]]: state === MeterState.Crit,
[STATUS_COLORS[SystemStatus.Paused]]: state === undefined,
})} })}
/> />
{wifi.r === undefined ? "—" : `${wifi.r} dBm`} {wifi.r === undefined ? t`Unknown` : `${wifi.r} dBm`}
</span> </span>
) )
} }