Fix to load default database in dacpac dialog when user lacks permissions#21491
Fix to load default database in dacpac dialog when user lacks permissions#21491allancascante wants to merge 4 commits intomainfrom
Conversation
…DATABASE permission (#21414)
There was a problem hiding this comment.
Pull request overview
Updates the DACPAC/BACPAC dialog to better handle connections where the user cannot list all databases (e.g., missing LIST ANY DATABASE), by falling back to the connection’s database and improving UX while databases are being fetched.
Changes:
- Add backend fallback logic for database listing failures (and propagate an
errorMessageto the webview) while ensuring the connection database can still be selected. - Add UI loading state (spinner) while databases are being retrieved and default-selection behavior based on the connection database.
- Extend RPC contracts + add/adjust unit tests and localization strings for the new UX text.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds new localized source string for database-loading UX text. |
| extensions/mssql/l10n/bundle.l10n.json | Adds the "Loading databases..." key for VS Code l10n. |
| extensions/mssql/src/reactviews/common/locConstants.ts | Introduces dacpacDialog.loadingDatabases localized constant. |
| extensions/mssql/src/sharedInterfaces/dacpacDialog.ts | Extends RPC response shapes (errorMessage for list, databaseName for connect). |
| extensions/mssql/src/reactviews/pages/DacpacDialog/dacpacDialogStateProvider.tsx | Updates webview RPC method typings to match updated contracts. |
| extensions/mssql/src/controllers/dacpacDialogWebviewController.ts | Implements database listing fallback to state database; returns connection database name on connect. |
| extensions/mssql/src/reactviews/pages/DacpacDialog/dacpacDialogForm.tsx | Tracks connection database, adds database-loading state, and improved defaulting/reset behavior. |
| extensions/mssql/src/reactviews/pages/DacpacDialog/SourceDatabaseSection.tsx | Shows a spinner while databases are loading instead of an empty/disabled dropdown. |
| extensions/mssql/src/reactviews/pages/DacpacDialog/TargetDatabaseSection.tsx | Shows a spinner while databases are loading for target database selection. |
| extensions/mssql/test/unit/dacpacDialogWebviewController.test.ts | Adds coverage for fallback/error propagation behavior and databaseName in connect responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
PR Changes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21491 +/- ##
==========================================
+ Coverage 72.67% 72.69% +0.01%
==========================================
Files 331 331
Lines 98489 98543 +54
Branches 5462 5473 +11
==========================================
+ Hits 71580 71633 +53
- Misses 26909 26910 +1
🚀 New features to boost your workflow:
|
extensions/mssql/src/reactviews/pages/DacpacDialog/TargetDatabaseSection.tsx
Outdated
Show resolved
Hide resolved
extensions/mssql/src/controllers/dacpacDialogWebviewController.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Description
In case user lack LIST ANY DATABASE permission (#21414) default to the connection database in dacpac operations. Also added support to show loading on database to improve user experience on 'slow' connections when trying to pull databases to show and fallback on errors to the default connection database.
Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines