Fixing database selection logic and adding state indicators - #22710
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to make DACPAC dialog database selection more consistent when switching servers / launch points by using the selected connection’s database (instead of initial state) as the preferred/fallback database, and by adding UI loading indicators while databases are being fetched.
Changes:
- Updated the list-databases request/handler contract to accept an optional
connectionDatabaseNameand use it as the preferred/fallback database. - Refactored DACPAC dialog form state to separate “new database name” vs “existing database name”, and added loading spinners/disabled states while loading databases.
- Updated/added unit tests and introduced a localized “Loading databases…” string for the webview UI.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds a new localized source string for “Loading databases…”. |
| extensions/mssql/test/unit/dacpacDialogWebviewController.test.ts | Updates tests for new connectionDatabaseName behavior and adds a regression test for connection switching. |
| extensions/mssql/src/webviews/pages/DacpacDialog/TargetDatabaseSection.tsx | Adds loading indicators and separates new vs existing target database selection state. |
| extensions/mssql/src/webviews/pages/DacpacDialog/SourceDatabaseSection.tsx | Adds loading indicators and “database already exists” warning support for new database entry. |
| extensions/mssql/src/webviews/pages/DacpacDialog/ServerSelectionSection.tsx | Updates layout to use horizontal Field orientation. |
| extensions/mssql/src/webviews/pages/DacpacDialog/FilePathSection.tsx | Updates layout to use horizontal Field orientation. |
| extensions/mssql/src/webviews/pages/DacpacDialog/dacpacDialogStateProvider.tsx | Extends RPC method signature to pass through connectionDatabaseName. |
| extensions/mssql/src/webviews/pages/DacpacDialog/dacpacDialogForm.tsx | Refactors form state and database-loading logic; adds loading state + caching. |
| extensions/mssql/src/webviews/pages/DacpacDialog/ApplicationInfoSection.tsx | Updates layout to use horizontal Field orientation. |
| extensions/mssql/src/webviews/common/locConstants.ts | Adds a new loadingDatabases localized string for webviews. |
| extensions/mssql/src/sharedInterfaces/dacpacDialog.ts | Updates ListDatabasesWebviewRequest params to include connectionDatabaseName?. |
| extensions/mssql/src/controllers/dacpacDialogWebviewController.ts | Updates database listing logic to prefer/fallback to selected connection database (vs initial state). |
| extensions/mssql/l10n/bundle.l10n.json | Adds the new “Loading databases…” string to the webview localization bundle. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }); | ||
| } | ||
| } | ||
| const cacheKey = ownerUri; |
| if ( | ||
| stateDatabaseName && | ||
| !isSystemDatabase(stateDatabaseName) && | ||
| !userDatabases.includes(stateDatabaseName) | ||
| connectionDatabaseName && | ||
| !isSystemDatabase(connectionDatabaseName) && | ||
| !userDatabases.includes(connectionDatabaseName) | ||
| ) { |
PR Changes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22710 +/- ##
==========================================
- Coverage 88.87% 87.73% -1.14%
==========================================
Files 340 340
Lines 119790 119790
Branches 552 552
==========================================
- Hits 106461 105098 -1363
- Misses 13329 14692 +1363
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Description
Addresses #22711
This PR addresses a smattering of inconsistent behaviors in the dacpac dialog
Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines