Add support for Encrypt=Strict for TDS 8.0 connections with SQL Server 2022 (#21256)

This commit is contained in:
Cheena Malhotra
2023-02-10 10:34:36 -08:00
committed by GitHub
parent c75628639c
commit 3fb8d57d25
13 changed files with 256 additions and 24 deletions

View File

@@ -0,0 +1,25 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Widget } from 'vs/base/browser/ui/widget';
``
/**
* This interface is implemented by SelectBox and InputBox to provide a common API surface area in connectionWidget.ts
* If more widgets must be used in Connection Dialog, they should implement this interface.
*/
export interface AdsWidget extends Widget {
get value(): string;
get id(): string;
getAriaLabel(): string;
enable(): void;
disable(): void;
hideMessage(): void;
}

View File

@@ -7,6 +7,7 @@ import { InputBox as vsInputBox, IInputOptions as vsIInputBoxOptions, IInputBoxS
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { Color } from 'vs/base/common/color';
import { Event, Emitter } from 'vs/base/common/event';
import { AdsWidget } from 'sql/base/browser/ui/adsWidget';
export interface OnLoseFocusParams {
value: string;
@@ -29,7 +30,7 @@ export interface IInputOptions extends vsIInputBoxOptions {
ariaDescription?: string;
}
export class InputBox extends vsInputBox {
export class InputBox extends vsInputBox implements AdsWidget {
private enabledInputBackground?: Color;
private enabledInputForeground?: Color;
private enabledInputBorder?: Color;
@@ -48,7 +49,7 @@ export class InputBox extends vsInputBox {
private _isTextAreaInput = false;
private _hideErrors = false;
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider, private _sqlOptions?: IInputOptions) {
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider, private _sqlOptions?: IInputOptions, id?: string) {
super(container, contextViewProvider, _sqlOptions);
this.enabledInputBackground = this.inputBackground;
this.enabledInputForeground = this.inputForeground;
@@ -74,6 +75,7 @@ export class InputBox extends vsInputBox {
if (this._sqlOptions.ariaDescription) {
this.inputElement.setAttribute('aria-description', this._sqlOptions.ariaDescription);
}
this.inputElement.id = id;
}
public override style(styles: IInputBoxStyles): void {
@@ -197,4 +199,8 @@ export class InputBox extends vsInputBox {
this._lastLoseFocusValue = newValue;
super.value = newValue;
}
public get id(): string {
return this.input.id;
}
}

View File

@@ -17,6 +17,7 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { SelectBoxList } from 'vs/base/browser/ui/selectBox/selectBoxCustom';
import { Event, Emitter } from 'vs/base/common/event';
import { AdsWidget } from 'sql/base/browser/ui/adsWidget';
const $ = dom.$;
@@ -39,7 +40,7 @@ export interface ISelectBoxStyles extends vsISelectBoxStyles {
inputValidationErrorForeground?: Color;
}
export class SelectBox extends vsSelectBox {
export class SelectBox extends vsSelectBox implements AdsWidget {
private _optionsDictionary: Map<string, number>;
private _dialogOptions: SelectOptionItemSQL[];
private _selectedOption: string;
@@ -67,7 +68,7 @@ export class SelectBox extends vsSelectBox {
private element?: HTMLElement;
constructor(options: SelectOptionItemSQL[] | string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
constructor(options: SelectOptionItemSQL[] | string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions, id?: string) {
let optionItems: SelectOptionItemSQL[] = SelectBox.createOptions(options);
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
@@ -98,6 +99,7 @@ export class SelectBox extends vsSelectBox {
this.element = dom.append(container, $('.monaco-selectbox.idle'));
}
this.selectElement.id = id;
this._selectBoxOptions = selectBoxOptions;
let focusTracker = dom.trackFocus(this.selectElement);
this._register(focusTracker);
@@ -220,7 +222,6 @@ export class SelectBox extends vsSelectBox {
});
}
public override setOptions(options: string[] | SelectOptionItemSQL[] | ISelectOptionItem[], selected?: number): void {
let selectOptions: SelectOptionItemSQL[] = SelectBox.createOptions(options);
this.populateOptionsDictionary(selectOptions);
@@ -255,6 +256,14 @@ export class SelectBox extends vsSelectBox {
this.applyStyles();
}
public getAriaLabel(): string {
return this.selectElem.ariaLabel;
}
public get id(): string {
return this.selectElem.id;
}
public hasFocus(): boolean {
return document.activeElement === this.selectElement;
}