Add custom option support on Connection dialog + move Encrypt to connection dialog (#20959)

This commit is contained in:
Cheena Malhotra
2022-10-25 12:19:40 -07:00
committed by GitHub
parent 44d03085ad
commit 987aed3b92
11 changed files with 98 additions and 13 deletions

View File

@@ -215,7 +215,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
let idNames = [];
if (this.serverCapabilities) {
idNames = this.serverCapabilities.connectionOptions.map(o => {
if ((o.specialValueType || o.isIdentity)
if ((o.specialValueType || o.isIdentity || o.showOnConnectionDialog)
&& o.specialValueType !== ConnectionOptionSpecialType.password
&& o.specialValueType !== ConnectionOptionSpecialType.connectionName) {
return o.name;

View File

@@ -116,6 +116,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
defaultValue: undefined!,
isIdentity: false,
isRequired: false,
showOnConnectionDialog: true,
specialValueType: undefined!,
valueType: ServiceOptionType.string
}
@@ -200,7 +201,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
test('constructor should initialize the options given a valid model with options', () => {
let options: { [key: string]: string } = {};
options['encrypt'] = 'test value';
options['encrypt'] = 'true';
let conn2 = Object.assign({}, connectionProfile, { options: options });
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
@@ -210,12 +211,15 @@ suite('SQL ProviderConnectionInfo tests', () => {
assert.strictEqual(conn.authenticationType, conn2.authenticationType);
assert.strictEqual(conn.password, conn2.password);
assert.strictEqual(conn.userName, conn2.userName);
assert.strictEqual(conn.options['encrypt'], 'test value');
assert.strictEqual(conn.options['encrypt'], 'true');
});
test('getOptionsKey should create a valid unique id', () => {
let options: { [key: string]: string } = {};
options['encrypt'] = 'true';
connectionProfile.options = options;
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
let expectedId = 'providerName:MSSQL|authenticationType:|databaseName:database|serverName:new server|userName:user';
let expectedId = 'providerName:MSSQL|authenticationType:|databaseName:database|encrypt:true|serverName:new server|userName:user';
let id = conn.getOptionsKey();
assert.strictEqual(id, expectedId);
});