Skip to content

Improve experience when adding server - Save tests the connection#291

Merged
erikdarlingdata merged 14 commits intoerikdarlingdata:devfrom
ClaudioESSilva:feature/ConnectionSaving-issue-29
Feb 26, 2026
Merged

Improve experience when adding server - Save tests the connection#291
erikdarlingdata merged 14 commits intoerikdarlingdata:devfrom
ClaudioESSilva:feature/ConnectionSaving-issue-29

Conversation

@ClaudioESSilva
Copy link
Contributor

What does this PR do?

Fixes #29

Which component(s) does this affect?

  • Full Dashboard
  • Lite
  • SQL collection scripts
  • Installer
  • Documentation

How was this tested?

Tested on the Dashboard version by using the wrong password and hit "Save" button:
image

For the Lite version, this is how it will show
image

Now, on both versions, when testing the connection, the "Save" button also becomes disabled.

Checklist

  • I have read the contributing guide
  • My code builds with zero warnings (dotnet build -c Debug)

Important

It has some warnings CA1873, but that isn't related to anything I've changed.
For reference, I forked and updated from a recent dev branch

  • I have tested my changes against at least one SQL Server version
  • I have not introduced any hardcoded credentials or server names

Copy link
Owner

@erikdarlingdata erikdarlingdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! The core idea — testing the connection on Save — is good. A few things need to be addressed before this can merge:

Bug: Dashboard XAML missing RowDefinition

StatusText is placed at Grid.Row="2" and the buttons moved to Grid.Row="3", but the Grid only defines 3 rows (0-2). WPF won't crash but elements will overlap. Add a 4th RowDefinition Height="Auto" for the new StatusText row.

IsEnabled on ServerConnection — add the UI or remove the property

The IsEnabled property is added to the Dashboard model but there's no checkbox in the XAML to set it. It's dead code that will serialize to JSON but never be consumed. Either add the "Enable data collection" checkbox to the Dashboard dialog (like Lite has) or remove this property from the PR.

Dashboard should support Entra MFA authentication

If the goal is parity, Dashboard is still missing Entra MFA as an auth option. Dashboard can connect to Azure Managed Instance, which supports Entra MFA. Lite already has this — Dashboard should too.

Failure feedback should use MessageBox, not inline StatusText

Failures should be loud and obvious (MessageBox), not rely on inline text that the user might miss. The Dashboard side does this correctly (MessageBox on failure), but the Lite side was changed to use inline StatusText for save failures — keep it as a MessageBox.

Keep SELECT @@VERSION in the connection test

The PR removes the SELECT @@VERSION test query from Lite's test handler. That query confirmed the connection was fully functional and showed the server version — useful feedback. Please keep it.

Connection string should be built the same way

Dashboard uses DatabaseService.BuildConnectionString() while Lite builds a SqlConnectionStringBuilder directly. These should use the same approach for consistency and to avoid drift.

Copy link
Owner

@erikdarlingdata erikdarlingdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate review — please disregard. See the other review for feedback.

@ClaudioESSilva
Copy link
Contributor Author

Screenshots of it after these changes:

Dashboard

Testing connection

When it works
image

When it doesn't work:
image

Saving

When the connection test fails:
image

Lite

Testing Connection

When it works:
image

When it doesn't work:
image

Saving with "Enable data collection for this server" checked

image

@ClaudioESSilva
Copy link
Contributor Author

@erikdarlingdata, for "Dashboard should support Entra MFA authentication".

Should we test the connection against the InitialCatalog = "PerformanceMonitor"?
Otherwise, it can give a false positive because it can reach the server, but then it won't be able to access the specific database and will show a red status.

image

If you agree with it, that is the current state of this PR.
If not, let me know and I can adjust.

@erikdarlingdata
Copy link
Owner

@ClaudioESSilva yes please, it should not ever look at any other database.

@ClaudioESSilva
Copy link
Contributor Author

Then, it's already there! 🙌🏼
Please let me know if anything else is needed on this PR.

Copy link
Owner

@erikdarlingdata erikdarlingdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid contribution — all first-round review items addressed. Code quality is good and backward compatibility is handled correctly.

Highlights:

  • Clean UseWindowsAuthAuthenticationType migration shim for old servers.json files
  • MFA cancellation handling prevents nagging popup loops during background checks
  • Good refactoring: BuildConnectionBuilder(), ValidateInputs(), RunConnectionTestAsync() consolidate duplicated logic
  • Smart Save behavior distinction: Dashboard offers "save anyway?" on failure, Lite blocks save when collection is enabled (correct since Lite collects immediately)

Minor notes (not blockers):

  • ConnectTimeout is 10s in dialog test vs 15s at runtime in GetConnectionString() — fine but worth knowing
  • MFA connection builder logic exists in both AddServerDialog.BuildConnectionBuilder() and ServerConnection.GetConnectionString() — could drift over time, but acceptable for now

Ready to merge. Thanks @ClaudioESSilva!

@erikdarlingdata erikdarlingdata merged commit c65db2b into erikdarlingdata:dev Feb 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants