From 925fe1cce094226908dcaa2da389a4cf5442157e Mon Sep 17 00:00:00 2001 From: MacRimi Date: Thu, 5 Mar 2026 21:28:48 +0100 Subject: [PATCH] Update notification service --- AppImage/components/health-status-modal.tsx | 2 +- AppImage/components/storage-overview.tsx | 26 ++++++++++----------- AppImage/scripts/health_monitor.py | 24 ++++--------------- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/AppImage/components/health-status-modal.tsx b/AppImage/components/health-status-modal.tsx index 0a0d4a69..a55cef58 100644 --- a/AppImage/components/health-status-modal.tsx +++ b/AppImage/components/health-status-modal.tsx @@ -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" >
- {getStatusIcon(checkData.status, "sm")} + {getStatusIcon(checkData.dismissed ? "INFO" : checkData.status, "sm")} {formatCheckLabel(checkKey)} {checkData.detail} {checkData.dismissed && ( diff --git a/AppImage/components/storage-overview.tsx b/AppImage/components/storage-overview.tsx index 9bbb5602..5af0b3a6 100644 --- a/AppImage/components/storage-overview.tsx +++ b/AppImage/components/storage-overview.tsx @@ -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) } } diff --git a/AppImage/scripts/health_monitor.py b/AppImage/scripts/health_monitor.py index e3e6be91..0d452256 100644 --- a/AppImage/scripts/health_monitor.py +++ b/AppImage/scripts/health_monitor.py @@ -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: