diff --git a/src/sql/workbench/common/editor/query/queryEditorInput.ts b/src/sql/workbench/common/editor/query/queryEditorInput.ts index 7dd6bd1d2d..785b4050ce 100644 --- a/src/sql/workbench/common/editor/query/queryEditorInput.ts +++ b/src/sql/workbench/common/editor/query/queryEditorInput.ts @@ -7,7 +7,7 @@ import { localize } from 'vs/nls'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { Emitter } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; -import { EditorInput, GroupIdentifier, IRevertOptions, ISaveOptions, IEditorInput } from 'vs/workbench/common/editor'; +import { EditorInput, GroupIdentifier, IRevertOptions, ISaveOptions, IEditorInput, TextResourceEditorInput } from 'vs/workbench/common/editor'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConnectionManagementService, IConnectableInput, INewConnectionParams, RunQueryOnConnectionMode } from 'sql/platform/connection/common/connectionManagement'; @@ -118,7 +118,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab constructor( private _description: string, - protected _text: EditorInput, + protected _text: TextResourceEditorInput, protected _results: QueryResultsInput, @IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService, @IQueryModelService private readonly queryModelService: IQueryModelService, @@ -167,7 +167,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab // Getters for private properties public get uri(): string { return this.resource!.toString(true); } - public get text(): EditorInput { return this._text; } + public get text(): TextResourceEditorInput { return this._text; } public get results(): QueryResultsInput { return this._results; } // Description is shown beside the tab name in the combobox of open editors public getDescription(): string { return this._description; } @@ -191,7 +191,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab // Forwarding resource functions to the inline sql file editor public isDirty(): boolean { return this._text.isDirty(); } - public get resource(): URI | undefined { return this._text.resource; } + public get resource(): URI { return this._text.resource; } public matchInputInstanceType(inputType: any): boolean { return (this._text instanceof inputType); diff --git a/src/sql/workbench/contrib/dashboard/browser/contents/controlHostContent.component.ts b/src/sql/workbench/contrib/dashboard/browser/contents/controlHostContent.component.ts index 29bca731b5..df8fbed61e 100644 --- a/src/sql/workbench/contrib/dashboard/browser/contents/controlHostContent.component.ts +++ b/src/sql/workbench/contrib/dashboard/browser/contents/controlHostContent.component.ts @@ -12,7 +12,7 @@ import { CommonServiceInterface } from 'sql/workbench/services/bootstrap/browser import * as azdata from 'azdata'; import { memoize } from 'vs/base/common/decorators'; -import { AgentViewComponent } from '../../../jobManagement/browser/agentView.component'; +import { AgentViewComponent } from 'sql/workbench/contrib/jobManagement/browser/agentView.component'; @Component({ templateUrl: decodeURI(require.toUrl('./controlHostContent.component.html')), diff --git a/src/sql/workbench/contrib/jobManagement/browser/jobActions.ts b/src/sql/workbench/contrib/jobManagement/browser/jobActions.ts index 9daf0a781d..a442913ffc 100644 --- a/src/sql/workbench/contrib/jobManagement/browser/jobActions.ts +++ b/src/sql/workbench/contrib/jobManagement/browser/jobActions.ts @@ -9,7 +9,7 @@ import * as azdata from 'azdata'; import { INotificationService } from 'vs/platform/notification/common/notification'; import Severity from 'vs/base/common/severity'; import { JobHistoryComponent } from 'sql/workbench/contrib/jobManagement/browser/jobHistory.component'; -import { IJobManagementService } from '../../../services/jobManagement/common/interfaces'; +import { IJobManagementService } from 'sql/workbench/services/jobManagement/common/interfaces'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { JobsViewComponent } from 'sql/workbench/contrib/jobManagement/browser/jobsView.component'; import { AlertsViewComponent } from 'sql/workbench/contrib/jobManagement/browser/alertsView.component'; diff --git a/src/sql/workbench/contrib/notebook/browser/outputs/renderers.ts b/src/sql/workbench/contrib/notebook/browser/outputs/renderers.ts index f0640fa891..5faebef217 100644 --- a/src/sql/workbench/contrib/notebook/browser/outputs/renderers.ts +++ b/src/sql/workbench/contrib/notebook/browser/outputs/renderers.ts @@ -5,7 +5,7 @@ import { default as AnsiUp } from 'ansi_up'; import { IRenderMime } from 'sql/workbench/services/notebook/browser/outputs/renderMimeInterfaces'; -import { URLExt } from '../../common/models/url'; +import { URLExt } from 'sql/workbench/contrib/notebook/common/models/url'; import { URI } from 'vs/base/common/uri'; diff --git a/src/sql/workbench/services/admin/common/adminService.ts b/src/sql/workbench/services/admin/common/adminService.ts index 9873f8be34..9886dff280 100644 --- a/src/sql/workbench/services/admin/common/adminService.ts +++ b/src/sql/workbench/services/admin/common/adminService.ts @@ -19,7 +19,7 @@ export interface IAdminService { registerProvider(providerId: string, provider: azdata.AdminServicesProvider): void; - getDefaultDatabaseInfo(connectionUri: string): Thenable; + getDefaultDatabaseInfo(connectionUri: string): Thenable; getDatabaseInfo(connectionUri: string): Thenable; } @@ -48,7 +48,7 @@ export class AdminService implements IAdminService { } } - public getDefaultDatabaseInfo(connectionUri: string): Thenable { + public getDefaultDatabaseInfo(connectionUri: string): Thenable { let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri); if (providerId) { let provider = this._providers[providerId]; diff --git a/src/sql/workbench/services/restore/browser/restoreServiceImpl.ts b/src/sql/workbench/services/restore/browser/restoreServiceImpl.ts index a2798fcef7..087688fdd9 100644 --- a/src/sql/workbench/services/restore/browser/restoreServiceImpl.ts +++ b/src/sql/workbench/services/restore/browser/restoreServiceImpl.ts @@ -155,12 +155,7 @@ export class RestoreDialogController implements IRestoreDialogController { } private handleOnRestore(isScriptOnly: boolean = false): void { - let restoreOption = this.setRestoreOption(); - if (isScriptOnly) { - restoreOption.taskExecutionMode = TaskExecutionMode.script; - } else { - restoreOption.taskExecutionMode = TaskExecutionMode.executeAndScript; - } + let restoreOption = this.setRestoreOption(isScriptOnly ? TaskExecutionMode.script : TaskExecutionMode.executeAndScript); this._restoreService.restore(this._ownerUri, restoreOption).then(result => { const self = this; @@ -192,7 +187,7 @@ export class RestoreDialogController implements IRestoreDialogController { private handleMssqlOnValidateFile(overwriteTargetDatabase: boolean = false): void { let restoreDialog = this._restoreDialogs[this._currentProvider] as RestoreDialog; - this._restoreService.getRestorePlan(this._ownerUri, this.setRestoreOption(overwriteTargetDatabase)).then(restorePlanResponse => { + this._restoreService.getRestorePlan(this._ownerUri, this.setRestoreOption(TaskExecutionMode.execute, overwriteTargetDatabase)).then(restorePlanResponse => { this._sessionId = restorePlanResponse.sessionId; if (restorePlanResponse.errorMessage) { @@ -237,12 +232,12 @@ export class RestoreDialogController implements IRestoreDialogController { }); } - private setRestoreOption(overwriteTargetDatabase: boolean = false): azdata.RestoreInfo { + private setRestoreOption(taskExecutionMode: TaskExecutionMode, overwriteTargetDatabase: boolean = false): azdata.RestoreInfo { let restoreInfo = undefined; let providerId: string = this.getCurrentProviderId(); if (providerId === ConnectionConstants.mssqlProviderName) { - restoreInfo = new MssqlRestoreInfo(); + restoreInfo = new MssqlRestoreInfo(taskExecutionMode); if (this._sessionId) { restoreInfo.sessionId = this._sessionId; @@ -287,7 +282,7 @@ export class RestoreDialogController implements IRestoreDialogController { } private handleOnCancel(): void { - let restoreInfo = new MssqlRestoreInfo(); + let restoreInfo = new MssqlRestoreInfo(TaskExecutionMode.execute); restoreInfo.sessionId = this._sessionId; this._restoreService.cancelRestorePlan(this._ownerUri, restoreInfo).then(() => { this._connectionService.disconnect(this._ownerUri); diff --git a/src/sql/workbench/services/restore/common/mssqlRestoreInfo.ts b/src/sql/workbench/services/restore/common/mssqlRestoreInfo.ts index aa46c39683..e5b30ee557 100644 --- a/src/sql/workbench/services/restore/common/mssqlRestoreInfo.ts +++ b/src/sql/workbench/services/restore/common/mssqlRestoreInfo.ts @@ -8,9 +8,8 @@ import * as azdata from 'azdata'; export class MssqlRestoreInfo implements azdata.RestoreInfo { options: { [name: string]: any }; - taskExecutionMode: azdata.TaskExecutionMode; - public constructor() { + public constructor(public taskExecutionMode: azdata.TaskExecutionMode) { this.options = {}; } @@ -93,4 +92,4 @@ export class MssqlRestoreInfo implements azdata.RestoreInfo { public set overwriteTargetDatabase(value: boolean) { this.options['overwriteTargetDatabase'] = value; } -} \ No newline at end of file +} diff --git a/src/sql/workbench/services/serverGroup/browser/serverGroupController.ts b/src/sql/workbench/services/serverGroup/browser/serverGroupController.ts index 9330da14c1..be27a1806d 100644 --- a/src/sql/workbench/services/serverGroup/browser/serverGroupController.ts +++ b/src/sql/workbench/services/serverGroup/browser/serverGroupController.ts @@ -18,10 +18,10 @@ import { SERVER_GROUP_CONFIG, SERVER_GROUP_COLORS_CONFIG } from 'sql/workbench/s export class ServerGroupController implements IServerGroupController { _serviceBrand: undefined; - private _serverGroupDialog: ServerGroupDialog; - private _callbacks: IServerGroupDialogCallbacks; - private _group: ConnectionProfileGroup; - private _viewModel: ServerGroupViewModel; + private _serverGroupDialog?: ServerGroupDialog; + private _callbacks?: IServerGroupDialogCallbacks; + private _group?: ConnectionProfileGroup; + private _viewModel?: ServerGroupViewModel; constructor( @IErrorMessageService private _errorMessageService: IErrorMessageService, @@ -32,13 +32,14 @@ export class ServerGroupController implements IServerGroupController { } private handleOnAddServerGroup(): void { + const viewModel = this._viewModel!; if (this._group) { let tempGroup: ConnectionProfileGroup = this.copyConnectionProfileGroup(this._group); - this._group.name = this._viewModel.groupName; - this._group.color = this._viewModel.groupColor; - this._group.description = this._viewModel.groupDescription; + this._group.name = viewModel.groupName; + this._group.color = viewModel.groupColor; + this._group.description = viewModel.groupDescription; this.connectionManagementService.editGroup(this._group).then(() => { - this._serverGroupDialog.close(); + this._serverGroupDialog!.close(); }).catch(err => { // rollback changes made this._group = tempGroup; @@ -55,9 +56,9 @@ export class ServerGroupController implements IServerGroupController { }; this.connectionManagementService.saveProfileGroup(newGroup).then(groupId => { if (this._callbacks) { - this._callbacks.onAddGroup(this._serverGroupDialog.groupName); + this._callbacks.onAddGroup(this._serverGroupDialog!.groupName); } - this._serverGroupDialog.close(); + this._serverGroupDialog!.close(); }).catch(err => { this._errorMessageService.showDialog(Severity.Error, '', err); }); @@ -76,33 +77,31 @@ export class ServerGroupController implements IServerGroupController { public showCreateGroupDialog(callbacks?: IServerGroupDialogCallbacks): Promise { - this._group = null; - this._viewModel = new ServerGroupViewModel(undefined, this._configurationService.getValue(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]); + this._group = undefined; + this._viewModel = new ServerGroupViewModel(undefined, this._configurationService.getValue<{ [key: string]: any }>(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]); this._callbacks = callbacks ? callbacks : undefined; return this.openServerGroupDialog(); } public showEditGroupDialog(group: ConnectionProfileGroup): Promise { this._group = group; - this._viewModel = new ServerGroupViewModel(group, this._configurationService.getValue(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]); + this._viewModel = new ServerGroupViewModel(group, this._configurationService.getValue<{ [key: string]: any }>(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]); return this.openServerGroupDialog(); } private openServerGroupDialog(): Promise { if (!this._serverGroupDialog) { this._serverGroupDialog = this._instantiationService.createInstance(ServerGroupDialog); - this._serverGroupDialog.viewModel = this._viewModel; + this._serverGroupDialog.setViewModel(this._viewModel!); this._serverGroupDialog.onCancel(() => { }); this._serverGroupDialog.onAddServerGroup(() => this.handleOnAddServerGroup()); this._serverGroupDialog.onCloseEvent(() => this.handleOnClose()); this._serverGroupDialog.render(); } else { // reset the view model in the view - this._serverGroupDialog.viewModel = this._viewModel; + this._serverGroupDialog.setViewModel(this._viewModel!); } - return new Promise(() => { - this._serverGroupDialog.open(); - }); + return Promise.resolve(this._serverGroupDialog.open()); } } diff --git a/src/sql/workbench/services/serverGroup/browser/serverGroupDialog.ts b/src/sql/workbench/services/serverGroup/browser/serverGroupDialog.ts index da5a8910f2..ec2a74c52e 100644 --- a/src/sql/workbench/services/serverGroup/browser/serverGroupDialog.ts +++ b/src/sql/workbench/services/serverGroup/browser/serverGroupDialog.ts @@ -30,17 +30,21 @@ import { Color } from 'vs/base/common/color'; import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService'; import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry'; import { attachModalDialogStyler } from 'sql/workbench/common/styler'; +import { assertIsDefined, isUndefinedOrNull } from 'vs/base/common/types'; + +interface IRenderedServerGroupDialog { + groupNameInputBox: InputBox; + groupDescriptionInputBox: InputBox; + serverGroupContainer: HTMLElement; + addServerButton: Button; + closeButton: Button; +} export class ServerGroupDialog extends Modal { - private _addServerButton: Button; - private _closeButton: Button; private _colorColorBoxesMap: Array<{ color: string, colorbox: Colorbox }> = []; - private _selectedColorOption: number; - private _groupNameInputBox: InputBox; - private _groupDescriptionInputBox: InputBox; - private _viewModel: ServerGroupViewModel; + private _selectedColorOption?: number; + private _viewModel?: ServerGroupViewModel; private _skipGroupNameValidation: boolean = false; - private _serverGroupContainer: HTMLElement; private _onAddServerGroup = new Emitter(); public onAddServerGroup: Event = this._onAddServerGroup.event; @@ -51,6 +55,14 @@ export class ServerGroupDialog extends Modal { private _onCloseEvent = new Emitter(); public onCloseEvent: Event = this._onCloseEvent.event; + // rendered elements + private isRendered = false; + private _groupNameInputBox?: InputBox; + private _groupDescriptionInputBox?: InputBox; + private _serverGroupContainer?: HTMLElement; + private _addServerButton?: Button; + private _closeButton?: Button; + constructor( @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, @IThemeService themeService: IThemeService, @@ -72,6 +84,7 @@ export class ServerGroupDialog extends Modal { this._addServerButton = this.addFooterButton(okLabel, () => this.addGroup()); this._closeButton = this.addFooterButton(cancelLabel, () => this.cancel()); this.registerListeners(); + this.isRendered = true; } protected layout(height?: number): void { @@ -139,31 +152,33 @@ export class ServerGroupDialog extends Modal { } private focusNext(): void { - if (this._groupNameInputBox.hasFocus()) { - this._groupDescriptionInputBox.focus(); - } else if (this._groupDescriptionInputBox.hasFocus()) { - this._colorColorBoxesMap[this._selectedColorOption].colorbox.focus(); + const renderedDialog = this.withRenderedDialog; + if (renderedDialog.groupNameInputBox.hasFocus()) { + renderedDialog.groupDescriptionInputBox.focus(); + } else if (renderedDialog.groupDescriptionInputBox.hasFocus()) { + this._colorColorBoxesMap[this._selectedColorOption ?? 0].colorbox.focus(); } else if (this.isFocusOnColors()) { - this._addServerButton.enabled ? this._addServerButton.focus() : this._closeButton.focus(); - } else if (document.activeElement === this._addServerButton.element) { - this._closeButton.focus(); + renderedDialog.addServerButton.enabled ? renderedDialog.addServerButton.focus() : renderedDialog.closeButton.focus(); + } else if (document.activeElement === renderedDialog.addServerButton.element) { + renderedDialog.closeButton.focus(); } - else if (document.activeElement === this._closeButton.element) { - this._groupNameInputBox.focus(); + else if (document.activeElement === renderedDialog.closeButton.element) { + renderedDialog.groupNameInputBox.focus(); } } private focusPrevious(): void { - if (document.activeElement === this._closeButton.element) { - this._addServerButton.enabled ? this._addServerButton.focus() : this._colorColorBoxesMap[this._selectedColorOption].colorbox.focus(); - } else if (document.activeElement === this._addServerButton.element) { - this._colorColorBoxesMap[this._selectedColorOption].colorbox.focus(); + const renderedDialog = this.withRenderedDialog; + if (document.activeElement === renderedDialog.closeButton.element) { + renderedDialog.addServerButton.enabled ? renderedDialog.addServerButton.focus() : this._colorColorBoxesMap[this._selectedColorOption ?? 0].colorbox.focus(); + } else if (document.activeElement === renderedDialog.addServerButton.element) { + this._colorColorBoxesMap[this._selectedColorOption ?? 0].colorbox.focus(); } else if (this.isFocusOnColors()) { - this._groupDescriptionInputBox.focus(); - } else if (this._groupDescriptionInputBox.hasFocus()) { - this._groupNameInputBox.focus(); - } else if (this._groupNameInputBox.hasFocus()) { - this._closeButton.focus(); + renderedDialog.groupDescriptionInputBox.focus(); + } else if (renderedDialog.groupDescriptionInputBox.hasFocus()) { + renderedDialog.groupNameInputBox.focus(); + } else if (renderedDialog.groupNameInputBox.hasFocus()) { + renderedDialog.closeButton.focus(); } } @@ -196,32 +211,33 @@ export class ServerGroupDialog extends Modal { } private onSelectGroupColor(colorToSelect: string): void { - this._viewModel.groupColor = colorToSelect; - this._selectedColorOption = this._viewModel.colors.indexOf(colorToSelect); + this.withViewModel.groupColor = colorToSelect; + this._selectedColorOption = this.withViewModel.colors.indexOf(colorToSelect); this.updateView(); } private registerListeners(): void { + const renderedDialog = this.withRenderedDialog; // Theme styler - this._register(attachInputBoxStyler(this._groupNameInputBox, this._themeService)); - this._register(attachInputBoxStyler(this._groupDescriptionInputBox, this._themeService)); - this._register(attachButtonStyler(this._addServerButton, this._themeService)); - this._register(attachButtonStyler(this._closeButton, this._themeService)); + this._register(attachInputBoxStyler(renderedDialog.groupNameInputBox, this._themeService)); + this._register(attachInputBoxStyler(renderedDialog.groupDescriptionInputBox, this._themeService)); + this._register(attachButtonStyler(renderedDialog.addServerButton, this._themeService)); + this._register(attachButtonStyler(renderedDialog.closeButton, this._themeService)); // handler for name change events - this._register(this._groupNameInputBox.onDidChange(groupName => { + this._register(renderedDialog.groupNameInputBox.onDidChange(groupName => { this.groupNameChanged(groupName); })); // handler for description change events - this._register(this._groupDescriptionInputBox.onDidChange(groupDescription => { + this._register(renderedDialog.groupDescriptionInputBox.onDidChange(groupDescription => { this.groupDescriptionChanged(groupDescription); })); } private fillGroupColors(container: HTMLElement): void { - for (let i = 0; i < this._viewModel.colors.length; i++) { - const color = this._viewModel.colors[i]; + for (let i = 0; i < this.withViewModel.colors.length; i++) { + const color = this.withViewModel.colors[i]; const colorColorBox = new Colorbox(container, { name: 'server-group-color', @@ -245,31 +261,32 @@ export class ServerGroupDialog extends Modal { } private groupNameChanged(groupName: string) { - this._viewModel.groupName = groupName; + this.withViewModel.groupName = groupName; this.updateView(); } private groupDescriptionChanged(groupDescription: string) { - this._viewModel.groupDescription = groupDescription; + this.withViewModel.groupDescription = groupDescription; this.updateView(); } public get groupName(): string { - return this._groupNameInputBox.value; + return this.withRenderedDialog.groupNameInputBox.value; } public get groupDescription(): string { - return this._groupDescriptionInputBox.value; + return this.withRenderedDialog.groupDescriptionInputBox.value; } - public get selectedColor(): string { - return this._colorColorBoxesMap[this._selectedColorOption].color; + public get selectedColor(): string | undefined { + return !isUndefinedOrNull(this._selectedColorOption) ? this._colorColorBoxesMap[this._selectedColorOption].color : undefined; } - public get viewModel(): ServerGroupViewModel { + public get viewModel(): ServerGroupViewModel | undefined { return this._viewModel; } - public set viewModel(theViewModel: ServerGroupViewModel) { + + public setViewModel(theViewModel: ServerGroupViewModel) { this._viewModel = theViewModel; if (this._serverGroupContainer) { DOM.clearNode(this._serverGroupContainer); @@ -278,7 +295,7 @@ export class ServerGroupDialog extends Modal { } public addGroup(): void { - if (this._addServerButton.enabled) { + if (this.withRenderedDialog.addServerButton.enabled) { if (this.validateInputs()) { this._onAddServerGroup.fire(); } @@ -290,22 +307,24 @@ export class ServerGroupDialog extends Modal { } private validateInputs(): boolean { - let validate = this._groupNameInputBox.validate(); + const renderedDialog = this.withRenderedDialog; + let validate = renderedDialog.groupNameInputBox.validate(); if (!validate) { - this._groupNameInputBox.focus(); + renderedDialog.groupNameInputBox.focus(); } return validate; } // initialize the view based on the current state of the view model private initializeView(): void { - this.title = this._viewModel.getDialogTitle(); + const renderedDialog = this.withRenderedDialog; + this.title = this.withViewModel.getDialogTitle(); this._skipGroupNameValidation = true; - this._groupNameInputBox.value = this._viewModel.groupName; + renderedDialog.groupNameInputBox.value = this.withViewModel.groupName; this._skipGroupNameValidation = false; - this._groupDescriptionInputBox.value = this._viewModel.groupDescription; + renderedDialog.groupDescriptionInputBox.value = this.withViewModel.groupDescription ?? ''; this.updateView(); } @@ -315,16 +334,19 @@ export class ServerGroupDialog extends Modal { // check the color buttons and if their checked state does not match the view model state then correct it for (let i = 0; i < this._colorColorBoxesMap.length; i++) { let { colorbox: colorbox, color } = this._colorColorBoxesMap[i]; - if ((this._viewModel.groupColor === color) && (colorbox.checked === false)) { + if ((this.withViewModel.groupColor === color) && (colorbox.checked === false)) { colorbox.checked = true; this._selectedColorOption = i; - } else if ((this._viewModel.groupColor !== color) && (colorbox.checked === true)) { + } else if ((this.withViewModel.groupColor !== color) && (colorbox.checked === true)) { colorbox.checked = false; } } - // OK button state - enabled if there are pending changes that can be saved - this._addServerButton.enabled = this._viewModel.hasPendingChanges(); + this.withRenderedDialog.addServerButton.enabled = this.withViewModel.hasPendingChanges(); + } + + private get withViewModel(): ServerGroupViewModel { + return assertIsDefined(this._viewModel); } /* Overwrite escape key behavior */ @@ -344,15 +366,30 @@ export class ServerGroupDialog extends Modal { public close() { this.hide(); - this._groupNameInputBox.hideMessage(); + this.withRenderedDialog.groupNameInputBox.hideMessage(); this._onCloseEvent.fire(); } + private get withRenderedDialog(): IRenderedServerGroupDialog { + if (this.isRendered) { + // we assume if we are rendered then all our rendered elements are defined + return { + groupNameInputBox: this._groupNameInputBox!, + groupDescriptionInputBox: this._groupDescriptionInputBox!, + serverGroupContainer: this._serverGroupContainer!, + addServerButton: this._addServerButton!, + closeButton: this._closeButton! + }; + } else { + throw new Error('Server Group Dialog Not Rendered'); + } + } + public open() { // reset the dialog this.hideError(); this.initializeView(); this.show(); - this._groupNameInputBox.focus(); + this.withRenderedDialog.groupNameInputBox.focus(); } } diff --git a/src/sql/workbench/services/serverGroup/common/serverGroupViewModel.ts b/src/sql/workbench/services/serverGroup/common/serverGroupViewModel.ts index 02215826aa..1807d6b165 100644 --- a/src/sql/workbench/services/serverGroup/common/serverGroupViewModel.ts +++ b/src/sql/workbench/services/serverGroup/common/serverGroupViewModel.ts @@ -11,11 +11,11 @@ import * as strings from 'vs/base/common/strings'; export class ServerGroupViewModel { public groupName: string; - public groupDescription: string; - public groupColor: string; + public groupDescription?: string; + public groupColor?: string; public colors: string[] = ['#515151', '#004760', '#771b00', '#700060', '#a17d01', '#006749', '#654502', '#3A0293']; - private _domainModel: IConnectionProfileGroup; + private _domainModel?: IConnectionProfileGroup; private _editMode: boolean; private readonly _addServerGroupTitle: string = localize('serverGroup.addServerGroup', "Add server group"); private readonly _editServerGroupTitle: string = localize('serverGroup.editServerGroup', "Edit server group"); @@ -67,4 +67,4 @@ export class ServerGroupViewModel { return this._addServerGroupTitle; } } -} \ No newline at end of file +} diff --git a/src/tsconfig.vscode.json b/src/tsconfig.vscode.json index b5013675d3..41c2a97d5b 100644 --- a/src/tsconfig.vscode.json +++ b/src/tsconfig.vscode.json @@ -25,51 +25,72 @@ // "./vs/code/**/*.ts", "./vs/editor/**/*.ts", "./vs/platform/**/*.ts", - // "./vs/workbench/api/common/**/*.ts", - // "./vs/workbench/api/worker/**/*.ts", - // "./vs/workbench/browser/**/*.ts", - // "./vs/workbench/common/**/*.ts", - // "./vs/workbench/contrib/debug/common/debugProtocol.d.ts", - // "./vs/workbench/electron-browser/**/*.ts", - // "./vs/workbench/services/activity/**/*.ts", - // "./vs/workbench/services/activityBar/**/*.ts", - // "./vs/workbench/services/authentication/**/*.ts", - // "./vs/workbench/services/bulkEdit/**/*.ts", - // "./vs/workbench/services/clipboard/**/*.ts", - // "./vs/workbench/services/commands/**/*.ts", - // "./vs/workbench/services/contextmenu/**/*.ts", - // "./vs/workbench/services/decorations/**/*.ts", - // "./vs/workbench/services/electron/**/*.ts", - // "./vs/workbench/services/extensionResourceLoader/**/*.ts", - // "./vs/workbench/services/integrity/**/*.ts", - // "./vs/workbench/services/issue/**/*.ts", - // "./vs/workbench/services/layout/**/*.ts", - // "./vs/workbench/services/lifecycle/**/*.ts", - // "./vs/workbench/services/localizations/**/*.ts", - // "./vs/workbench/services/log/**/*.ts", - // "./vs/workbench/services/menubar/**/*.ts", - // "./vs/workbench/services/mode/**/*.ts", - // "./vs/workbench/services/notification/**/*.ts", - // "./vs/workbench/services/request/**/*.ts", - // "./vs/workbench/services/sharedProcess/**/*.ts", - // "./vs/workbench/services/statusbar/**/*.ts", - // "./vs/workbench/services/textMate/**/*.ts", - // "./vs/workbench/services/title/**/*.ts", - // "./vs/workbench/services/untitled/**/*.ts", - // "./vs/workbench/services/userDataSync/**/*.ts", - // "./vs/workbench/services/**/test/**/*.ts", + "./vs/workbench/contrib/debug/common/debugProtocol.d.ts", + "./vs/workbench/services/**/*.ts", + "./sql/workbench/services/**/*.ts", "./sql/base/**/*.ts", "./sql/editor/**/*.ts", - "./sql/platform/**/*.ts", - // "./sql/workbench/api/common/**/*.ts", - // "./sql/workbench/api/worker/**/*.ts", - // "./sql/workbench/browser/**/*.ts", - // "./sql/workbench/common/**/*.ts", - // "./sql/workbench/electron-browser/**/*.ts", - // "./sql/workbench/services/**/test/**/*.ts" + "./sql/platform/**/*.ts" ], "exclude": [ "./vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts", - "./vs/workbench/common/editor/editorGroup.ts" + // sql services + "./sql/workbench/services/accountManagement/**/*.ts", // 3101 errors + "./sql/workbench/services/bootstrap/**/*.ts", // 3087 errors + "./sql/workbench/services/connection/**/*.ts", // 3192 errors + "./sql/workbench/services/dashboard/**/*.ts", // 57 errors + "./sql/workbench/services/dialog/**/*.ts", // 3094 errors + "./sql/workbench/services/errorMessage/**/*.ts", // 61 errors + "./sql/workbench/services/fileBrowser/**/*.ts", // 3087 + "./sql/workbench/services/insights/**/*.ts", // 3151 + "./sql/workbench/services/jobManagement/**/*.ts", // 3132 + "./sql/workbench/services/languageAssociation/**/*.ts", // 3087 + "./sql/workbench/services/notebook/**/*.ts", // 3087 + "./sql/workbench/services/objectExplorer/**/*.ts", // 3143 + "./sql/workbench/services/profiler/**/*.ts", // 3087 + "./sql/workbench/services/query/**/*.ts", // 3089 + "./sql/workbench/services/queryEditor/**/*.ts", // 3087 + "./sql/workbench/services/queryHistory/**/*.ts", // 3091 + "./sql/workbench/services/resourceProvider/**/*.ts", // 70 + "./sql/workbench/services/restore/**/*.ts", // 3100 + "./sql/workbench/services/serverGroup/**/*.ts", // 49 + // vs services + "./vs/workbench/services/accessibility/**/*.ts", // 3087 + "./vs/workbench/services/authentication/**/*.ts", // 3087 + "./vs/workbench/services/backup/**/*.ts", // 3087 + "./vs/workbench/services/bulkEdit/**/*.ts", // 3087 + "./vs/workbench/services/configuration/**/*.ts", // 3087 + "./vs/workbench/services/configurationResolver/**/*.ts", // 3087 + "./vs/workbench/services/credentials/**/*.ts", // 3087 + "./vs/workbench/services/dialogs/**/*.ts", // 3087 + "./vs/workbench/services/editor/**/*.ts", // 3087 + "./vs/workbench/services/environment/**/*.ts", // 3087 + "./vs/workbench/services/extensionManagement/**/*.ts", // 3087 + "./vs/workbench/services/extensions/**/*.ts", // 3287 + "./vs/workbench/services/filesConfiguration/**/*.ts", // 3087 + "./vs/workbench/services/history/**/*.ts", // 3087 + "./vs/workbench/services/host/**/*.ts", // 3087 + "./vs/workbench/services/keybinding/**/*.ts", // 3087 + "./vs/workbench/services/label/**/*.ts", // 3087 + "./vs/workbench/services/output/**/*.ts", // 3087 + "./vs/workbench/services/path/**/*.ts", // 3087 + "./vs/workbench/services/preferences/**/*.ts", // 3087 + "./vs/workbench/services/progress/**/*.ts", // 3087 + "./vs/workbench/services/remote/**/*.ts", // 3087 + "./vs/workbench/services/search/**/*.ts", // 3087 + "./vs/workbench/services/telemetry/**/*.ts", // 3087 + "./vs/workbench/services/textfile/**/*.ts", // 3087 + "./vs/workbench/services/textmodelResolver/**/*.ts", // 3087 + "./vs/workbench/services/textresourceProperties/**/*.ts", // 3087 + "./vs/workbench/services/themes/**/*.ts", // 3087 + "./vs/workbench/services/timer/**/*.ts", // 3087 + "./vs/workbench/services/untitled/**/*.ts", // 3087 + "./vs/workbench/services/update/**/*.ts", // 3087 + "./vs/workbench/services/url/**/*.ts", // 3087 + "./vs/workbench/services/userData/**/*.ts", // 3087 + "./vs/workbench/services/viewlet/**/*.ts", // 3087 + "./vs/workbench/services/views/**/*.ts", // 3087 + "./vs/workbench/services/workingCopy/**/*.ts", // 3087 + "./vs/workbench/services/workspaces/**/*.ts", // 3087 ] } diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index 1a049fa246..dd9025763e 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -795,13 +795,9 @@ export class TabsTitleControl extends TitleControl { // {{SQL CARBON EDIT}} -- Display the editor's tab color if (isTab) { - const tabContainer = this.tabsContainer.children[index]; - if (tabContainer instanceof HTMLElement) { - let editor = this.group.getEditors(index); - if (editor.length > 0) { - this.setEditorTabColor(editor[0], tabContainer, isActiveTab); - } - } + this.doWithTab(index!, editor!, (editor, index, tabContainer) => { + this.setEditorTabColor(editor, tabContainer, isActiveTab); + }); } } diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts index 6252f2b6dc..9e96a1c7ab 100644 --- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts @@ -42,7 +42,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { private diffNavigator: DiffNavigator | undefined; private readonly diffNavigatorDisposables = this._register(new DisposableStore()); - private reverseColor: boolean; // {{SQL CARBON EDIT}} add property + private reverseColor?: boolean; // {{SQL CARBON EDIT}} add property constructor( @ITelemetryService telemetryService: ITelemetryService, diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 0b2e895ab4..b0a1d271fe 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -65,7 +65,7 @@ export abstract class MenubarControl extends Disposable { // 'Terminal': IMenu; {{SQL CARBON EDIT}} - Disable unusued menus 'Window'?: IMenu; 'Help': IMenu; - // [index: string]: IMenu | undefined; {{SQL CARBON EDIT}} - Disable unusued menus + [index: string]: IMenu | undefined; }; protected topLevelTitles: { [menu: string]: string } = { diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 44c70fb1a5..f1d60fbd02 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -2818,7 +2818,7 @@ export class InstallVSIXAction extends Action { static readonly ID = 'workbench.extensions.action.installVSIX'; static readonly LABEL = localize('installVSIX', "Install from VSIX..."); - static readonly AVAILABLE = !(product.disabledFeatures?.indexOf(InstallVSIXAction.ID) >= 0); // {{SQL CARBON EDIT}} add available logic + static readonly AVAILABLE = !(product.disabledFeatures && product.disabledFeatures.indexOf(InstallVSIXAction.ID) >= 0); // {{SQL CARBON EDIT}} add available logic constructor( id = InstallVSIXAction.ID, diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts index 2dbfb0a31a..cbca427b70 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts @@ -130,9 +130,9 @@ class Extension implements IExtension { } // {{SQL CARBON EDIT}} - get downloadPage(): string { + get downloadPage(): string | undefined { if (!this.productService.extensionsGallery) { - return null; + return undefined; } return this.gallery && this.gallery.assets && this.gallery.assets.downloadPage && this.gallery.assets.downloadPage.uri; @@ -846,7 +846,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension if (extension.publisherDisplayName === 'Microsoft') { await this.downloadOrBrowse(extension); } else { - return Promise.resolve(null); + return Promise.reject(new Error('Extension Not Allowed')); } } await this.downloadOrBrowse(extension); @@ -856,11 +856,11 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension // {{SQL CARBON EDIT}} private downloadOrBrowse(ext: IExtension): Promise { - if (ext.gallery.assets.downloadPage && ext.gallery.assets.downloadPage.uri) { - this.openerService.open(URI.parse(ext.gallery.assets.downloadPage.uri)); + if (ext.gallery!.assets.downloadPage && ext.gallery!.assets.downloadPage.uri) { + this.openerService.open(URI.parse(ext.gallery!.assets.downloadPage.uri)); return Promise.resolve(undefined); } else { - return this.extensionService.installFromGallery(ext.gallery); + return this.extensionService.installFromGallery(ext.gallery!); } } // {{SQL CARBON EDIT}} - End diff --git a/src/vs/workbench/contrib/extensions/common/extensions.ts b/src/vs/workbench/contrib/extensions/common/extensions.ts index ef8403c10a..7e3a55c928 100644 --- a/src/vs/workbench/contrib/extensions/common/extensions.ts +++ b/src/vs/workbench/contrib/extensions/common/extensions.ts @@ -42,8 +42,7 @@ export interface IExtension { readonly latestVersion: string; readonly description: string; readonly url?: string; - // {{SQL CARBON EDIT}} - readonly downloadPage?: string; + readonly downloadPage?: string; // {{SQL CARBON EDIT}} readonly repository?: string; readonly iconUrl: string; readonly iconUrlFallback: string;