Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Dashboard/AddServerDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Add SQL Server"
Height="750" Width="500"
WindowStartupLocation="CenterOwner"
Width="500"
WindowStartupLocation="Manual"
ResizeMode="CanResizeWithGrip"
Background="{DynamicResource BackgroundBrush}"
Foreground="{DynamicResource ForegroundBrush}">
Expand Down Expand Up @@ -142,6 +142,9 @@
Background="{DynamicResource BackgroundLightBrush}"
CornerRadius="4" Padding="12" Margin="0,0,0,10">
<StackPanel>
<TextBlock x:Name="ConnectionInfoText" TextWrapping="Wrap" Margin="0,0,0,4"
FontWeight="SemiBold"
Foreground="{DynamicResource ForegroundBrush}"/>
<TextBlock x:Name="DatabaseStatusText" TextWrapping="Wrap" Margin="0,0,0,8"
Foreground="{DynamicResource ForegroundBrush}"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
Expand Down
43 changes: 31 additions & 12 deletions Dashboard/AddServerDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ private enum DialogState
private InstallationResult? _installResult;
private string? _reportPath;
private DialogState _currentState = DialogState.Initial;
private string? _serverVersion;

public AddServerDialog()
{
InitializeComponent();
SizeToWorkArea();
_isEditMode = false;
ServerConnection = new ServerConnection();
Title = "Add SQL Server";
Expand All @@ -59,6 +61,7 @@ public AddServerDialog()
public AddServerDialog(ServerConnection existingServer)
{
InitializeComponent();
SizeToWorkArea();
_isEditMode = true;
ServerConnection = existingServer;
Title = "Edit SQL Server";
Expand Down Expand Up @@ -109,6 +112,14 @@ public AddServerDialog(ServerConnection existingServer)
}
}

private void SizeToWorkArea()
{
var workArea = SystemParameters.WorkArea;
Height = workArea.Height;
Top = workArea.Top;
Left = workArea.Left + (workArea.Width - Width) / 2;
}

private void AuthType_Changed(object sender, RoutedEventArgs e)
{
if (SqlAuthPanel != null && EntraMfaPanel != null)
Expand Down Expand Up @@ -341,17 +352,9 @@ private async void TestConnection_Click(object sender, RoutedEventArgs e)

if (connected)
{
var message = serverVersion != null
? $"Successfully connected to {ServerNameTextBox.Text}!\n\n{serverVersion}"
: $"Successfully connected to {ServerNameTextBox.Text}!";
MessageBox.Show(
message,
"Connection Successful",
MessageBoxButton.OK,
MessageBoxImage.Information
);
_serverVersion = serverVersion;

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

if (!_coreServerInfo.IsSupportedVersion)
{
string serverName = ServerNameTextBox.Text;
ConnectionInfoText.Text = _serverVersion != null
? $"Connected to {serverName} ({_serverVersion})"
: $"Connected to {serverName}";
DatabaseStatusText.Text = $"Warning: {_coreServerInfo.ProductMajorVersionName} is not supported. SQL Server 2016+ is required.";
DatabaseStatusPanel.Visibility = Visibility.Visible;
InstallUpgradeButton.Visibility = Visibility.Collapsed;
Expand Down Expand Up @@ -460,13 +467,22 @@ private void TransitionToState(DialogState newState)
ViewReportButton.Visibility = Visibility.Collapsed;
StatusText.Text = string.Empty;
StatusText.Visibility = Visibility.Collapsed;
ConnectionInfoText.Text = string.Empty;
InstallUpgradeButton.Visibility = Visibility.Visible;
SkipInstallText.Visibility = Visibility.Visible;

/* Build the connection header shown for all connected states */
string serverName = ServerNameTextBox.Text;
string connectionHeader = _serverVersion != null
? $"Connected to {serverName} ({_serverVersion})"
: $"Connected to {serverName}";

switch (newState)
{
case DialogState.Connected_NoDatabase:
DatabaseStatusText.Text = $"No PerformanceMonitor database found on this server. Install v{appVersion}?";
ConnectionInfoText.Text = connectionHeader;
DatabaseStatusText.Text = "No PerformanceMonitor database found on this server. " +
$"Click Install Now to create the monitoring database, collection jobs, and stored procedures (v{appVersion}).";
InstallUpgradeButton.Content = "Install Now";
DatabaseStatusPanel.Visibility = Visibility.Visible;
InstallationPanel.Visibility = Visibility.Visible;
Expand All @@ -475,7 +491,9 @@ private void TransitionToState(DialogState newState)

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

case DialogState.Connected_Current:
string normalizedCurrent = NormalizeVersion(_installedVersion!);
ConnectionInfoText.Text = connectionHeader;
DatabaseStatusText.Text = $"PerformanceMonitor v{normalizedCurrent} is up to date.";
InstallUpgradeButton.Visibility = Visibility.Collapsed;
SkipInstallText.Visibility = Visibility.Collapsed;
Expand Down
2 changes: 1 addition & 1 deletion Dashboard/Controls/FinOpsContent.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2459,7 +2459,7 @@
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="CpuCount" Click="FinOpsFilter_Click" Margin="0,0,4,0"/>
<TextBlock Text="CPUs" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock Text="Logical CPUs" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
</DataGridTextColumn.Header>
<DataGridTextColumn.ElementStyle>
Expand Down
2 changes: 1 addition & 1 deletion Lite/Controls/FinOpsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="CpuCount" Click="FilterButton_Click" Margin="0,0,4,0"/>
<TextBlock Text="CPUs" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock Text="Logical CPUs" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
</DataGridTextColumn.Header>
<DataGridTextColumn.ElementStyle>
Expand Down
11 changes: 1 addition & 10 deletions Lite/Controls/ServerTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,7 @@
};
_refreshTimer.Tick += async (s, e) =>
{
if (_isRefreshing) return;
_isRefreshing = true;
try
{
await RefreshAllDataAsync(fullRefresh: false);
}
finally
{
_isRefreshing = false;
}
await RefreshAllDataAsync(fullRefresh: false);
};
_refreshTimer.Start();

Expand Down Expand Up @@ -848,7 +839,7 @@
}

var tz = ServerTimeHelper.GetTimezoneLabel(ServerTimeHelper.CurrentDisplayMode);
ConnectionStatusText.Text = $"{_server.ServerNameDisplay} - Last refresh: {DateTime.Now:HH:mm:ss} ({tz})";

Check warning on line 842 in Lite/Controls/ServerTab.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
}
catch (Exception ex)
{
Expand Down
Loading