mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Fix connection URI default value comparisons (#23705)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||
"version": "4.8.0.39",
|
||||
"version": "4.9.0.1",
|
||||
"downloadFileNames": {
|
||||
"Windows_86": "win-x86-net7.0.zip",
|
||||
"Windows_64": "win-x64-net7.0.zip",
|
||||
|
||||
@@ -359,10 +359,10 @@ export class ConnectionConfig {
|
||||
let profiles = this.getIConnectionProfileStores(true);
|
||||
let existingProfile = profiles.find(p =>
|
||||
p.providerName === profile.providerName &&
|
||||
p.options.authenticationType === profile.options.authenticationType &&
|
||||
p.options.database === profile.options.database &&
|
||||
p.options.server === profile.options.server &&
|
||||
p.options.user === profile.options.user &&
|
||||
this.checkIfAuthenticationOptionsMatch(p, profile) &&
|
||||
p.options.databaseName === profile.options.databaseName &&
|
||||
p.options.serverName === profile.options.serverName &&
|
||||
p.options.userName === profile.options.userName &&
|
||||
p.options.connectionName === profile.options.connectionName &&
|
||||
p.groupId === newGroupID &&
|
||||
this.checkIfNonDefaultOptionsMatch(p, profile));
|
||||
@@ -375,6 +375,10 @@ export class ConnectionConfig {
|
||||
return result;
|
||||
}
|
||||
|
||||
private checkIfAuthenticationOptionsMatch(profileStore: IConnectionProfileStore, profile: ConnectionProfile): boolean {
|
||||
return ((profileStore.options.authenticationType === undefined || profileStore.options.authenticationType === '') && (profile.options.authenticationType === undefined || profile.options.authenticationType === '')) || profileStore.options.authenticationType === profile.options.authenticationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the connection under the target group with the new ID.
|
||||
*/
|
||||
|
||||
@@ -81,7 +81,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
// Set values for advanced options received in model.
|
||||
Object.keys(model.options).forEach(a => {
|
||||
let option = options.find(opt => opt.name === a);
|
||||
if (option !== undefined) {
|
||||
if (option !== undefined && option.defaultValue?.toString().toLocaleLowerCase() !== model.options[a]?.toString().toLocaleLowerCase()) {
|
||||
this.options[option.name] = model.options[a];
|
||||
}
|
||||
});
|
||||
@@ -358,7 +358,11 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
id: connectionInfo.id
|
||||
};
|
||||
|
||||
profile.options = connectionInfo.options;
|
||||
Object.keys(connectionInfo.options).forEach(element => {
|
||||
if (connectionInfo.options[element] && connectionInfo.options[element] !== null && connectionInfo.options[element] !== '') {
|
||||
profile.options[element] = connectionInfo.options[element];
|
||||
}
|
||||
});
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,8 @@ export class ProviderConnectionInfo implements azdata.ConnectionInfo {
|
||||
let finalValue = undefined;
|
||||
let options = this.serverCapabilities.connectionOptions.filter(value => value.name === idNames[index]!);
|
||||
if (options.length > 0 && value) {
|
||||
finalValue = value !== options[0].defaultValue ? value : undefined;
|
||||
let defaultValue = options[0].defaultValue ?? '';
|
||||
finalValue = value && value.toString().toLocaleLowerCase() !== defaultValue.toString().toLocaleLowerCase() ? value : undefined;
|
||||
if (options[0].specialValueType === 'appName' && this.providerName === Constants.mssqlProviderName) {
|
||||
finalValue = (value as string).startsWith('azdata') ? undefined : finalValue
|
||||
}
|
||||
@@ -390,7 +391,7 @@ export class ProviderConnectionInfo implements azdata.ConnectionInfo {
|
||||
element.specialValueType !== ConnectionOptionSpecialType.password) {
|
||||
if (getNonDefault) {
|
||||
let value = this.getOptionValue(element.name);
|
||||
if (value && value !== element.defaultValue) {
|
||||
if (value && value.toString().toLocaleLowerCase() !== element.defaultValue?.toLocaleLowerCase()) {
|
||||
connectionOptions.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: ''
|
||||
authenticationType: 'SqlLogin'
|
||||
},
|
||||
providerName: 'MSSQL',
|
||||
groupId: 'test',
|
||||
@@ -95,7 +95,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: ''
|
||||
authenticationType: 'SqlLogin'
|
||||
},
|
||||
providerName: 'MSSQL',
|
||||
groupId: 'test',
|
||||
@@ -108,7 +108,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: ''
|
||||
authenticationType: 'SqlLogin'
|
||||
},
|
||||
providerName: 'MSSQL',
|
||||
groupId: 'g3',
|
||||
@@ -296,7 +296,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: undefined,
|
||||
groupId: undefined,
|
||||
@@ -364,7 +364,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g2/g2-2',
|
||||
groupId: undefined,
|
||||
@@ -509,7 +509,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -541,7 +541,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -580,7 +580,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'newid',
|
||||
@@ -662,7 +662,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -681,7 +681,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -723,7 +723,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -745,7 +745,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -785,7 +785,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -807,7 +807,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -816,7 +816,10 @@ suite('ConnectionConfig', () => {
|
||||
getOptionKeyIdNames: undefined!,
|
||||
matches: undefined!,
|
||||
providerName: 'MSSQL',
|
||||
options: { 'testProperty1': 'nonDefault' },
|
||||
options: {
|
||||
'testProperty1': 'nonDefault',
|
||||
'testProperty2': '10'
|
||||
},
|
||||
saveProfile: true,
|
||||
id: 'server3',
|
||||
connectionName: undefined!
|
||||
@@ -850,7 +853,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -872,7 +875,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -912,7 +915,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -1016,7 +1019,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'g3',
|
||||
groupId: 'g3',
|
||||
@@ -1035,7 +1038,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -1054,7 +1057,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -1090,7 +1093,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
@@ -1128,7 +1131,7 @@ suite('ConnectionConfig', () => {
|
||||
databaseName: 'database',
|
||||
userName: 'user',
|
||||
password: 'password',
|
||||
authenticationType: '',
|
||||
authenticationType: 'SqlLogin',
|
||||
savePassword: true,
|
||||
groupFullName: 'test',
|
||||
groupId: 'test',
|
||||
|
||||
Reference in New Issue
Block a user