diff --git a/src/sql/platform/connection/common/connectionConfig.ts b/src/sql/platform/connection/common/connectionConfig.ts index a3a60a25ee..26820aa57d 100644 --- a/src/sql/platform/connection/common/connectionConfig.ts +++ b/src/sql/platform/connection/common/connectionConfig.ts @@ -93,8 +93,6 @@ export class ConnectionConfig { }); if (sameProfileInList) { let profileIndex = profiles.findIndex(value => value === sameProfileInList); - newProfile.id = sameProfileInList.id; - connectionProfile.id = sameProfileInList.id; profiles[profileIndex] = newProfile; } else { profiles.push(newProfile); diff --git a/src/sql/platform/connection/test/common/connectionConfig.test.ts b/src/sql/platform/connection/test/common/connectionConfig.test.ts index 76a7a30964..03ff595c19 100644 --- a/src/sql/platform/connection/test/common/connectionConfig.test.ts +++ b/src/sql/platform/connection/test/common/connectionConfig.test.ts @@ -325,9 +325,8 @@ suite('ConnectionConfig', () => { connectionProfile.options['databaseDisplayName'] = existingConnection.options['databaseName']; let config = new ConnectionConfig(configurationService, capabilitiesService.object); - let savedConnectionProfile = await config.addConnection(connectionProfile); + await config.addConnection(connectionProfile); - assert.strictEqual(savedConnectionProfile.id, existingConnection.id); assert.strictEqual(configurationService.inspect('datasource.connections').userValue!.length, testConnections.length); }); diff --git a/src/sql/workbench/services/connection/browser/connectionDialogService.ts b/src/sql/workbench/services/connection/browser/connectionDialogService.ts index c694364099..693388396f 100644 --- a/src/sql/workbench/services/connection/browser/connectionDialogService.ts +++ b/src/sql/workbench/services/connection/browser/connectionDialogService.ts @@ -177,11 +177,6 @@ export class ConnectionDialogService implements IConnectionDialogService { return; } profile = result.connection; - - if (params.oldProfileId && params.isEditConnection) { - profile.id = params.oldProfileId; - } - profile.serverName = trim(profile.serverName); // append the port to the server name for SQL Server connections diff --git a/src/sql/workbench/services/connection/browser/connectionManagementService.ts b/src/sql/workbench/services/connection/browser/connectionManagementService.ts index 5c99d584db..02a17d8c25 100644 --- a/src/sql/workbench/services/connection/browser/connectionManagementService.ts +++ b/src/sql/workbench/services/connection/browser/connectionManagementService.ts @@ -498,17 +498,13 @@ export class ConnectionManagementService extends Disposable implements IConnecti // a connection management info. See https://github.com/microsoft/azuredatastudio/issues/16556 this.tryAddActiveConnection(connectionMgmtInfo, connection, options.saveTheConnection); - - if (callbacks.onConnectSuccess) { callbacks.onConnectSuccess(options.params, connectionResult.connectionProfile); } if (options.saveTheConnection || isEdit) { let matcher: interfaces.ProfileMatcher; if (isEdit) { - matcher = (a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile) => { - return a.id === b.id; - }; + matcher = (a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile) => a.id === options.params.oldProfileId; } await this.saveToSettings(uri, connection, matcher).then(value => { diff --git a/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts b/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts index 6f4a15771f..224af85463 100644 --- a/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts +++ b/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts @@ -70,6 +70,7 @@ export class ServerTreeActionProvider { */ private getConnectionActions(tree: AsyncServerTree | ITree, profile: ConnectionProfile): IAction[] { let node = new TreeNode(NodeType.Server, NodeType.Server, '', false, '', '', '', undefined, undefined, undefined, undefined); + this._connectionManagementService.addSavedPassword(profile); node.connection = profile; return this.getAllActions({ tree: tree,