From b3cef0b00971080e3f6961c4763f6c7f12e40d6d Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sun, 12 Apr 2026 23:54:52 +0200 Subject: [PATCH] Update storage-overview.tsx --- AppImage/components/storage-overview.tsx | 184 ++++++++++++----------- 1 file changed, 96 insertions(+), 88 deletions(-) diff --git a/AppImage/components/storage-overview.tsx b/AppImage/components/storage-overview.tsx index b55c09da..9ac3bda7 100644 --- a/AppImage/components/storage-overview.tsx +++ b/AppImage/components/storage-overview.tsx @@ -1634,6 +1634,101 @@ function openSmartReport(disk: DiskInfo, testStatus: SmartTestStatus, smartAttri recommendations.push('
Backup Strategy

Ensure critical data is backed up regularly regardless of disk health status.

') } + // Build observations HTML separately to avoid nested template literal issues + let observationsHtml = '' + if (observations.length > 0) { + const totalOccurrences = observations.reduce((sum, o) => sum + o.occurrence_count, 0) + + // Group observations by error type + const groupedObs: Record = {} + observations.forEach(obs => { + const type = obs.error_type || 'unknown' + if (!groupedObs[type]) groupedObs[type] = [] + groupedObs[type].push(obs) + }) + + let groupsHtml = '' + Object.entries(groupedObs).forEach(([type, obsList]) => { + const typeLabel = type === 'io_error' ? 'I/O Errors' : type === 'smart_error' ? 'SMART Errors' : type === 'filesystem_error' ? 'Filesystem Errors' : type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()) + const groupOccurrences = obsList.reduce((sum, o) => sum + o.occurrence_count, 0) + + let obsItemsHtml = '' + obsList.forEach(obs => { + const severityColor = obs.severity === 'critical' ? '#dc2626' : obs.severity === 'warning' ? '#ca8a04' : '#3b82f6' + const severityBg = obs.severity === 'critical' ? '#dc262615' : obs.severity === 'warning' ? '#ca8a0415' : '#3b82f615' + const severityLabel = obs.severity ? obs.severity.charAt(0).toUpperCase() + obs.severity.slice(1) : 'Info' + const firstDate = obs.first_occurrence ? new Date(obs.first_occurrence).toLocaleString() : 'N/A' + const lastDate = obs.last_occurrence ? new Date(obs.last_occurrence).toLocaleString() : 'N/A' + const dismissedBadge = obs.dismissed ? 'Dismissed' : '' + + obsItemsHtml += ` +
+
+ ${severityLabel} + ID: #${obs.id} + Occurrences: ${obs.occurrence_count} + ${dismissedBadge} +
+ +
+
Error Signature:
+
${obs.error_signature}
+
+ +
+
Raw Message:
+
${obs.raw_message || 'N/A'}
+
+ +
+
+ Device: + ${obs.device_name || disk.name} +
+
+ Serial: + ${obs.serial || disk.serial || 'N/A'} +
+
+ Model: + ${obs.model || disk.model || 'N/A'} +
+
+ First Seen: + ${firstDate} +
+
+ Last Seen: + ${lastDate} +
+
+
+ ` + }) + + groupsHtml += ` +
+
+ ${typeLabel} + ${obsList.length} unique, ${groupOccurrences} total +
+
+ ${obsItemsHtml} +
+
+ ` + }) + + observationsHtml = ` + +
+
6. Observations & Events (${observations.length} recorded, ${totalOccurrences} total occurrences)
+

The following events have been detected and logged for this disk. These observations may indicate potential issues that require attention.

+ ${groupsHtml} +
+ ` + } + const html = ` @@ -2032,94 +2127,7 @@ ${isNvmeDisk ? ` `} -${observations.length > 0 ? ` - -
-
6. Observations & Events (${observations.length} recorded, ${observations.reduce((sum, o) => sum + o.occurrence_count, 0)} total occurrences)
-

The following events have been detected and logged for this disk. These observations may indicate potential issues that require attention.

- - - ${(() => { - const groupedObs: Record = {} - observations.forEach(obs => { - const type = obs.error_type || 'unknown' - if (!groupedObs[type]) groupedObs[type] = [] - groupedObs[type].push(obs) - }) - - return Object.entries(groupedObs).map(([type, obsList]) => { - const typeLabel = type === 'io_error' ? 'I/O Errors' : type === 'smart_error' ? 'SMART Errors' : type === 'filesystem_error' ? 'Filesystem Errors' : type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()) - const totalOccurrences = obsList.reduce((sum, o) => sum + o.occurrence_count, 0) - - return \` -
-
- \${typeLabel} - \${obsList.length} unique, \${totalOccurrences} total -
-
- \${obsList.map(obs => { - const severityColor = obs.severity === 'critical' ? '#dc2626' : obs.severity === 'warning' ? '#ca8a04' : '#3b82f6' - const severityBg = obs.severity === 'critical' ? '#dc262615' : obs.severity === 'warning' ? '#ca8a0415' : '#3b82f615' - const severityLabel = obs.severity ? obs.severity.charAt(0).toUpperCase() + obs.severity.slice(1) : 'Info' - const firstDate = obs.first_occurrence ? new Date(obs.first_occurrence).toLocaleString() : 'N/A' - const lastDate = obs.last_occurrence ? new Date(obs.last_occurrence).toLocaleString() : 'N/A' - const dismissed = obs.dismissed ? 'Dismissed' : '' - - return \\\` -
-
- \${severityLabel} - ID: #\${obs.id} - Occurrences: \${obs.occurrence_count} - \${dismissed} -
- - -
-
Error Signature:
-
\${obs.error_signature}
-
- - -
-
Raw Message:
-
\${obs.raw_message || 'N/A'}
-
- - -
-
- Device: - \${obs.device_name || disk.name} -
-
- Serial: - \${obs.serial || disk.serial || 'N/A'} -
-
- Model: - \${obs.model || disk.model || 'N/A'} -
-
- First Seen: - \${firstDate} -
-
- Last Seen: - \${lastDate} -
-
-
- \\\` - }).join('')} -
-
- \` - }).join('') - })()} -
-` : ''} +${observationsHtml}