Update notification service

This commit is contained in:
MacRimi
2026-03-10 17:22:27 +01:00
parent 45365e3860
commit 8cc74eceb6
3 changed files with 49 additions and 11 deletions

View File

@@ -147,9 +147,26 @@ export function HealthStatusModal({ open, onOpenChange, getApiUrl }: HealthStatu
newOverallStatus = fullData.health?.overall || "OK"
}
// Calculate infoCount: categories with INFO status + dismissed items
let infoCount = 0
if (response.ok) {
const fullData: FullHealthData = await response.clone().json()
// Count INFO categories
if (fullData.health?.details) {
CATEGORIES.forEach(({ key }) => {
const cat = fullData.health.details[key as keyof typeof fullData.health.details]
if (cat && cat.status?.toUpperCase() === "INFO") {
infoCount++
}
})
}
// Add dismissed items count
infoCount += (fullData.dismissed || []).length
}
// Emit event with the FRESH data from the response, not the stale state
const event = new CustomEvent("healthStatusUpdated", {
detail: { status: newOverallStatus },
detail: { status: newOverallStatus, infoCount },
})
window.dispatchEvent(event)
} catch (err) {