mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
add strict compile for restore (#12067)
This commit is contained in:
@@ -49,8 +49,8 @@ export function getBooleanValueFromStringOrBoolean(value: any): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getCategoryDisplayName(categories: azdata.CategoryValue[], categoryName: string) {
|
||||
let displayName: string;
|
||||
export function getCategoryDisplayName(categories: azdata.CategoryValue[], categoryName: string): string | undefined {
|
||||
let displayName: string | undefined;
|
||||
categories.forEach(c => {
|
||||
if (c.name === categoryName) {
|
||||
displayName = c.displayName;
|
||||
@@ -59,8 +59,8 @@ export function getCategoryDisplayName(categories: azdata.CategoryValue[], categ
|
||||
return displayName;
|
||||
}
|
||||
|
||||
export function getCategoryName(categories: azdata.CategoryValue[], categoryDisplayName: string) {
|
||||
let categoryName: string;
|
||||
export function getCategoryName(categories: azdata.CategoryValue[], categoryDisplayName: string): string | undefined {
|
||||
let categoryName: string | undefined;
|
||||
categories.forEach(c => {
|
||||
if (c.displayName === categoryDisplayName) {
|
||||
categoryName = c.name;
|
||||
|
||||
@@ -36,14 +36,14 @@ export interface IOptionsDialogOptions extends IModalOptions {
|
||||
}
|
||||
|
||||
export class OptionsDialog extends Modal {
|
||||
private _body: HTMLElement;
|
||||
private _optionGroupsContainer: HTMLElement;
|
||||
private _body?: HTMLElement;
|
||||
private _optionGroupsContainer?: HTMLElement;
|
||||
private _categoryTitles: HTMLElement[] = [];
|
||||
private _dividerBuilder: HTMLElement;
|
||||
private _optionTitle: HTMLElement;
|
||||
private _optionDescription: HTMLElement;
|
||||
private _dividerBuilder?: HTMLElement;
|
||||
private _optionTitle?: HTMLElement;
|
||||
private _optionDescription?: HTMLElement;
|
||||
private _optionElements: { [optionName: string]: OptionsDialogHelper.IOptionElement } = {};
|
||||
private _optionValues: { [optionName: string]: string };
|
||||
private _optionValues: { [optionName: string]: string } = {};
|
||||
|
||||
private _onOk = new Emitter<void>();
|
||||
public onOk: Event<void> = this._onOk.event;
|
||||
@@ -54,7 +54,7 @@ export class OptionsDialog extends Modal {
|
||||
constructor(
|
||||
title: string,
|
||||
name: string,
|
||||
options: IOptionsDialogOptions,
|
||||
options: IOptionsDialogOptions | undefined,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@@ -99,25 +99,25 @@ export class OptionsDialog extends Modal {
|
||||
// Update theming that is specific to options dialog flyout body
|
||||
private updateTheme(theme: IColorTheme): void {
|
||||
const borderColor = theme.getColor(contrastBorder);
|
||||
const border = borderColor ? borderColor.toString() : null;
|
||||
const border = borderColor ? borderColor.toString() : '';
|
||||
const backgroundColor = theme.getColor(SIDE_BAR_BACKGROUND);
|
||||
if (this._dividerBuilder) {
|
||||
this._dividerBuilder.style.borderTopWidth = border ? '1px' : null;
|
||||
this._dividerBuilder.style.borderTopStyle = border ? 'solid' : null;
|
||||
this._dividerBuilder.style.borderTopWidth = border ? '1px' : '';
|
||||
this._dividerBuilder.style.borderTopStyle = border ? 'solid' : '';
|
||||
this._dividerBuilder.style.borderTopColor = border;
|
||||
}
|
||||
this._categoryTitles.forEach(titleElement => {
|
||||
titleElement.style.borderWidth = border ? '1px 0px' : null;
|
||||
titleElement.style.borderStyle = border ? 'solid none' : null;
|
||||
titleElement.style.borderWidth = border ? '1px 0px' : '';
|
||||
titleElement.style.borderStyle = border ? 'solid none' : '';
|
||||
titleElement.style.borderColor = border;
|
||||
titleElement.style.backgroundColor = backgroundColor ? backgroundColor.toString() : null;
|
||||
titleElement.style.backgroundColor = backgroundColor ? backgroundColor.toString() : '';
|
||||
});
|
||||
}
|
||||
|
||||
private onOptionLinkClicked(optionName: string): void {
|
||||
let option = this._optionElements[optionName].option;
|
||||
this._optionTitle.innerText = option.displayName;
|
||||
this._optionDescription.innerText = option.description;
|
||||
this._optionTitle!.innerText = option.displayName;
|
||||
this._optionDescription!.innerText = option.description;
|
||||
}
|
||||
|
||||
private fillInOptions(container: HTMLElement, options: azdata.ServiceOption[]): void {
|
||||
@@ -193,18 +193,18 @@ export class OptionsDialog extends Modal {
|
||||
|
||||
public open(options: azdata.ServiceOption[], optionValues: { [name: string]: any }) {
|
||||
this._optionValues = optionValues;
|
||||
let firstOption: string;
|
||||
let firstOption: string | undefined;
|
||||
let categoryMap = OptionsDialogHelper.groupOptionsByCategory(options);
|
||||
clearNode(this._optionGroupsContainer);
|
||||
clearNode(this._optionGroupsContainer!);
|
||||
for (let category in categoryMap) {
|
||||
const title = append(this._optionGroupsContainer, $('h2.option-category-title'));
|
||||
const title = append(this._optionGroupsContainer!, $('h2.option-category-title'));
|
||||
title.innerText = category;
|
||||
this._categoryTitles.push(title);
|
||||
|
||||
let serviceOptions: azdata.ServiceOption[] = categoryMap[category];
|
||||
let bodyContainer = $('table.optionsDialog-table');
|
||||
this.fillInOptions(bodyContainer, serviceOptions);
|
||||
append(this._optionGroupsContainer, bodyContainer);
|
||||
append(this._optionGroupsContainer!, bodyContainer);
|
||||
|
||||
if (!firstOption) {
|
||||
firstOption = serviceOptions[0].name;
|
||||
@@ -212,7 +212,7 @@ export class OptionsDialog extends Modal {
|
||||
}
|
||||
this.updateTheme(this._themeService.getColorTheme());
|
||||
this.show();
|
||||
let firstOptionWidget = this._optionElements[firstOption].optionWidget;
|
||||
let firstOptionWidget = this._optionElements[firstOption!].optionWidget;
|
||||
this.registerStyling();
|
||||
setTimeout(() => firstOptionWidget.focus(), 1);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as azdata from 'azdata';
|
||||
import { localize } from 'vs/nls';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { ServiceOptionType } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
export interface IOptionElement {
|
||||
@@ -21,11 +20,11 @@ export interface IOptionElement {
|
||||
}
|
||||
|
||||
export function createOptionElement(option: azdata.ServiceOption, rowContainer: HTMLElement, options: { [name: string]: any },
|
||||
optionsMap: { [optionName: string]: IOptionElement }, contextViewService: IContextViewService, onFocus: (name) => void): IOptionElement {
|
||||
optionsMap: { [optionName: string]: IOptionElement }, contextViewService: IContextViewService, onFocus: (name: string) => void): IOptionElement {
|
||||
let possibleInputs: SelectOptionItemSQL[] = [];
|
||||
let optionValue = getOptionValueAndCategoryValues(option, options, possibleInputs);
|
||||
let optionWidget: any;
|
||||
let inputElement: HTMLElement;
|
||||
let inputElement: HTMLElement | undefined;
|
||||
let missingErrorMessage = localize('optionsDialog.missingRequireField', " is required.");
|
||||
let invalidInputMessage = localize('optionsDialog.invalidInput', "Invalid input. Numeric value expected.");
|
||||
|
||||
@@ -65,7 +64,9 @@ export function createOptionElement(option: azdata.ServiceOption, rowContainer:
|
||||
}
|
||||
const optionElement = { optionWidget: optionWidget, option: option, optionValue: optionValue };
|
||||
optionsMap[option.name] = optionElement;
|
||||
inputElement.onfocus = () => onFocus(option.name);
|
||||
if (inputElement) {
|
||||
inputElement.onfocus = () => onFocus(option.name);
|
||||
}
|
||||
return optionElement;
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ export function findElement(container: HTMLElement, className: string): HTMLElem
|
||||
let elementBuilder = container;
|
||||
while (elementBuilder) {
|
||||
let htmlElement = elementBuilder;
|
||||
if (startsWith(htmlElement.className, className)) {
|
||||
if (htmlElement.className.startsWith(className)) {
|
||||
break;
|
||||
}
|
||||
elementBuilder = elementBuilder.firstChild as HTMLElement;
|
||||
|
||||
Reference in New Issue
Block a user