mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 04:16:24 -05:00
Warn in the navbar when a drive's SMART health is failing. (#471)
A failing SMART self-assessment predicts imminent drive failure, so it deserves a prominent warning. useDriveHealth() reads the assessment already present in smart_stats (pySMART reports PASS / FAIL / null) and flags any drive whose assessment is FAIL. Nav.js renders a red warning icon in its own always-on slot — like the power warning, and unlike the single-slot priority chain where a transient high temp could hide it. Frontend-only: the assessment field is already in the cached payload. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1bd102c768
commit
e018616daf
3 changed files with 92 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import {DarkModeToggle, HotspotStatusIcon, useLocalStorage} from "./Common";
|
|||
import {ShareButton} from "./Share";
|
||||
import {
|
||||
useCPUTemperature,
|
||||
useDriveHealth,
|
||||
useDriveTemperature,
|
||||
useIOStats,
|
||||
useLoad,
|
||||
|
|
@ -197,6 +198,20 @@ export function NavBar() {
|
|||
driveTemperatureIcon = <Popup content={`${hotDrive}: ${driveTemperature.toFixed()}°C`} trigger={link}/>;
|
||||
}
|
||||
|
||||
// A drive's SMART self-assessment is failing — imminent drive failure.
|
||||
// Always displayed (like power); too important to hide behind a transient
|
||||
// warning in the priority chain.
|
||||
const {failingDevices, failing: driveFailing} = useDriveHealth();
|
||||
let driveHealthIcon;
|
||||
if (driveFailing) {
|
||||
const icon = <Icon data-testid='driveHealthIcon' name='warning sign' size='large' color={highWarningColor}/>;
|
||||
const link = <Link to='/admin/status'>{icon}</Link>;
|
||||
const message = failingDevices.length === 1
|
||||
? `Drive ${failingDevices[0]} is failing its SMART health check! Back up your data.`
|
||||
: `Drives failing SMART health check: ${failingDevices.join(', ')}. Back up your data.`;
|
||||
driveHealthIcon = <Popup content={message} trigger={link}/>;
|
||||
}
|
||||
|
||||
// Power issues, this is always displayed if detected.
|
||||
const {underVoltage, overCurrent} = usePowerStats();
|
||||
let powerIcon;
|
||||
|
|
@ -274,6 +289,7 @@ export function NavBar() {
|
|||
<NavIconWrapper>{apiDownIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{processingIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{upgradeIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{driveHealthIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{powerIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{warningIcon}</NavIconWrapper>
|
||||
<NavIconWrapper><ShareButton/></NavIconWrapper>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue