diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx index 7f6687212..e8ac58cfd 100644 --- a/frontend-modern/src/App.tsx +++ b/frontend-modern/src/App.tsx @@ -702,7 +702,8 @@ function AppLayout(props: { }); const utilityTabs = createMemo(() => { - const activeAlertCount = props.state().activeAlerts?.length ?? 0; + const allAlerts = props.state().activeAlerts || []; + const activeAlertCount = allAlerts.filter((a: any) => !a.acknowledged).length; return [ { id: 'alerts' as const, @@ -922,12 +923,22 @@ function AppLayout(props: { title={tab.tooltip} > {tab.icon} - {tab.label} - 0}> - - {tab.count} - - + + {tab.label} + {tab.id === 'alerts' && ( + <> + {(tab.count !== undefined && tab.count > 0) ? ( + + {tab.count} + + ) : ( + + + + )} + + )} + diff --git a/frontend-modern/src/stores/websocket.ts b/frontend-modern/src/stores/websocket.ts index 6e7f4b2ff..b7999c876 100644 --- a/frontend-modern/src/stores/websocket.ts +++ b/frontend-modern/src/stores/websocket.ts @@ -351,7 +351,8 @@ export function createWebSocketStore(url: string) { setActiveAlerts(id, alert); }); - // Updated activeAlerts + // Updated activeAlerts - also sync to state for badge count + setState('activeAlerts', message.data.activeAlerts); } // Sync recently resolved alerts if (message.data.recentlyResolved !== undefined) {