Add optional initial database to Connect dialog (#358)#359
Merged
Conversation
The Connect to Server dialog always tested connections against master and enumerated sys.databases to populate the database dropdown. For Azure SQL DB or Just-In-Time access the login often can't open master, so the test failed and the dropdown never populated, leaving no way to reach Connect. Add an optional "Initial database" field. When set, Test Connection connects directly to that database instead of master, ensures it stays selectable even under restricted permissions, and pre-selects it in the database dropdown. When empty, behavior is unchanged (connect to master, enumerate, pick). The database name is persisted on ServerConnection and restored for saved connections. Mirrors the DatabaseName field already used in PerformanceMonitor's Add/Edit Server dialog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #358. For Azure SQL DB / Just-In-Time access, the consultant's login often can't open
master— but the Connect dialog always tested againstmasterand enumeratedsys.databasesto populate the database dropdown, so the test failed and the dropdown never populated, leaving no path to Connect.This adds an optional "Initial database" field to the Connect dialog (ported from the
DatabaseNamefield already used in PerformanceMonitor's Add/Edit Server dialog).Behavior
master, enumerates databases, you pick from the dropdown.master; the named DB is guaranteed selectable even under restricted JIT permissions, and it's pre-selected in the dropdown. The name is persisted onServerConnectionand restored for saved connections.Changes
PlanViewer.Core/Models/ServerConnection.cs— added optionalDatabaseNameproperty.PlanViewer.App/Dialogs/ConnectionDialog.axaml— added the "Initial database (optional)" text box above Test Connection; bumped fixed window height to fit.PlanViewer.App/Dialogs/ConnectionDialog.axaml.cs— wired the typed database intoTestConnection_Click(connect target + pre-select),BuildServerConnection(persist), andApplySavedConnection(restore).Testing
🤖 Generated with Claude Code