mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix Edit Connection behavior that affects multiple areas working with edited connection (#20907)
This commit is contained in:
@@ -93,8 +93,6 @@ export class ConnectionConfig {
|
|||||||
});
|
});
|
||||||
if (sameProfileInList) {
|
if (sameProfileInList) {
|
||||||
let profileIndex = profiles.findIndex(value => value === sameProfileInList);
|
let profileIndex = profiles.findIndex(value => value === sameProfileInList);
|
||||||
newProfile.id = sameProfileInList.id;
|
|
||||||
connectionProfile.id = sameProfileInList.id;
|
|
||||||
profiles[profileIndex] = newProfile;
|
profiles[profileIndex] = newProfile;
|
||||||
} else {
|
} else {
|
||||||
profiles.push(newProfile);
|
profiles.push(newProfile);
|
||||||
|
|||||||
@@ -325,9 +325,8 @@ suite('ConnectionConfig', () => {
|
|||||||
connectionProfile.options['databaseDisplayName'] = existingConnection.options['databaseName'];
|
connectionProfile.options['databaseDisplayName'] = existingConnection.options['databaseName'];
|
||||||
|
|
||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
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<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
|
assert.strictEqual(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -177,11 +177,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
profile = result.connection;
|
profile = result.connection;
|
||||||
|
|
||||||
if (params.oldProfileId && params.isEditConnection) {
|
|
||||||
profile.id = params.oldProfileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.serverName = trim(profile.serverName);
|
profile.serverName = trim(profile.serverName);
|
||||||
|
|
||||||
// append the port to the server name for SQL Server connections
|
// append the port to the server name for SQL Server connections
|
||||||
|
|||||||
@@ -498,17 +498,13 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
// a connection management info. See https://github.com/microsoft/azuredatastudio/issues/16556
|
// a connection management info. See https://github.com/microsoft/azuredatastudio/issues/16556
|
||||||
this.tryAddActiveConnection(connectionMgmtInfo, connection, options.saveTheConnection);
|
this.tryAddActiveConnection(connectionMgmtInfo, connection, options.saveTheConnection);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (callbacks.onConnectSuccess) {
|
if (callbacks.onConnectSuccess) {
|
||||||
callbacks.onConnectSuccess(options.params, connectionResult.connectionProfile);
|
callbacks.onConnectSuccess(options.params, connectionResult.connectionProfile);
|
||||||
}
|
}
|
||||||
if (options.saveTheConnection || isEdit) {
|
if (options.saveTheConnection || isEdit) {
|
||||||
let matcher: interfaces.ProfileMatcher;
|
let matcher: interfaces.ProfileMatcher;
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
matcher = (a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile) => {
|
matcher = (a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile) => a.id === options.params.oldProfileId;
|
||||||
return a.id === b.id;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.saveToSettings(uri, connection, matcher).then(value => {
|
await this.saveToSettings(uri, connection, matcher).then(value => {
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export class ServerTreeActionProvider {
|
|||||||
*/
|
*/
|
||||||
private getConnectionActions(tree: AsyncServerTree | ITree, profile: ConnectionProfile): IAction[] {
|
private getConnectionActions(tree: AsyncServerTree | ITree, profile: ConnectionProfile): IAction[] {
|
||||||
let node = new TreeNode(NodeType.Server, NodeType.Server, '', false, '', '', '', undefined, undefined, undefined, undefined);
|
let node = new TreeNode(NodeType.Server, NodeType.Server, '', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||||
|
this._connectionManagementService.addSavedPassword(profile);
|
||||||
node.connection = profile;
|
node.connection = profile;
|
||||||
return this.getAllActions({
|
return this.getAllActions({
|
||||||
tree: tree,
|
tree: tree,
|
||||||
|
|||||||
Reference in New Issue
Block a user