From d3194f6c173826476dce1e5d3e66ac26837613c5 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:41:35 -0500 Subject: [PATCH] Fix sidebar alert badge not updating when sub-tab alerts are dismissed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When dismissing alerts from inside a server tab (right-clicking Locking, Memory, etc.), the sidebar Alerts badge count was not updated because ServerTab only called AlertStateService.AcknowledgeAlert (tab badges) without touching the EmailAlertService alert log (sidebar badge source). Added AlertAcknowledged event on ServerTab, fired after sub-tab dismiss. MainWindow subscribes and hides email alerts + refreshes sidebar badge, matching the landing page dismiss flow. Note: the sidebar badge re-notification follows a 5-minute cooldown per alert type per server — this is by design to avoid notification spam. Co-Authored-By: Claude Opus 4.6 --- Dashboard/MainWindow.xaml.cs | 6 ++++++ Dashboard/ServerTab.xaml.cs | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/Dashboard/MainWindow.xaml.cs b/Dashboard/MainWindow.xaml.cs index 9ff95486..3afcf7e6 100644 --- a/Dashboard/MainWindow.xaml.cs +++ b/Dashboard/MainWindow.xaml.cs @@ -445,6 +445,12 @@ private void OpenServerTab(ServerConnection server) Helpers.ServerTimeHelper.UtcOffsetMinutes = utcOffset; var serverTab = new ServerTab(server, utcOffset); + serverTab.AlertAcknowledged += (_, _) => + { + _emailAlertService.HideAllAlerts(8760, server.DisplayName); + UpdateAlertBadge(); + _alertsHistoryContent?.RefreshAlerts(); + }; var headerPanel = new StackPanel { Orientation = Orientation.Horizontal }; var headerText = new TextBlock diff --git a/Dashboard/ServerTab.xaml.cs b/Dashboard/ServerTab.xaml.cs index 055fb452..5c849416 100644 --- a/Dashboard/ServerTab.xaml.cs +++ b/Dashboard/ServerTab.xaml.cs @@ -28,6 +28,12 @@ public partial class ServerTab : UserControl private readonly ICredentialService _credentialService; private ServerHealthStatus? _lastKnownStatus; + /// + /// Raised when the user acknowledges a sub-tab alert (Locking, Memory, etc.) + /// so the sidebar badge can be updated. + /// + public event EventHandler? AlertAcknowledged; + /// /// This server's UTC offset in minutes, used to restore the global /// ServerTimeHelper when this tab becomes active. @@ -3097,6 +3103,8 @@ private void AcknowledgeSubTabAlert_Click(object sender, RoutedEventArgs e) { badge.Visibility = Visibility.Collapsed; } + + AlertAcknowledged?.Invoke(this, EventArgs.Empty); } } }