Skip to content

Add optional initial database to Connect dialog (#358)#359

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/azure-initial-database
Jun 5, 2026
Merged

Add optional initial database to Connect dialog (#358)#359
erikdarlingdata merged 1 commit into
devfrom
feature/azure-initial-database

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

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 against master and enumerated sys.databases to 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 DatabaseName field already used in PerformanceMonitor's Add/Edit Server dialog).

Behavior

  • Field empty → unchanged: Test Connection connects to master, enumerates databases, you pick from the dropdown.
  • Field set → Test Connection connects directly to that database instead of master; the named DB is guaranteed selectable even under restricted JIT permissions, and it's pre-selected in the dropdown. The name is persisted on ServerConnection and restored for saved connections.

Changes

  • PlanViewer.Core/Models/ServerConnection.cs — added optional DatabaseName property.
  • 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 into TestConnection_Click (connect target + pre-select), BuildServerConnection (persist), and ApplySavedConnection (restore).

Testing

  • Builds clean; app launches and the dialog renders the new field correctly.
  • Avalonia review: no layout clipping (flexible spacer row absorbs the added height), valid Avalonia property usages.
  • ⚠️ The Azure SQL DB / JIT path itself is not yet verified against a live Azure SQL DB — asking the issue author (@benjamin-szczur) to test that flow.

🤖 Generated with Claude Code

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>
@erikdarlingdata erikdarlingdata changed the base branch from main to dev June 5, 2026 18:48
@erikdarlingdata erikdarlingdata merged commit b97e1cd into dev Jun 5, 2026
3 of 4 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/azure-initial-database branch June 5, 2026 18:52
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.

[FEATURE] JIT access to Azure SQL DB needs database name to test the connection

1 participant