Skip to content

Commit 47010a9

Browse files
Add FocusServerTabOnClick user setting for server tab navigation
When disabled, clicking a server card in Overview creates the tab without switching away from the current view. Existing-tab clicks always focus regardless of setting. Default is true (current behavior). Closes #71 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 09b2d84 commit 47010a9

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

Dashboard/MainWindow.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,12 @@ private void OpenServerTab(ServerConnection server)
533533

534534
ServerTabControl.Items.Add(tabItem);
535535
_openTabs[server.Id] = tabItem;
536-
ServerTabControl.SelectedItem = tabItem;
536+
537+
var prefs = _preferencesService.GetPreferences();
538+
if (prefs.FocusServerTabOnClick)
539+
{
540+
ServerTabControl.SelectedItem = tabItem;
541+
}
537542

538543
_serverManager.UpdateLastConnected(server.Id);
539544
}

Dashboard/Models/UserPreferences.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public class UserPreferences
100100
public bool McpEnabled { get; set; } = false;
101101
public int McpPort { get; set; } = 5150;
102102

103+
// Navigation settings
104+
public bool FocusServerTabOnClick { get; set; } = true;
105+
103106
// Update check settings
104107
public bool CheckForUpdatesOnStartup { get; set; } = true;
105108

Dashboard/SettingsWindow.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<!-- Default Time Range Section -->
5656
<TextBlock Text="Default Time Range" FontWeight="Bold" FontSize="13" Margin="0,0,0,10"/>
57-
<StackPanel Orientation="Horizontal">
57+
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
5858
<TextBlock Text="Show data from last:" VerticalAlignment="Center" Margin="0,0,10,0"/>
5959
<ComboBox x:Name="DefaultTimeRangeComboBox" Width="120" SelectionChanged="DefaultTimeRangeComboBox_Changed">
6060
<ComboBoxItem Content="1 hour" Tag="1"/>
@@ -63,6 +63,12 @@
6363
<ComboBoxItem Content="7 days" Tag="168"/>
6464
</ComboBox>
6565
</StackPanel>
66+
67+
<!-- Navigation Section -->
68+
<TextBlock Text="Navigation" FontWeight="Bold" FontSize="13" Margin="0,0,0,10"/>
69+
<CheckBox x:Name="FocusServerTabCheckBox"
70+
Content="Focus server tab when clicking a server card"
71+
Margin="0,0,0,0"/>
6672
</StackPanel>
6773
</ScrollViewer>
6874
</TabItem>

Dashboard/SettingsWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ private void LoadSettings()
8686
DefaultTimeRangeComboBox.SelectedIndex = 2; // 24 hours
8787
}
8888

89+
// Navigation settings
90+
FocusServerTabCheckBox.IsChecked = prefs.FocusServerTabOnClick;
91+
8992
// Query logging settings
9093
LogSlowQueriesCheckBox.IsChecked = prefs.LogSlowQueries;
9194
QueryLogger.SetEnabled(prefs.LogSlowQueries);
@@ -420,6 +423,9 @@ private void OkButton_Click(object sender, RoutedEventArgs e)
420423
prefs.DefaultHoursBack = int.Parse(rangeItem.Tag.ToString()!, CultureInfo.InvariantCulture);
421424
}
422425

426+
// Save navigation settings
427+
prefs.FocusServerTabOnClick = FocusServerTabCheckBox.IsChecked == true;
428+
423429
// Save query logging settings
424430
prefs.LogSlowQueries = LogSlowQueriesCheckBox.IsChecked == true;
425431
QueryLogger.SetEnabled(prefs.LogSlowQueries);

0 commit comments

Comments
 (0)