Skip to content

Conversation

ssreerama
Copy link
Contributor

@ssreerama ssreerama commented Oct 15, 2025

Pull Request Template – vscode-mssql

Description

  • This PR Introduces a new workflow for selecting SQL Server connections in the Publish Project dialog.
  • Enhances user experience by allowing:
    • Connecting to a server.
    • Selecting a database via a dropdown.
  • Reduces manual input errors and streamlines the publishing process.
  • UI Improvements:
    • Added Server and Database fields in the dialog.
  • Clicking the New Connection icon:
    • Opens the connection dialog.
    • Allows users to connect to their target server.

Once connected:

The Database field auto-populates with available databases.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

3 ConnectionSection

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements a connection selection workflow for the Publish Project dialog, enabling users to select SQL Server connections and databases through an improved UI. The changes integrate ConnectionManager to track active connections, automatically populate server and database fields when a new connection is made, and provide a streamlined experience with a "Select Connection" button and database dropdown.

Key Changes:

  • Added connection selection workflow that opens a connection dialog and auto-populates server/database fields when a new connection is established
  • Converted database input field to a combobox dropdown populated with databases from the selected server connection
  • Added connection string management for publish profiles with different handling for container vs. server targets

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/unit/publishProjectWebViewController.test.ts Added mock ConnectionManager to tests and updated test descriptions for clarity
src/sharedInterfaces/publishDialog.ts Added connection-related state properties and openConnectionDialog reducer interface
src/reactviews/pages/PublishProject/publishProjectStateProvider.tsx Integrated openConnectionDialog action into the state provider
src/reactviews/pages/PublishProject/components/PublishTargetSection.tsx Applied consistent styling wrapper to the publish target section
src/reactviews/pages/PublishProject/components/PublishProfileSection.tsx Applied consistent styling wrapper to the publish profile section
src/reactviews/pages/PublishProject/components/FormFieldComponents.tsx Added renderCombobox function and contentAfter option to renderInput for custom content after input fields
src/reactviews/pages/PublishProject/components/ConnectionSection.tsx Refactored to use read-only server input with connection button and combobox for database selection
src/reactviews/index.css Added styling for Combobox component to match VS Code theme
src/publishProject/publishProjectWebViewController.ts Integrated ConnectionManager, added connection listener, implemented auto-selection logic, and added database dropdown management based on publish target
src/publishProject/formComponentHelpers.ts Updated form generation to create database as dropdown with initial options and added placeholder for server field
src/controllers/mainController.ts Passed ConnectionManager instance to PublishProjectWebViewController constructor
src/constants/locConstants.ts Added ServerConnectionPlaceholder localization constant
localization/xliff/vscode-mssql.xlf Added "Select Connection" translation entry
localization/l10n/bundle.l10n.json Added "Select Connection" localization entry

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@aasimkhan30 aasimkhan30 self-requested a review October 17, 2025 15:34
Copy link
Contributor

@aasimkhan30 aasimkhan30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the event used for listening to new connections.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 354 to 357
const connectionProfile = connection?.credentials as IConnectionProfile;

if (!connectionProfile || !connectionProfile.server) {
return; // Connection no longer available or invalid
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connection is retrieved from activeConnections without checking if it exists before accessing credentials. If the connection doesn't exist, connection will be undefined, and connection?.credentials will be undefined, which is then cast to IConnectionProfile. The subsequent check on line 356 for !connectionProfile may not catch all error cases. Consider checking !connection first before accessing credentials.

Suggested change
const connectionProfile = connection?.credentials as IConnectionProfile;
if (!connectionProfile || !connectionProfile.server) {
return; // Connection no longer available or invalid
if (!connection) {
return; // Connection no longer available
}
const connectionProfile = connection.credentials as IConnectionProfile;
if (!connectionProfile || !connectionProfile.server) {
return; // Connection profile invalid

Copilot uses AI. Check for mistakes.

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.

2 participants