Revert new connection string format (#22997)

This commit is contained in:
Alex Ma
2023-05-05 13:41:40 -07:00
committed by GitHub
parent 27e0d67dec
commit 898bb73a34
34 changed files with 77 additions and 1690 deletions

View File

@@ -539,22 +539,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
let isEdit = options?.params?.isEditConnection ?? false;
let matcher: interfaces.ProfileMatcher;
if (isEdit) {
matcher = (a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile) => a.id === options.params.oldProfileId;
//Check to make sure the edits are not identical to another connection.
await this._connectionStore.isDuplicateEdit(connection, matcher).then(result => {
if (result) {
// Must get connection group name here as it may not always be initialized and causes problems when deleting when included with options.
this._logService.error(`Profile edit for '${connection.id}' exactly matches an existing profile with data: '${ConnectionProfile.getDisplayOptionsKey(connection.getOptionsKey())}'`);
throw new Error(`Cannot save profile, the selected connection options are identical to an existing profile with details: \n
${ConnectionProfile.getDisplayOptionsKey(connection.getOptionsKey())}${(connection.groupFullName !== undefined && connection.groupFullName !== '' && connection.groupFullName !== '/') ?
ConnectionProfile.displayIdSeparator + 'groupName' + ConnectionProfile.displayNameValueSeparator + connection.groupFullName : ''}`);
}
});
}
if (!uri) {
uri = Utils.generateUri(connection);
}
@@ -602,6 +586,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
callbacks.onConnectSuccess(options.params, connectionResult.connectionProfile);
}
if (options.saveTheConnection || isEdit) {
let matcher: interfaces.ProfileMatcher;
if (isEdit) {
matcher = (a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile) => a.id === options.params.oldProfileId;
}
await this.saveToSettings(uri, connection, matcher).then(value => {
this._onAddConnectionProfile.fire(connection);
if (isEdit) {
@@ -709,20 +698,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return result;
}
public getEditorConnectionProfileTitle(profile: interfaces.IConnectionProfile, getNonDefaultsOnly?: boolean): string {
let result = '';
if (profile) {
let tempProfile = new ConnectionProfile(this._capabilitiesService, profile);
if (!getNonDefaultsOnly) {
result = tempProfile.getEditorFullTitleWithOptions();
}
else {
result = tempProfile.getNonDefaultOptionsString();
}
}
return result;
}
private doActionsAfterConnectionComplete(uri: string, options: IConnectionCompletionOptions): void {
let connectionManagementInfo = this._connectionStatusManager.findConnection(uri);
if (!connectionManagementInfo) {
@@ -1295,7 +1270,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
this._connectionGlobalStatus.setStatusToConnected(info.connectionSummary);
}
const connectionUniqueId = connection.connectionProfile.getOptionsKey();
const connectionUniqueId = connection.connectionProfile.getConnectionInfoId();
if (info.isSupportedVersion === false
&& this._connectionsGotUnsupportedVersionWarning.indexOf(connectionUniqueId) === -1
&& this._configurationService.getValue<boolean>('connection.showUnsupportedServerVersionWarning')) {