diff --git a/Lite/Controls/FinOpsTab.xaml.cs b/Lite/Controls/FinOpsTab.xaml.cs index c756df52..c641f43b 100644 --- a/Lite/Controls/FinOpsTab.xaml.cs +++ b/Lite/Controls/FinOpsTab.xaml.cs @@ -45,6 +45,32 @@ public void Initialize(LocalDataService dataService, ServerManager serverManager RefreshData(); } + /// + /// Refreshes the server dropdown from the current server list. + /// Called when servers are added or removed. + /// + public void RefreshServerList() + { + if (_serverManager == null) return; + + var previousSelection = ServerSelector.SelectedItem as ServerConnection; + var servers = _serverManager.GetAllServers(); + ServerSelector.ItemsSource = servers; + + if (previousSelection != null) + { + var match = servers.FirstOrDefault(s => s.Id == previousSelection.Id); + if (match != null) + { + ServerSelector.SelectedItem = match; + return; + } + } + + if (servers.Count > 0) + ServerSelector.SelectedIndex = 0; + } + private void PopulateServerSelector() { if (_serverManager == null) return; diff --git a/Lite/MainWindow.xaml.cs b/Lite/MainWindow.xaml.cs index 918c0b42..e54fcbdf 100644 --- a/Lite/MainWindow.xaml.cs +++ b/Lite/MainWindow.xaml.cs @@ -304,6 +304,9 @@ private void RefreshServerList() ServerCountText.Text = $"Servers: {servers.Count}"; + // Refresh FinOps server dropdown when server list changes + FinOpsContent.RefreshServerList(); + // Refresh overview when server list changes _ = RefreshOverviewAsync(); }