Skip to content

Commit 7454b60

Browse files
Fix FinOps tab server dropdown not updating when servers change (#496)
The FinOps tab's server selector was only populated once during initialization. Added RefreshServerList() to update the dropdown (preserving the current selection) whenever servers are added or removed via the main window's RefreshServerList flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d4261dc commit 7454b60

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

Lite/Controls/FinOpsTab.xaml.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,32 @@ public void Initialize(LocalDataService dataService, ServerManager serverManager
4545
RefreshData();
4646
}
4747

48+
/// <summary>
49+
/// Refreshes the server dropdown from the current server list.
50+
/// Called when servers are added or removed.
51+
/// </summary>
52+
public void RefreshServerList()
53+
{
54+
if (_serverManager == null) return;
55+
56+
var previousSelection = ServerSelector.SelectedItem as ServerConnection;
57+
var servers = _serverManager.GetAllServers();
58+
ServerSelector.ItemsSource = servers;
59+
60+
if (previousSelection != null)
61+
{
62+
var match = servers.FirstOrDefault(s => s.Id == previousSelection.Id);
63+
if (match != null)
64+
{
65+
ServerSelector.SelectedItem = match;
66+
return;
67+
}
68+
}
69+
70+
if (servers.Count > 0)
71+
ServerSelector.SelectedIndex = 0;
72+
}
73+
4874
private void PopulateServerSelector()
4975
{
5076
if (_serverManager == null) return;

Lite/MainWindow.xaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ private void RefreshServerList()
304304

305305
ServerCountText.Text = $"Servers: {servers.Count}";
306306

307+
// Refresh FinOps server dropdown when server list changes
308+
FinOpsContent.RefreshServerList();
309+
307310
// Refresh overview when server list changes
308311
_ = RefreshOverviewAsync();
309312
}

0 commit comments

Comments
 (0)