diff --git a/Lite/MainWindow.xaml b/Lite/MainWindow.xaml index adea8549..aa6996b0 100644 --- a/Lite/MainWindow.xaml +++ b/Lite/MainWindow.xaml @@ -12,6 +12,7 @@ + @@ -190,37 +191,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lite/MainWindow.xaml.cs b/Lite/MainWindow.xaml.cs index fb6589ef..fb231638 100644 --- a/Lite/MainWindow.xaml.cs +++ b/Lite/MainWindow.xaml.cs @@ -340,6 +340,8 @@ private async Task RefreshOverviewAsync() if (summary != null) { summary.ServerName = server.ServerName; + var connStatus = _serverManager.GetConnectionStatus(server.Id); + summary.IsOnline = connStatus.IsOnline; summaries.Add(summary); } } diff --git a/Lite/Services/LocalDataService.Overview.cs b/Lite/Services/LocalDataService.Overview.cs index 8258323a..2e45a864 100644 --- a/Lite/Services/LocalDataService.Overview.cs +++ b/Lite/Services/LocalDataService.Overview.cs @@ -125,6 +125,7 @@ public class ServerSummaryItem public string DisplayName { get; set; } = ""; public string ServerName { get; set; } = ""; public int ServerId { get; set; } + public bool? IsOnline { get; set; } public double? CpuPercent { get; set; } public double? MemoryMb { get; set; } public int BlockingCount { get; set; } @@ -137,11 +138,21 @@ public class ServerSummaryItem public string DeadlockDisplay => DeadlockCount > 0 ? DeadlockCount.ToString() : "0"; public string LastCollectionDisplay => LastCollectionTime.HasValue ? ServerTimeHelper.FormatServerTime(LastCollectionTime, "HH:mm:ss") : "Never"; + /* Connection status */ + public string StatusDisplay => IsOnline switch { true => "Online", false => "Offline", _ => "Unknown" }; + public SolidColorBrush StatusBrush => MakeBrush(IsOnline switch { true => "#4CAF50", false => "#EF4444", _ => "#888888" }); + public bool IsOffline => IsOnline == false; + /* Color coding */ public SolidColorBrush CpuBrush => MakeBrush(CpuPercent >= 80 ? "#F44336" : CpuPercent >= 50 ? "#FF9800" : "#4CAF50"); public SolidColorBrush BlockingBrush => MakeBrush(BlockingCount > 0 ? "#FF9800" : "#4CAF50"); public SolidColorBrush DeadlockBrush => MakeBrush(DeadlockCount > 0 ? "#F44336" : "#4CAF50"); - public SolidColorBrush CardBorderBrush => MakeBrush(DeadlockCount > 0 ? "#F44336" : BlockingCount > 0 ? "#FF9800" : CpuPercent >= 80 ? "#FF9800" : "#555555"); + public SolidColorBrush CardBorderBrush => MakeBrush( + IsOnline == false ? "#EF4444" : + DeadlockCount > 0 ? "#F44336" : + BlockingCount > 0 ? "#FF9800" : + CpuPercent >= 80 ? "#FF9800" : + "#555555"); private static SolidColorBrush MakeBrush(string hex) {