Skip to content

Commit cfdc90f

Browse files
Improve Add Server dialog UX: inline connection status, full-height window
Replace the connection-success MessageBox popup with inline status in the DatabaseStatusPanel so the entire flow (connection result, database detection, install prompt) reads naturally in one place. Add guidance text explaining what Install Now does for first-time users. Size the dialog to the screen work area height and top-align it so the post-test content is never hidden below the fold. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f431846 commit cfdc90f

2 files changed

Lines changed: 36 additions & 14 deletions

File tree

Dashboard/AddServerDialog.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
Title="Add SQL Server"
5-
Height="750" Width="500"
6-
WindowStartupLocation="CenterOwner"
5+
Width="500"
6+
WindowStartupLocation="Manual"
77
ResizeMode="CanResizeWithGrip"
88
Background="{DynamicResource BackgroundBrush}"
99
Foreground="{DynamicResource ForegroundBrush}">
@@ -142,6 +142,9 @@
142142
Background="{DynamicResource BackgroundLightBrush}"
143143
CornerRadius="4" Padding="12" Margin="0,0,0,10">
144144
<StackPanel>
145+
<TextBlock x:Name="ConnectionInfoText" TextWrapping="Wrap" Margin="0,0,0,4"
146+
FontWeight="SemiBold"
147+
Foreground="{DynamicResource ForegroundBrush}"/>
145148
<TextBlock x:Name="DatabaseStatusText" TextWrapping="Wrap" Margin="0,0,0,8"
146149
Foreground="{DynamicResource ForegroundBrush}"/>
147150
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">

Dashboard/AddServerDialog.xaml.cs

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ private enum DialogState
4747
private InstallationResult? _installResult;
4848
private string? _reportPath;
4949
private DialogState _currentState = DialogState.Initial;
50+
private string? _serverVersion;
5051

5152
public AddServerDialog()
5253
{
5354
InitializeComponent();
55+
SizeToWorkArea();
5456
_isEditMode = false;
5557
ServerConnection = new ServerConnection();
5658
Title = "Add SQL Server";
@@ -59,6 +61,7 @@ public AddServerDialog()
5961
public AddServerDialog(ServerConnection existingServer)
6062
{
6163
InitializeComponent();
64+
SizeToWorkArea();
6265
_isEditMode = true;
6366
ServerConnection = existingServer;
6467
Title = "Edit SQL Server";
@@ -109,6 +112,14 @@ public AddServerDialog(ServerConnection existingServer)
109112
}
110113
}
111114

115+
private void SizeToWorkArea()
116+
{
117+
var workArea = SystemParameters.WorkArea;
118+
Height = workArea.Height;
119+
Top = workArea.Top;
120+
Left = workArea.Left + (workArea.Width - Width) / 2;
121+
}
122+
112123
private void AuthType_Changed(object sender, RoutedEventArgs e)
113124
{
114125
if (SqlAuthPanel != null && EntraMfaPanel != null)
@@ -341,17 +352,9 @@ private async void TestConnection_Click(object sender, RoutedEventArgs e)
341352

342353
if (connected)
343354
{
344-
var message = serverVersion != null
345-
? $"Successfully connected to {ServerNameTextBox.Text}!\n\n{serverVersion}"
346-
: $"Successfully connected to {ServerNameTextBox.Text}!";
347-
MessageBox.Show(
348-
message,
349-
"Connection Successful",
350-
MessageBoxButton.OK,
351-
MessageBoxImage.Information
352-
);
355+
_serverVersion = serverVersion;
353356

354-
/* After successful connection, check database status */
357+
/* Show connection + database status inline instead of a popup */
355358
await DetectDatabaseStatusAsync();
356359
}
357360
else if (mfaCancelled)
@@ -402,6 +405,10 @@ private async System.Threading.Tasks.Task DetectDatabaseStatusAsync()
402405

403406
if (!_coreServerInfo.IsSupportedVersion)
404407
{
408+
string serverName = ServerNameTextBox.Text;
409+
ConnectionInfoText.Text = _serverVersion != null
410+
? $"Connected to {serverName} ({_serverVersion})"
411+
: $"Connected to {serverName}";
405412
DatabaseStatusText.Text = $"Warning: {_coreServerInfo.ProductMajorVersionName} is not supported. SQL Server 2016+ is required.";
406413
DatabaseStatusPanel.Visibility = Visibility.Visible;
407414
InstallUpgradeButton.Visibility = Visibility.Collapsed;
@@ -460,13 +467,22 @@ private void TransitionToState(DialogState newState)
460467
ViewReportButton.Visibility = Visibility.Collapsed;
461468
StatusText.Text = string.Empty;
462469
StatusText.Visibility = Visibility.Collapsed;
470+
ConnectionInfoText.Text = string.Empty;
463471
InstallUpgradeButton.Visibility = Visibility.Visible;
464472
SkipInstallText.Visibility = Visibility.Visible;
465473

474+
/* Build the connection header shown for all connected states */
475+
string serverName = ServerNameTextBox.Text;
476+
string connectionHeader = _serverVersion != null
477+
? $"Connected to {serverName} ({_serverVersion})"
478+
: $"Connected to {serverName}";
479+
466480
switch (newState)
467481
{
468482
case DialogState.Connected_NoDatabase:
469-
DatabaseStatusText.Text = $"No PerformanceMonitor database found on this server. Install v{appVersion}?";
483+
ConnectionInfoText.Text = connectionHeader;
484+
DatabaseStatusText.Text = "No PerformanceMonitor database found on this server. " +
485+
$"Click Install Now to create the monitoring database, collection jobs, and stored procedures (v{appVersion}).";
470486
InstallUpgradeButton.Content = "Install Now";
471487
DatabaseStatusPanel.Visibility = Visibility.Visible;
472488
InstallationPanel.Visibility = Visibility.Visible;
@@ -475,7 +491,9 @@ private void TransitionToState(DialogState newState)
475491

476492
case DialogState.Connected_NeedsUpgrade:
477493
string normalizedInstalled = NormalizeVersion(_installedVersion!);
478-
DatabaseStatusText.Text = $"v{normalizedInstalled} installed — v{appVersion} available";
494+
ConnectionInfoText.Text = connectionHeader;
495+
DatabaseStatusText.Text = $"PerformanceMonitor v{normalizedInstalled} is installed. " +
496+
$"v{appVersion} is available — click Upgrade Now to apply the update.";
479497
InstallUpgradeButton.Content = "Upgrade Now";
480498
DatabaseStatusPanel.Visibility = Visibility.Visible;
481499
InstallationPanel.Visibility = Visibility.Visible;
@@ -484,6 +502,7 @@ private void TransitionToState(DialogState newState)
484502

485503
case DialogState.Connected_Current:
486504
string normalizedCurrent = NormalizeVersion(_installedVersion!);
505+
ConnectionInfoText.Text = connectionHeader;
487506
DatabaseStatusText.Text = $"PerformanceMonitor v{normalizedCurrent} is up to date.";
488507
InstallUpgradeButton.Visibility = Visibility.Collapsed;
489508
SkipInstallText.Visibility = Visibility.Collapsed;

0 commit comments

Comments
 (0)