Update notification service

This commit is contained in:
MacRimi
2026-03-05 21:28:48 +01:00
parent d927b462b6
commit 925fe1cce0
3 changed files with 18 additions and 34 deletions

View File

@@ -428,7 +428,7 @@ export function HealthStatusModal({ open, onOpenChange, getApiUrl }: HealthStatu
className="flex items-center justify-between gap-1.5 sm:gap-2 text-[10px] sm:text-xs py-1.5 px-2 sm:px-3 rounded-md hover:bg-muted/40 transition-colors"
>
<div className="flex items-start gap-1.5 sm:gap-2 min-w-0 flex-1">
<span className="mt-0.5 shrink-0">{getStatusIcon(checkData.status, "sm")}</span>
<span className="mt-0.5 shrink-0">{getStatusIcon(checkData.dismissed ? "INFO" : checkData.status, "sm")}</span>
<span className="font-medium shrink-0">{formatCheckLabel(checkKey)}</span>
<span className="text-muted-foreground break-words whitespace-pre-wrap min-w-0">{checkData.detail}</span>
{checkData.dismissed && (

View File

@@ -266,19 +266,19 @@ export function StorageOverview() {
setDetailsOpen(true)
setDiskObservations([])
if (disk.observations_count && disk.observations_count > 0) {
setLoadingObservations(true)
try {
const params = new URLSearchParams()
if (disk.name) params.set('device', disk.name)
if (disk.serial && disk.serial !== 'Unknown') params.set('serial', disk.serial)
const data = await fetchApi<{ observations: DiskObservation[] }>(`/api/storage/observations?${params.toString()}`)
setDiskObservations(data.observations || [])
} catch {
setDiskObservations([])
} finally {
setLoadingObservations(false)
}
// Always attempt to fetch observations -- the count enrichment may lag
// behind the actual observation recording (especially for USB disks).
setLoadingObservations(true)
try {
const params = new URLSearchParams()
if (disk.name) params.set('device', disk.name)
if (disk.serial && disk.serial !== 'Unknown') params.set('serial', disk.serial)
const data = await fetchApi<{ observations: DiskObservation[] }>(`/api/storage/observations?${params.toString()}`)
setDiskObservations(data.observations || [])
} catch {
setDiskObservations([])
} finally {
setLoadingObservations(false)
}
}

View File

@@ -1095,27 +1095,11 @@ class HealthMonitor:
if not has_io:
checks['io_errors'] = {'status': 'OK', 'detail': 'No I/O errors in dmesg'}
if self.capabilities.get('has_smart') and 'smart_health' not in checks:
if smart_warnings_found:
# Collect the actual warning details for the sub-check
smart_details_parts = []
smart_error_keys = []
for disk_path, issue in disk_health_issues.items():
for sl in (issue.get('smart_lines') or [])[:3]:
smart_details_parts.append(sl)
if issue.get('error_key'):
smart_error_keys.append(issue['error_key'])
detail_text = '; '.join(smart_details_parts[:3]) if smart_details_parts else 'SMART warning in journal'
# Use the same error_key as the per-disk check so a single dismiss
# covers both the /Dev/Sda sub-check AND the SMART Health sub-check
shared_key = smart_error_keys[0] if smart_error_keys else 'smart_health_journal'
checks['smart_health'] = {
'status': 'WARNING',
'detail': detail_text,
'dismissable': True,
'error_key': shared_key,
}
else:
if not smart_warnings_found:
checks['smart_health'] = {'status': 'OK', 'detail': 'No SMART warnings in journal'}
# When smart_warnings_found is True, the per-disk sub-checks
# (/Dev/Sda etc.) already carry all the detail and dismiss logic.
# Adding a separate smart_health WARNING would just duplicate them.
if self.capabilities.get('has_zfs') and 'zfs_pools' not in checks:
checks['zfs_pools'] = {'status': 'OK', 'detail': 'ZFS pools healthy'}
if self.capabilities.get('has_lvm') and 'lvm_volumes' not in checks and 'lvm_check' not in checks: