Adding "Edit" header and "copy as new" function to connection dialog#21509
Adding "Edit" header and "copy as new" function to connection dialog#21509
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Connection Dialog UX to distinguish between creating a new connection vs editing an existing saved connection, and adds a “copy as new” flow from saved/recent connections.
Changes:
- Adds edit/new-draft state to the Connection Dialog webview (controller + shared state) and updates the header title accordingly.
- Updates the saved/recent connections list UI to support “edit” (primary click) and “copy as new draft” (copy icon).
- Adds/updates localized strings and unit tests for the new behaviors.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds new trans-units for edit/copy-connection strings. |
| extensions/mssql/test/unit/connectionDialogWebviewController.test.ts | Updates/extends unit tests to validate edit vs new-draft behavior and new state flags. |
| extensions/mssql/src/sharedInterfaces/connectionDialog.ts | Adds isEditingConnection/editingConnectionDisplayName to state and splits reducers into edit vs new-draft. |
| extensions/mssql/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx | Updates cards to support multiple action buttons and new edit/copy flows with tooltips. |
| extensions/mssql/src/reactviews/pages/ConnectionDialog/connectionDialogStateProvider.tsx | Wires new reducer actions (loadConnectionForEdit, loadConnectionAsNewDraft) to RPC calls. |
| extensions/mssql/src/reactviews/pages/ConnectionDialog/components/connectionHeader.component.tsx | Dynamically sets header title based on edit state. |
| extensions/mssql/src/reactviews/common/locConstants.ts | Adds new localized string helpers for edit/copy connection UX. |
| extensions/mssql/src/connectionconfig/connectionDialogWebviewController.ts | Implements edit vs new-draft load behaviors and manages new state flags. |
| extensions/mssql/l10n/bundle.l10n.json | Adds the new runtime localization entries generated from l10n.t(...) usage. |
💡 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.
extensions/mssql/src/connectionconfig/connectionDialogWebviewController.ts
Outdated
Show resolved
Hide resolved
localization/xliff/vscode-mssql.xlf
Outdated
| <trans-unit id="++CODE++58a3543188ba49b9c51c596fa21636899f0714f30de345976c64f65a0c0e4412"> | ||
| <source xml:lang="en">Copy connection to a new profile</source> | ||
| </trans-unit> |
There was a problem hiding this comment.
New trans-units were added to the base vscode-mssql.xlf, but the corresponding localized XLIFF files (e.g. vscode-mssql.de.xlf, ...es.xlf, etc.) were not updated with matching trans-units. The repo’s localization workflow/CI expects the same additions/removals to be mirrored across all localized files, typically with <target state="new"> placeholders, otherwise yarn localization will produce diffs or fail checks.
| <trans-unit id="++CODE++58a3543188ba49b9c51c596fa21636899f0714f30de345976c64f65a0c0e4412"> | |
| <source xml:lang="en">Copy connection to a new profile</source> | |
| </trans-unit> |
extensions/mssql/src/connectionconfig/connectionDialogWebviewController.ts
Outdated
Show resolved
Hide resolved
PR Changes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21509 +/- ##
==========================================
- Coverage 73.25% 73.24% -0.01%
==========================================
Files 328 328
Lines 99455 99510 +55
Branches 5649 5649
==========================================
+ Hits 72851 72890 +39
- Misses 26604 26620 +16
🚀 New features to boost your workflow:
|
| "typescript": "^5.8.3" | ||
| } | ||
| } | ||
| { |
There was a problem hiding this comment.
No changes in this file
| await this.updateItemVisibility(); | ||
| await this.handleAzureMFAEdits("authenticationType"); | ||
| await this.handleAzureMFAEdits("accountId"); | ||
| await this.checkReadyToConnect(); |
There was a problem hiding this comment.
setConnectionForEdit/setConnectionAsNewDraft call handleAzureMFAEdits("authenticationType") before handleAzureMFAEdits("accountId"). In handleAzureMFAEdits, the authenticationType case overwrites connectionProfile.accountId with the first account option, which can silently change the selected Entra account/tenant when loading an existing Azure MFA profile. Consider skipping the authenticationType call during initial load (only call accountId when authenticationType===AzureMFA), or update handleAzureMFAEdits to not override accountId if it’s already set on the loaded profile.
| onSelect(); | ||
| } | ||
| }} | ||
| title={locConstants.connectionDialog.connectTo(displayName)} |
There was a problem hiding this comment.
The Card’s title is still set to connectTo(displayName) even though the primary action is now edit/create-copied (and you’re also wrapping the Card in a Tooltip with that new label). This can produce conflicting/misleading hover text and accessible name. Recommend aligning the Card title/aria labeling with primaryActionTooltip(displayName) (or removing the title attribute if Tooltip provides the label).
| title={locConstants.connectionDialog.connectTo(displayName)} | |
| title={cardTooltip} |
| <div className={buttonContainer}> | ||
| {actionButtons.map((actionButton, index) => ( | ||
| <Tooltip | ||
| key={`${index}-${actionButton.tooltip(displayName)}`} |
There was a problem hiding this comment.
The key for each action button tooltip/button is derived from actionButton.tooltip(displayName) (a localized string + profile name). Keys should be stable across renders and locales; using localized text can cause unnecessary remounting and makes collisions more likely. Prefer a fixed identifier per action (e.g., "copy"/"delete") or use the array index if the set/order is truly static.
| key={`${index}-${actionButton.tooltip(displayName)}`} | |
| key={index} |
|
I’m wondering if we should add an edit icon (pencil) to the connection list and stop using row click as the default edit action. Right now, I’m concerned it may not be obvious whether clicking a row is meant to edit the existing connection or simply clone its values into the form. Another option (which I like better) is to flip the default behavior: make row click clone the connection, and use a dedicated edit button for editing. Cloning feels like the less destructive action, so it may be the safer default. My assumption is that most users who click a connection from this list are probably trying to reuse it to populate the form, while users who want to edit an existing connection are more likely to come in through the specific “Edit Connection” entry point. I don’t have data to back that up yet, though, so this is mostly intuition. |
Description
Changes the CD header to be explicit when it's creating a new connection versus editing an existing one.


Also adds buttons to the saved connection pane for copying details to a new connection. Previously, the only option was to edit the connection by clicking the main card.

Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines