diff --git a/src/sql/base/browser/ui/breadcrumb/breadcrumb.component.ts b/src/sql/base/browser/ui/breadcrumb/breadcrumb.component.ts index ae60c4df52..c1ecf06450 100644 --- a/src/sql/base/browser/ui/breadcrumb/breadcrumb.component.ts +++ b/src/sql/base/browser/ui/breadcrumb/breadcrumb.component.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import 'vs/css!sql/media/icons/common-icons'; import 'vs/css!./media/breadcrumb'; diff --git a/src/sql/base/browser/ui/button/button.ts b/src/sql/base/browser/ui/button/button.ts index 604449eec2..16d89c6569 100644 --- a/src/sql/base/browser/ui/button/button.ts +++ b/src/sql/base/browser/ui/button/button.ts @@ -3,7 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import { Button as vsButton, IButtonOptions, IButtonStyles as vsIButtonStyles } from 'vs/base/browser/ui/button/button'; import * as DOM from 'vs/base/browser/dom'; import { Color } from 'vs/base/common/color'; diff --git a/src/sql/base/browser/ui/checkbox/checkbox.component.ts b/src/sql/base/browser/ui/checkbox/checkbox.component.ts index dfabab6a53..0838f2ec03 100644 --- a/src/sql/base/browser/ui/checkbox/checkbox.component.ts +++ b/src/sql/base/browser/ui/checkbox/checkbox.component.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import { Component, Inject, forwardRef, ElementRef, OnInit, Input, Output, OnChanges, SimpleChanges, EventEmitter diff --git a/src/sql/base/browser/ui/dropdownList/dropdownList.ts b/src/sql/base/browser/ui/dropdownList/dropdownList.ts index 466ff2ddf3..520053afa1 100644 --- a/src/sql/base/browser/ui/dropdownList/dropdownList.ts +++ b/src/sql/base/browser/ui/dropdownList/dropdownList.ts @@ -3,7 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import 'vs/css!./media/dropdownList'; import * as DOM from 'vs/base/browser/dom'; import { Dropdown, IDropdownOptions } from 'vs/base/browser/ui/dropdown/dropdown'; diff --git a/src/sql/base/browser/ui/editableDropdown/dropdown.ts b/src/sql/base/browser/ui/editableDropdown/dropdown.ts index 51db880375..9f73a0b3f2 100644 --- a/src/sql/base/browser/ui/editableDropdown/dropdown.ts +++ b/src/sql/base/browser/ui/editableDropdown/dropdown.ts @@ -10,7 +10,6 @@ import { DropdownDataSource, DropdownFilter, DropdownModel, DropdownRenderer, Dr import { IContextViewProvider, ContextView } from 'vs/base/browser/ui/contextview/contextview'; import { mixin } from 'vs/base/common/objects'; -import { Builder, $ } from 'sql/base/browser/builder'; import { InputBox, IInputBoxStyles } from 'sql/base/browser/ui/inputBox/inputBox'; import { IMessage, MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; @@ -22,6 +21,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode } from 'vs/base/common/keyCodes'; import { Tree } from 'vs/base/parts/tree/browser/treeImpl'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; export interface IDropdownOptions extends IDropdownStyles { /** @@ -74,9 +74,9 @@ const defaults: IDropdownOptions = { }; export class Dropdown extends Disposable { - private $el: Builder; - private $input: Builder; - private $treeContainer: Builder; + private _el: HTMLElement; + private _inputContainer: HTMLElement; + private _treeContainer: HTMLElement; private _input: InputBox; private _tree: Tree; private _options: IDropdownOptions; @@ -101,16 +101,19 @@ export class Dropdown extends Disposable { constructor( container: HTMLElement, contextViewService: IContextViewProvider, + readonly layoutService: ILayoutService, opt?: IDropdownOptions ) { super(); - this._contextView = new ContextView(document.body); + this._contextView = new ContextView(layoutService.container); this._options = opt || Object.create(null); mixin(this._options, defaults, false) as IDropdownOptions; - this.$el = $('.monaco-dropdown').style('width', '100%').appendTo(container); + this._el = DOM.append(container, DOM.$('.monaco-dropdown')); + this._el.style.width = '100%'; - this.$input = $('.dropdown-input').style('width', '100%').appendTo(this.$el); - this.$treeContainer = $('.dropdown-tree'); + this._inputContainer = DOM.append(this._el, DOM.$('.dropdown-input')); + this._inputContainer.style.width = '100%'; + this._treeContainer = DOM.$('.dropdown-tree'); this._toggleAction = new ToggleDropdownAction(() => { this._showList(); @@ -118,7 +121,7 @@ export class Dropdown extends Disposable { this._tree.focusFirst(); }, this._options.actionLabel); - this._input = new InputBox(this.$input.getHTMLElement(), contextViewService, { + this._input = new InputBox(this._inputContainer, contextViewService, { validationOptions: { // @SQLTODO //showMessage: false, @@ -156,7 +159,7 @@ export class Dropdown extends Disposable { e.stopPropagation(); break; case KeyCode.Escape: - if (this.$treeContainer.getHTMLElement().parentElement) { + if (this._treeContainer.parentElement) { this._input.validate(); this._onBlur.fire(); this._contextView.hide(); @@ -170,7 +173,7 @@ export class Dropdown extends Disposable { e.stopPropagation(); break; case KeyCode.DownArrow: - if (!this.$treeContainer.getHTMLElement().parentElement) { + if (!this._treeContainer.parentElement) { this._showList(); } this._tree.domFocus(); @@ -181,7 +184,7 @@ export class Dropdown extends Disposable { } })); - this._tree = new Tree(this.$treeContainer.getHTMLElement(), { + this._tree = new Tree(this._treeContainer, { dataSource: this._dataSource, filter: this._filter, renderer: this._renderer, @@ -214,9 +217,6 @@ export class Dropdown extends Disposable { }); this._register(this._contextView); - this._register(this.$el); - this._register(this.$input); - this._register(this.$treeContainer); this._register(this._tree); this._register(this._input); this._register(this._contextView); @@ -227,14 +227,14 @@ export class Dropdown extends Disposable { this._onFocus.fire(); this._filter.filterString = ''; this._contextView.show({ - getAnchor: () => this.$input.getHTMLElement(), + getAnchor: () => this._inputContainer, render: container => { - this.$treeContainer.appendTo(container); + DOM.append(container, this._treeContainer); this._layoutTree(); return { dispose: () => { } }; }, - onDOMEvent: (e: any) => { - if (!DOM.isAncestor(e.srcElement, this.$el.getHTMLElement()) && !DOM.isAncestor(e.srcElement, this.$treeContainer.getHTMLElement())) { + onDOMEvent: e => { + if (!DOM.isAncestor((e.srcElement), this._el) && !DOM.isAncestor((e.srcElement), this._treeContainer)) { this._input.validate(); this._onBlur.fire(); this._contextView.hide(); @@ -254,8 +254,9 @@ export class Dropdown extends Disposable { } }, 0); let height = filteredLength * this._renderer.getHeight() > this._options.maxHeight! ? this._options.maxHeight! : filteredLength * this._renderer.getHeight(); - this.$treeContainer.style('height', height + 'px').style('width', DOM.getContentWidth(this.$input.getHTMLElement()) - 2 + 'px'); - this._tree.layout(parseInt(this.$treeContainer.style('height'))); + this._treeContainer.style.height = height + 'px'; + this._treeContainer.style.width = DOM.getContentWidth(this._inputContainer) - 2 + 'px'; + this._tree.layout(parseInt(this._treeContainer.style.height)); this._tree.refresh(); } } @@ -265,8 +266,9 @@ export class Dropdown extends Disposable { this._filter.filterString = ''; this._dataSource.options = vals.map(i => { return { value: i }; }); let height = this._dataSource.options.length * 22 > this._options.maxHeight! ? this._options.maxHeight! : this._dataSource.options.length * 22; - this.$treeContainer.style('height', height + 'px').style('width', DOM.getContentWidth(this.$input.getHTMLElement()) - 2 + 'px'); - this._tree.layout(parseInt(this.$treeContainer.style('height'))); + this._treeContainer.style.height = height + 'px'; + this._treeContainer.style.width = DOM.getContentWidth(this._inputContainer) - 2 + 'px'; + this._tree.layout(parseInt(this._treeContainer.style.height)); this._tree.setInput(new DropdownModel()); this._input.validate(); } @@ -292,10 +294,8 @@ export class Dropdown extends Disposable { style(style: IListStyles & IInputBoxStyles & IDropdownStyles) { this._tree.style(style); this._input.style(style); - if (style.contextBackground) { - this.$treeContainer.style('background-color', style.contextBackground.toString()); - } - this.$treeContainer.style('outline', `1px solid ${style.contextBorder || this._options.contextBorder}`); + this._treeContainer.style.backgroundColor = style.contextBackground ? style.contextBackground.toString() : null; + this._treeContainer.style.outline = `1px solid ${style.contextBorder || this._options.contextBorder}`; } private _inputValidator(value: string): IMessage | null { diff --git a/src/sql/base/browser/ui/editableDropdown/dropdownTree.ts b/src/sql/base/browser/ui/editableDropdown/dropdownTree.ts index 7e637f073e..2a15b5aa5b 100644 --- a/src/sql/base/browser/ui/editableDropdown/dropdownTree.ts +++ b/src/sql/base/browser/ui/editableDropdown/dropdownTree.ts @@ -9,7 +9,6 @@ import { generateUuid } from 'vs/base/common/uuid'; import * as DOM from 'vs/base/browser/dom'; import { Event, Emitter } from 'vs/base/common/event'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; -import { $ } from 'sql/base/browser/builder'; export interface Template { label: HTMLElement; @@ -34,9 +33,13 @@ export class DropdownRenderer implements tree.IRenderer { } public renderTemplate(tree: tree.ITree, templateId: string, container: HTMLElement): Template { - const row = $('div.list-row').style('height', '22px').style('padding-left', '5px').getHTMLElement(); + const row = DOM.$('div.list-row'); + row.style.height = '22px'; + row.style.paddingLeft = '5px'; DOM.append(container, row); - const label = $('span.label').style('margin', 'auto').style('vertical-align', 'middle').getHTMLElement(); + const label = DOM.$('span.label'); + label.style.margin = 'auto'; + label.style.verticalAlign = 'middle'; DOM.append(row, label); return { label, row }; diff --git a/src/sql/base/browser/ui/editableDropdown/editableDropdown.component.ts b/src/sql/base/browser/ui/editableDropdown/editableDropdown.component.ts index 2f7339eabb..7c08996a23 100644 --- a/src/sql/base/browser/ui/editableDropdown/editableDropdown.component.ts +++ b/src/sql/base/browser/ui/editableDropdown/editableDropdown.component.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import { Component, Inject, forwardRef, ElementRef, OnInit, Input, Output, OnChanges, SimpleChanges, EventEmitter @@ -12,10 +10,11 @@ import { import { Dropdown, IDropdownOptions } from 'sql/base/browser/ui/editableDropdown/dropdown'; import { AngularDisposable } from 'sql/base/node/lifecycle'; +import { attachEditableDropdownStyler } from 'sql/platform/theme/common/styler'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; -import { attachEditableDropdownStyler } from 'sql/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; @Component({ selector: 'editable-select-box', @@ -35,7 +34,8 @@ export class EditableDropDown extends AngularDisposable implements OnInit, OnCha constructor( @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(IThemeService) private themeService: IThemeService, - @Inject(IContextViewService) private contextViewService: IContextViewService + @Inject(IContextViewService) private contextViewService: IContextViewService, + @Inject(ILayoutService) private layoutService: ILayoutService ) { super(); } @@ -49,7 +49,7 @@ export class EditableDropDown extends AngularDisposable implements OnInit, OnCha ariaLabel: '', actionLabel: '' }; - this._selectbox = new Dropdown(this._el.nativeElement, this.contextViewService, dropdownOptions); + this._selectbox = new Dropdown(this._el.nativeElement, this.contextViewService, this.layoutService, dropdownOptions); this._selectbox.values = this.options; this._selectbox.value = this.selectedOption; diff --git a/src/sql/base/browser/ui/inputBox/inputBox.component.ts b/src/sql/base/browser/ui/inputBox/inputBox.component.ts index 4697b68663..e64f774ae6 100644 --- a/src/sql/base/browser/ui/inputBox/inputBox.component.ts +++ b/src/sql/base/browser/ui/inputBox/inputBox.component.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import { Component, Inject, forwardRef, ElementRef, OnInit, Input, Output, OnChanges, SimpleChanges, EventEmitter diff --git a/src/sql/base/browser/ui/inputBox/inputBox.ts b/src/sql/base/browser/ui/inputBox/inputBox.ts index 11a7cfba8d..1959ddfd32 100644 --- a/src/sql/base/browser/ui/inputBox/inputBox.ts +++ b/src/sql/base/browser/ui/inputBox/inputBox.ts @@ -3,7 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import { InputBox as vsInputBox, IInputOptions, IInputBoxStyles as vsIInputBoxStyles, IMessage } from 'vs/base/browser/ui/inputbox/inputBox'; import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { Color } from 'vs/base/common/color'; diff --git a/src/sql/base/browser/ui/listBox/listBox.ts b/src/sql/base/browser/ui/listBox/listBox.ts index 3527364f3f..bbea5d3e2f 100644 --- a/src/sql/base/browser/ui/listBox/listBox.ts +++ b/src/sql/base/browser/ui/listBox/listBox.ts @@ -3,7 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import { SelectBox, ISelectBoxStyles, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox'; import { Color } from 'vs/base/common/color'; import { IMessage, MessageType, defaultOpts } from 'vs/base/browser/ui/inputbox/inputBox'; diff --git a/src/sql/base/browser/ui/panel/panel.module.ts b/src/sql/base/browser/ui/panel/panel.module.ts index c1f9d345bf..1af8bc261b 100644 --- a/src/sql/base/browser/ui/panel/panel.module.ts +++ b/src/sql/base/browser/ui/panel/panel.module.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; diff --git a/src/sql/base/browser/ui/panel/panelStyles.ts b/src/sql/base/browser/ui/panel/panelStyles.ts index f34407b983..09c5bfb0b2 100644 --- a/src/sql/base/browser/ui/panel/panelStyles.ts +++ b/src/sql/base/browser/ui/panel/panelStyles.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import 'vs/css!./media/panel'; import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; @@ -69,4 +70,4 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { } `); } -}); \ No newline at end of file +}); diff --git a/src/sql/base/browser/ui/panel/tab.component.ts b/src/sql/base/browser/ui/panel/tab.component.ts index 208df1afeb..6ff5dd53c5 100644 --- a/src/sql/base/browser/ui/panel/tab.component.ts +++ b/src/sql/base/browser/ui/panel/tab.component.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import { Component, Input, ContentChild, OnDestroy, TemplateRef, ChangeDetectorRef, forwardRef, Inject } from '@angular/core'; import { Action } from 'vs/base/common/actions'; diff --git a/src/sql/base/browser/ui/panel/tabActions.ts b/src/sql/base/browser/ui/panel/tabActions.ts index 3a595d2492..ed9b8ff7b3 100644 --- a/src/sql/base/browser/ui/panel/tabActions.ts +++ b/src/sql/base/browser/ui/panel/tabActions.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import { Action } from 'vs/base/common/actions'; import * as nls from 'vs/nls'; @@ -25,4 +26,4 @@ export class CloseTabAction extends Action { return Promise.resolve(false); } } -} \ No newline at end of file +} diff --git a/src/sql/base/browser/ui/panel/tabHeader.component.ts b/src/sql/base/browser/ui/panel/tabHeader.component.ts index c6415cb908..06b6a36280 100644 --- a/src/sql/base/browser/ui/panel/tabHeader.component.ts +++ b/src/sql/base/browser/ui/panel/tabHeader.component.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import 'vs/css!sql/media/icons/common-icons'; import 'vs/css!./tabHeader'; diff --git a/src/sql/base/browser/ui/scrollable/scrollable.module.ts b/src/sql/base/browser/ui/scrollable/scrollable.module.ts index 32b5f65bf4..74c73c16da 100644 --- a/src/sql/base/browser/ui/scrollable/scrollable.module.ts +++ b/src/sql/base/browser/ui/scrollable/scrollable.module.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; diff --git a/src/sql/base/browser/ui/scrollableSplitview/scrollableSplitview.ts b/src/sql/base/browser/ui/scrollableSplitview/scrollableSplitview.ts index 223171f695..fa66bf7186 100644 --- a/src/sql/base/browser/ui/scrollableSplitview/scrollableSplitview.ts +++ b/src/sql/base/browser/ui/scrollableSplitview/scrollableSplitview.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import 'vs/css!./scrollableSplitview'; import { HeightMap, IView as HeightIView, IViewItem as HeightIViewItem } from './heightMap'; diff --git a/src/sql/base/browser/ui/selectBox/selectBox.component.ts b/src/sql/base/browser/ui/selectBox/selectBox.component.ts index a1c6084023..d11ba3f0ec 100644 --- a/src/sql/base/browser/ui/selectBox/selectBox.component.ts +++ b/src/sql/base/browser/ui/selectBox/selectBox.component.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import { Component, Inject, forwardRef, ElementRef, OnInit, Input, Output, OnChanges, SimpleChanges, EventEmitter diff --git a/src/sql/base/browser/ui/selectBox/selectBox.ts b/src/sql/base/browser/ui/selectBox/selectBox.ts index c35c57c06f..69998178bf 100644 --- a/src/sql/base/browser/ui/selectBox/selectBox.ts +++ b/src/sql/base/browser/ui/selectBox/selectBox.ts @@ -3,7 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import 'vs/css!./media/selectBox'; import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox'; diff --git a/src/sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin.ts b/src/sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin.ts index 35d7e318bb..74fb883212 100644 --- a/src/sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin.ts +++ b/src/sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin.ts @@ -3,11 +3,8 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { range } from 'vs/base/common/arrays'; /** * Implements the various additional navigation keybindings we want out of slickgrid diff --git a/src/sql/base/browser/ui/table/plugins/copyKeybind.plugin.ts b/src/sql/base/browser/ui/table/plugins/copyKeybind.plugin.ts index f65521ad49..b0c6af3df2 100644 --- a/src/sql/base/browser/ui/table/plugins/copyKeybind.plugin.ts +++ b/src/sql/base/browser/ui/table/plugins/copyKeybind.plugin.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Emitter, Event } from 'vs/base/common/event'; diff --git a/src/sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin.ts b/src/sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin.ts index 27d1321224..5a8bbea43f 100644 --- a/src/sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin.ts +++ b/src/sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import * as DOM from 'vs/base/browser/dom'; import * as Platform from 'vs/base/common/platform'; import { StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent'; diff --git a/src/sql/base/browser/ui/table/plugins/rowNumberColumn.plugin.ts b/src/sql/base/browser/ui/table/plugins/rowNumberColumn.plugin.ts index 0fed36a4f6..3cade746ff 100644 --- a/src/sql/base/browser/ui/table/plugins/rowNumberColumn.plugin.ts +++ b/src/sql/base/browser/ui/table/plugins/rowNumberColumn.plugin.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - export interface IRowNumberColumnOptions { numberOfRows: number; cssClass?: string; diff --git a/src/sql/base/browser/ui/table/tableDataView.ts b/src/sql/base/browser/ui/table/tableDataView.ts index f3b0683533..667a7f8bd0 100644 --- a/src/sql/base/browser/ui/table/tableDataView.ts +++ b/src/sql/base/browser/ui/table/tableDataView.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; diff --git a/src/sql/base/browser/ui/taskbar/actionbar.ts b/src/sql/base/browser/ui/taskbar/actionbar.ts index 63500682ea..a8b9c1ed9a 100644 --- a/src/sql/base/browser/ui/taskbar/actionbar.ts +++ b/src/sql/base/browser/ui/taskbar/actionbar.ts @@ -5,7 +5,6 @@ import 'vs/css!vs/base/browser/ui/actionbar/actionbar'; -import { Builder, $ } from 'sql/base/browser/builder'; import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; @@ -35,21 +34,22 @@ export class ActionBar extends ActionRunner implements IActionRunner { // Items private _items: IActionItem[]; - private _focusedItem: number; + private _focusedItem?: number; private _focusTracker: DOM.IFocusTracker; // Elements private _domNode: HTMLElement; private _actionsList: HTMLElement; - constructor(container: HTMLElement | Builder, options: IActionBarOptions = defaultOptions) { + constructor(container: HTMLElement, options: IActionBarOptions = defaultOptions) { super(); this._options = options; this._context = options.context; this._toDispose = []; - this._actionRunner = this._options.actionRunner; - if (!this._actionRunner) { + if (this._options.actionRunner) { + this._actionRunner = this._options.actionRunner; + } else { this._actionRunner = new ActionRunner(); this._toDispose.push(this._actionRunner); } @@ -71,7 +71,7 @@ export class ActionBar extends ActionRunner implements IActionRunner { this._domNode.className += ' vertical'; } - $(this._domNode).on(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => { + this._register(DOM.addDisposableListener(this._domNode, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => { let event = new StandardKeyboardEvent(e); let eventHandled = true; @@ -91,15 +91,15 @@ export class ActionBar extends ActionRunner implements IActionRunner { event.preventDefault(); event.stopPropagation(); } - }); + })); // Prevent native context menu on actions - $(this._domNode).on(DOM.EventType.CONTEXT_MENU, (e: Event) => { + this._register(DOM.addDisposableListener(this._domNode, DOM.EventType.CONTEXT_MENU, (e: Event) => { e.preventDefault(); e.stopPropagation(); - }); + })); - $(this._domNode).on(DOM.EventType.KEY_UP, (e: KeyboardEvent) => { + this._register(DOM.addDisposableListener(this._domNode, DOM.EventType.KEY_UP, (e: KeyboardEvent) => { let event = new StandardKeyboardEvent(e); // Run action on Enter/Space @@ -113,9 +113,9 @@ export class ActionBar extends ActionRunner implements IActionRunner { else if (event.equals(KeyCode.Tab) || event.equals(KeyMod.Shift | KeyCode.Tab)) { this.updateFocusedItem(); } - }); + })); - this._focusTracker = DOM.trackFocus(this._domNode); + this._focusTracker = this._register(DOM.trackFocus(this._domNode)); this._focusTracker.onDidBlur(() => { if (document.activeElement === this._domNode || !DOM.isAncestor(document.activeElement, this._domNode)) { @@ -136,7 +136,7 @@ export class ActionBar extends ActionRunner implements IActionRunner { this._domNode.appendChild(this._actionsList); - ((container instanceof Builder) ? container.getHTMLElement() : container).appendChild(this._domNode); + container.appendChild(this._domNode); } public setAriaLabel(label: string): void { @@ -183,8 +183,8 @@ export class ActionBar extends ActionRunner implements IActionRunner { } } - public getContainer(): Builder { - return $(this._domNode); + public getContainer(): HTMLElement { + return this._domNode; } /** @@ -216,7 +216,7 @@ export class ActionBar extends ActionRunner implements IActionRunner { actionItemElement.className = 'action-item'; actionItemElement.setAttribute('role', 'presentation'); - let item: IActionItem = null; + let item: IActionItem | undefined = undefined; if (this._options.actionItemProvider) { item = this._options.actionItemProvider(action); @@ -251,7 +251,7 @@ export class ActionBar extends ActionRunner implements IActionRunner { public clear(): void { // Do not dispose action items if they were provided from outside this._items = this._options.actionItemProvider ? [] : lifecycle.dispose(this._items); - $(this._actionsList).empty(); + DOM.clearNode(this._actionsList); } public length(): number { @@ -364,19 +364,12 @@ export class ActionBar extends ActionRunner implements IActionRunner { } public dispose(): void { - if (this._items !== null) { - lifecycle.dispose(this._items); - } - this._items = null; - - if (this._focusTracker) { - this._focusTracker.dispose(); - this._focusTracker = null; - } + lifecycle.dispose(this._items); + this._items = []; this._toDispose = lifecycle.dispose(this._toDispose); - this.getContainer().destroy(); + this._domNode.remove(); super.dispose(); } diff --git a/src/sql/base/browser/ui/taskbar/taskbar.ts b/src/sql/base/browser/ui/taskbar/taskbar.ts index f7fa48285f..df3a891995 100644 --- a/src/sql/base/browser/ui/taskbar/taskbar.ts +++ b/src/sql/base/browser/ui/taskbar/taskbar.ts @@ -3,18 +3,14 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - import 'vs/css!./media/taskbar'; import 'vs/css!./media/icons'; import 'vs/css!sql/media/icons/common-icons'; import { ActionBar } from './actionbar'; -import { Builder, $ } from 'sql/base/browser/builder'; import { Action, IActionRunner, IAction } from 'vs/base/common/actions'; import { ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; -import { IContextMenuProvider } from 'vs/base/browser/ui/dropdown/dropdown'; import { IToolBarOptions } from 'vs/base/browser/ui/toolbar/toolbar'; /** @@ -37,21 +33,19 @@ export interface ITaskbarContent { export class Taskbar { private options: IToolBarOptions; private actionBar: ActionBar; - private lookupKeybindings: boolean; - constructor(container: HTMLElement, contextMenuProvider: IContextMenuProvider, options: IToolBarOptions = { orientation: ActionsOrientation.HORIZONTAL }) { + constructor(container: HTMLElement, options: IToolBarOptions = { orientation: ActionsOrientation.HORIZONTAL }) { this.options = options; - this.lookupKeybindings = typeof this.options.getKeyBinding === 'function' && typeof this.options.getKeyBinding === 'function'; let element = document.createElement('div'); element.className = 'monaco-toolbar carbon-taskbar'; container.appendChild(element); - this.actionBar = new ActionBar($(element), { + this.actionBar = new ActionBar(element, { orientation: options.orientation, ariaLabel: options.ariaLabel, actionItemProvider: (action: Action) => { - return options.actionItemProvider ? options.actionItemProvider(action) : null; + return options.actionItemProvider ? options.actionItemProvider(action) : undefined; } }); } @@ -98,7 +92,7 @@ export class Taskbar { this.actionBar.context = context; } - public getContainer(): Builder { + public getContainer(): HTMLElement { return this.actionBar.getContainer(); } @@ -131,8 +125,9 @@ export class Taskbar { } private getKeybindingLabel(action: IAction): string { - const key = this.lookupKeybindings ? this.options.getKeyBinding(action) : void 0; - return key ? key.getLabel() : ''; + const key = this.options.getKeyBinding ? this.options.getKeyBinding(action) : undefined; + const label = key ? key.getLabel() : undefined; + return label || ''; } public addAction(primaryAction: IAction): void { diff --git a/src/sql/base/common/decorators.ts b/src/sql/base/common/decorators.ts index 5ac9f9a423..481c43a7b7 100644 --- a/src/sql/base/common/decorators.ts +++ b/src/sql/base/common/decorators.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - /** * Alterable version of the vs memorize function; to unmemoize use unmemoize */ diff --git a/src/sql/base/common/eventEmitter.ts b/src/sql/base/common/eventEmitter.ts index 5904eb8d02..ba5289a555 100644 --- a/src/sql/base/common/eventEmitter.ts +++ b/src/sql/base/common/eventEmitter.ts @@ -2,9 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; -import Errors = require('vs/base/common/errors'); +import * as errors from 'vs/base/common/errors'; import { IDisposable } from 'vs/base/common/lifecycle'; export class EmitterEvent { @@ -288,7 +287,7 @@ function safeInvokeNoArg(func: Function): T | undefined { try { return func(); } catch (e) { - Errors.onUnexpectedError(e); + errors.onUnexpectedError(e); } return undefined; } @@ -297,6 +296,6 @@ function safeInvoke1Arg(func: Function, arg1: any): any { try { return func(arg1); } catch (e) { - Errors.onUnexpectedError(e); + errors.onUnexpectedError(e); } } diff --git a/src/sql/base/common/log.ts b/src/sql/base/common/log.ts index b5537cafba..d110164a97 100644 --- a/src/sql/base/common/log.ts +++ b/src/sql/base/common/log.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - export function log(...args: any[]): void { console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args); } diff --git a/src/sql/base/common/map.ts b/src/sql/base/common/map.ts index d13a792806..2f28a3ce47 100644 --- a/src/sql/base/common/map.ts +++ b/src/sql/base/common/map.ts @@ -3,8 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; - export function toObject(map: Map): { [key: string]: V } { if (map) { let rt: { [key: string]: V } = Object.create(null); diff --git a/src/sql/base/common/objects.ts b/src/sql/base/common/objects.ts index 8f06d6815a..2037d64d53 100644 --- a/src/sql/base/common/objects.ts +++ b/src/sql/base/common/objects.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; + import * as Types from 'vs/base/common/types'; export function clone(obj: T): T { diff --git a/src/sql/base/common/promise.ts b/src/sql/base/common/promise.ts index a336b8c127..0c7e9ef9e0 100644 --- a/src/sql/base/common/promise.ts +++ b/src/sql/base/common/promise.ts @@ -2,7 +2,6 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; /** * Deferred promise @@ -23,4 +22,4 @@ export class Deferred { then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable | void): Thenable { return this.promise.then(onfulfilled, onrejected); } -} \ No newline at end of file +} diff --git a/src/sql/base/common/strings.ts b/src/sql/base/common/strings.ts index 4f8151b2b1..98daa107d5 100644 --- a/src/sql/base/common/strings.ts +++ b/src/sql/base/common/strings.ts @@ -2,7 +2,6 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; /** * Converts HTML characters inside the string to use entities instead. Makes the string safe from diff --git a/src/sql/base/node/lifecycle.ts b/src/sql/base/node/lifecycle.ts index 6bbcbc7791..944c1745b6 100644 --- a/src/sql/base/node/lifecycle.ts +++ b/src/sql/base/node/lifecycle.ts @@ -3,7 +3,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import { OnDestroy } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; diff --git a/src/sql/base/node/rxjsUtils.ts b/src/sql/base/node/rxjsUtils.ts index 3a869c6335..67209ba518 100644 --- a/src/sql/base/node/rxjsUtils.ts +++ b/src/sql/base/node/rxjsUtils.ts @@ -2,7 +2,6 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import { Subscription } from 'rxjs/Subscription'; import { IDisposable } from 'vs/base/common/lifecycle'; @@ -13,4 +12,4 @@ export function toDisposableSubscription(sub: Subscription): IDisposable { sub.unsubscribe(); } }; -} \ No newline at end of file +} diff --git a/src/sql/parts/disasterRecovery/restore/restoreDialog.ts b/src/sql/parts/disasterRecovery/restore/restoreDialog.ts index 850c412f0e..1231a9b419 100644 --- a/src/sql/parts/disasterRecovery/restore/restoreDialog.ts +++ b/src/sql/parts/disasterRecovery/restore/restoreDialog.ts @@ -42,6 +42,7 @@ import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes'; import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService'; import { IFileBrowserDialogController } from 'sql/workbench/services/fileBrowser/common/fileBrowserDialogController'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; interface FileListElement { logicalFileName: string; @@ -128,13 +129,13 @@ export class RestoreDialog extends Modal { constructor( optionsMetadata: azdata.ServiceOption[], - @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, + @IWorkbenchLayoutService layoutService: ILayoutService, @IThemeService themeService: IThemeService, @IContextViewService private _contextViewService: IContextViewService, @ITelemetryService telemetryService: ITelemetryService, @IContextKeyService contextKeyService: IContextKeyService, @IFileBrowserDialogController private fileBrowserDialogService: IFileBrowserDialogController, - @IClipboardService clipboardService: IClipboardService + @IClipboardService clipboardService: IClipboardService, ) { super(localize('RestoreDialogTitle', 'Restore database'), TelemetryKeys.Restore, telemetryService, layoutService, clipboardService, themeService, contextKeyService, { hasErrors: true, isWide: true, hasSpinner: true }); this._restoreTitle = localize('restoreDialog.restoreTitle', 'Restore database'); @@ -233,7 +234,7 @@ export class RestoreDialog extends Modal { inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => { // Get the bootstrap params and perform the bootstrap inputCellContainer.style('width', '100%'); - this._databaseDropdown = new Dropdown(inputCellContainer.getHTMLElement(), this._contextViewService, + this._databaseDropdown = new Dropdown(inputCellContainer.getHTMLElement(), this._contextViewService, this.layoutService, { strictSelection: false, ariaLabel: LocalizedStrings.TARGETDATABASE, diff --git a/src/sql/parts/editData/editor/editDataEditor.ts b/src/sql/parts/editData/editor/editDataEditor.ts index 44552a571f..5f13876843 100644 --- a/src/sql/parts/editData/editor/editDataEditor.ts +++ b/src/sql/parts/editData/editor/editDataEditor.ts @@ -21,7 +21,6 @@ import { EditDataInput } from 'sql/parts/editData/common/editDataInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import * as queryContext from 'sql/parts/query/common/queryContext'; import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { Action } from 'vs/base/common/actions'; import { IQueryModelService } from 'sql/platform/query/common/queryModel'; @@ -80,7 +79,6 @@ export class EditDataEditor extends BaseEditor { @IThemeService themeService: IThemeService, @IInstantiationService private _instantiationService: IInstantiationService, @IEditorService private _editorService: IEditorService, - @IContextMenuService private _contextMenuService: IContextMenuService, @IQueryModelService private _queryModelService: IQueryModelService, @IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService, @IContextKeyService contextKeyService: IContextKeyService, @@ -319,7 +317,7 @@ export class EditDataEditor extends BaseEditor { private _createTaskbar(parentElement: HTMLElement): void { // Create QueryTaskbar this._taskbarContainer = DOM.append(parentElement, DOM.$('div')); - this._taskbar = new Taskbar(this._taskbarContainer, this._contextMenuService, { + this._taskbar = new Taskbar(this._taskbarContainer, { actionItemProvider: (action: Action) => this._getChangeMaxRowsAction(action) }); @@ -488,7 +486,7 @@ export class EditDataEditor extends BaseEditor { } private _getTaskBarHeight(): number { - let taskBarElement = this._taskbar.getContainer().getHTMLElement(); + let taskBarElement = this._taskbar.getContainer(); return DOM.getContentHeight(taskBarElement); } diff --git a/src/sql/parts/jobManagement/views/jobHistory.component.ts b/src/sql/parts/jobManagement/views/jobHistory.component.ts index 6c29635a3a..41665d6d42 100644 --- a/src/sql/parts/jobManagement/views/jobHistory.component.ts +++ b/src/sql/parts/jobManagement/views/jobHistory.component.ts @@ -71,13 +71,12 @@ export class JobHistoryComponent extends JobManagementView implements OnInit { private static readonly HEADING_HEIGHT: number = 24; constructor( - @Inject(forwardRef(() => ElementRef)) el: ElementRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface, @Inject(forwardRef(() => AgentViewComponent)) _agentViewComponent: AgentViewComponent, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IInstantiationService) private instantiationService: IInstantiationService, - @Inject(IContextMenuService) private contextMenuService: IContextMenuService, + @Inject(IContextMenuService) contextMenuService: IContextMenuService, @Inject(IJobManagementService) private _jobManagementService: IJobManagementService, @Inject(IKeybindingService) keybindingService: IKeybindingService, @Inject(IDashboardService) dashboardService: IDashboardService, @@ -191,7 +190,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit { let cachedHistory = self._jobCacheObject.getJobHistory(element.jobID); if (cachedHistory) { self.agentJobHistoryInfo = cachedHistory.find( - history => self.formatTime(history.runDate) === self.formatTime(element.runDate)); + history => self.formatTime(history.runDate) === self.formatTime(element.runDate)); } else { self.agentJobHistoryInfo = self._treeController.jobHistories.find( history => self.formatTime(history.runDate) === self.formatTime(element.runDate)); @@ -346,7 +345,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit { let editJobAction = this.instantiationService.createInstance(EditJobAction); let refreshAction = this.instantiationService.createInstance(JobsRefreshAction); let taskbar = this.actionBarContainer.nativeElement; - this._actionBar = new Taskbar(taskbar, this.contextMenuService); + this._actionBar = new Taskbar(taskbar); this._actionBar.context = { targetObject: this._agentJobInfo, ownerUri: this.ownerUri, component: this }; this._actionBar.setContent([ { action: runJobAction }, diff --git a/src/sql/parts/jobManagement/views/jobManagementView.ts b/src/sql/parts/jobManagement/views/jobManagementView.ts index 194fc9e69e..8788800890 100644 --- a/src/sql/parts/jobManagement/views/jobManagementView.ts +++ b/src/sql/parts/jobManagement/views/jobManagementView.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as azdata from 'azdata'; -import { ElementRef, AfterContentChecked, ViewChild, forwardRef, Inject } from '@angular/core'; +import { ElementRef, AfterContentChecked, ViewChild } from '@angular/core'; import { Table } from 'sql/base/browser/ui/table/table'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; @@ -14,7 +14,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { Taskbar } from '../../../base/browser/ui/taskbar/taskbar'; -import { JobsRefreshAction, IJobActionInfo } from 'sql/platform/jobManagement/common/jobActions'; +import { JobsRefreshAction } from 'sql/platform/jobManagement/common/jobActions'; import { TabChild } from 'sql/base/browser/ui/panel/tab.component'; import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService'; @@ -111,7 +111,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent let refreshAction = this._instantiationService.createInstance(JobsRefreshAction); let newAction: Action = this._instantiationService.createInstance(this.contextAction); let taskbar = this.actionBarContainer.nativeElement; - this._actionBar = new Taskbar(taskbar, this._contextMenuService); + this._actionBar = new Taskbar(taskbar); this._actionBar.setContent([ { action: refreshAction }, { action: newAction } @@ -127,4 +127,4 @@ export abstract class JobManagementView extends TabChild implements AfterContent export interface JobActionContext { canEdit: boolean; job: azdata.AgentJobInfo; -} \ No newline at end of file +} diff --git a/src/sql/parts/modelComponents/declarativeTable.component.ts b/src/sql/parts/modelComponents/declarativeTable.component.ts index c992e32da0..690cb91c2d 100644 --- a/src/sql/parts/modelComponents/declarativeTable.component.ts +++ b/src/sql/parts/modelComponents/declarativeTable.component.ts @@ -2,25 +2,18 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import 'vs/css!./declarativeTable'; + import { - Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver, - ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, QueryList, AfterViewInit + Component, Input, Inject, ChangeDetectorRef, forwardRef, ViewChild, ElementRef, OnDestroy, AfterViewInit } from '@angular/core'; import * as azdata from 'azdata'; import { ComponentBase } from 'sql/parts/modelComponents/componentBase'; import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces'; -import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; -import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; -import { Event, Emitter } from 'vs/base/common/event'; -import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component'; -import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component'; -import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editableDropdown.component'; import { ISelectData } from 'vs/base/browser/ui/selectBox/selectBox'; -import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component'; -import * as nls from 'vs/nls'; export enum DeclarativeDataType { string = 'string', @@ -37,7 +30,7 @@ export enum DeclarativeDataType { {{column.displayName}} - + @@ -63,8 +56,6 @@ export default class DeclarativeTableComponent extends ComponentBase implements @ViewChild('container', { read: ElementRef }) private _tableContainer: ElementRef; constructor( @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, - @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, - @Inject(IContextViewService) private contextViewService: IContextViewService, @Inject(forwardRef(() => ElementRef)) el: ElementRef ) { super(changeRef, el); diff --git a/src/sql/parts/modelComponents/dropdown.component.ts b/src/sql/parts/modelComponents/dropdown.component.ts index 9ab978258e..f8fa88f5ca 100644 --- a/src/sql/parts/modelComponents/dropdown.component.ts +++ b/src/sql/parts/modelComponents/dropdown.component.ts @@ -19,6 +19,7 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; @Component({ selector: 'modelview-dropdown', @@ -42,7 +43,8 @@ export default class DropDownComponent extends ComponentBase implements ICompone @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IContextViewService) private contextViewService: IContextViewService, - @Inject(forwardRef(() => ElementRef)) el: ElementRef + @Inject(forwardRef(() => ElementRef)) el: ElementRef, + @Inject(ILayoutService) private readonly layoutService: ILayoutService ) { super(changeRef, el); } @@ -61,7 +63,7 @@ export default class DropDownComponent extends ComponentBase implements ICompone ariaLabel: '', actionLabel: '' }; - this._editableDropdown = new Dropdown(this._editableDropDownContainer.nativeElement, this.contextViewService, + this._editableDropdown = new Dropdown(this._editableDropDownContainer.nativeElement, this.contextViewService, this.layoutService, dropdownOptions); this._register(this._editableDropdown); diff --git a/src/sql/parts/notebook/cellViews/code.component.ts b/src/sql/parts/notebook/cellViews/code.component.ts index 4ee862c976..a267d72740 100644 --- a/src/sql/parts/notebook/cellViews/code.component.ts +++ b/src/sql/parts/notebook/cellViews/code.component.ts @@ -25,7 +25,6 @@ import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorIn import * as DOM from 'vs/base/browser/dom'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { Event, Emitter } from 'vs/base/common/event'; import { CellTypes } from 'sql/parts/notebook/models/contracts'; @@ -53,7 +52,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange @Input() public set cellModel(value: ICellModel) { this._cellModel = value; if (this.toolbarElement && value && value.cellType === CellTypes.Markdown) { - let nativeToolbar = this.toolbarElement.nativeElement; + let nativeToolbar = this.toolbarElement.nativeElement; DOM.addClass(nativeToolbar, MARKDOWN_CLASS); } } @@ -102,13 +101,12 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange @Inject(IInstantiationService) private _instantiationService: IInstantiationService, @Inject(IModelService) private _modelService: IModelService, @Inject(IModeService) private _modeService: IModeService, - @Inject(IContextMenuService) private contextMenuService: IContextMenuService, @Inject(IConfigurationService) private _configurationService: IConfigurationService ) { super(); this._cellToggleMoreActions = this._instantiationService.createInstance(CellToggleMoreActions); this._register(Event.debounce(this._layoutEmitter.event, (l, e) => e, 250, /*leading=*/false) - (() => this.layout())); + (() => this.layout())); // Handle disconnect on removal of the cell, if it was the active cell this._register({ dispose: () => this.updateConnectionState(false) }); @@ -230,7 +228,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange let runCellAction = this._instantiationService.createInstance(RunCellAction, context); let taskbar = this.toolbarElement.nativeElement; - this._actionBar = new Taskbar(taskbar, this.contextMenuService); + this._actionBar = new Taskbar(taskbar); this._actionBar.context = context; this._actionBar.setContent([ { action: runCellAction } diff --git a/src/sql/parts/notebook/notebook.component.ts b/src/sql/parts/notebook/notebook.component.ts index 74dc0a0427..8fb2cd09b5 100644 --- a/src/sql/parts/notebook/notebook.component.ts +++ b/src/sql/parts/notebook/notebook.component.ts @@ -20,7 +20,6 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { fillInActions, LabeledMenuItemActionItem } from 'vs/platform/actions/browser/menuItemActionItem'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; -import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; import { AngularDisposable } from 'sql/base/node/lifecycle'; import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts'; import { ICellModel, IModelFactory, INotebookModel, NotebookContentChange } from 'sql/parts/notebook/models/modelInterfaces'; @@ -69,7 +68,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe constructor( - @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrapService: CommonServiceInterface, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IConnectionManagementService) private connectionManagementService: IConnectionManagementService, @@ -163,8 +161,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe } //Saves scrollTop value on scroll change - public scrollHandler(event: Event){ - this._scrollTop = (event.srcElement).scrollTop; + public scrollHandler(event: Event) { + this._scrollTop = (event.srcElement).scrollTop; } public unselectActiveCell() { @@ -380,7 +378,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe this._trustedAction.enabled = false; let taskbar = this.toolbar.nativeElement; - this._actionBar = new Taskbar(taskbar, this.contextMenuService, { actionItemProvider: action => this.actionItemProvider(action as Action) }); + this._actionBar = new Taskbar(taskbar, { actionItemProvider: action => this.actionItemProvider(action as Action) }); this._actionBar.context = this; this._actionBar.setContent([ { element: kernelContainer }, diff --git a/src/sql/parts/objectExplorer/viewlet/serverTreeDataSource.ts b/src/sql/parts/objectExplorer/viewlet/serverTreeDataSource.ts index 770f964b4c..97dc5d0102 100644 --- a/src/sql/parts/objectExplorer/viewlet/serverTreeDataSource.ts +++ b/src/sql/parts/objectExplorer/viewlet/serverTreeDataSource.ts @@ -80,6 +80,10 @@ export class ServerTreeDataSource implements IDataSource { node.setExpandedState(TreeItemCollapsibleState.Collapsed); node.errorStateMessage = expandError; this.showError(expandError); + // collapse node and refresh in case of error so remove tree cache + setTimeout(() => { + tree.collapse(element).then(() => tree.refresh(element)); + }); resolve([]); }); } @@ -109,4 +113,4 @@ export class ServerTreeDataSource implements IDataSource { this._errorMessageService.showDialog(Severity.Error, '', errorMessage); } } -} \ No newline at end of file +} diff --git a/src/sql/parts/profiler/editor/profilerEditor.ts b/src/sql/parts/profiler/editor/profilerEditor.ts index 2818daaf72..30763e3217 100644 --- a/src/sql/parts/profiler/editor/profilerEditor.ts +++ b/src/sql/parts/profiler/editor/profilerEditor.ts @@ -17,7 +17,7 @@ import { CONTEXT_PROFILER_EDITOR, PROFILER_TABLE_COMMAND_SEARCH } from './interf import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox'; import { textFormatter, slickGridDataItemColumnValueExtractor } from 'sql/parts/grid/services/sharedServices'; import { ProfilerResourceEditor } from './profilerResourceEditor'; -import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView'; +import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { ITextModel } from 'vs/editor/common/model'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput'; @@ -151,7 +151,6 @@ export class ProfilerEditor extends BaseEditor { @ITelemetryService telemetryService: ITelemetryService, @IWorkbenchThemeService themeService: IWorkbenchThemeService, @IInstantiationService private _instantiationService: IInstantiationService, - @IContextMenuService private _contextMenuService: IContextMenuService, @IModelService private _modelService: IModelService, @IProfilerService private _profilerService: IProfilerService, @IContextKeyService private _contextKeyService: IContextKeyService, @@ -207,7 +206,7 @@ export class ProfilerEditor extends BaseEditor { this._header = document.createElement('div'); this._header.className = 'profiler-header'; this._container.appendChild(this._header); - this._actionBar = new Taskbar(this._header, this._contextMenuService); + this._actionBar = new Taskbar(this._header); this._startAction = this._instantiationService.createInstance(Actions.ProfilerStart, Actions.ProfilerStart.ID, Actions.ProfilerStart.LABEL); this._startAction.enabled = false; this._createAction = this._instantiationService.createInstance(Actions.ProfilerCreate, Actions.ProfilerCreate.ID, Actions.ProfilerCreate.LABEL); diff --git a/src/sql/parts/query/editor/charting/chartView.ts b/src/sql/parts/query/editor/charting/chartView.ts index fbb0e624c4..e13e55c8a9 100644 --- a/src/sql/parts/query/editor/charting/chartView.ts +++ b/src/sql/parts/query/editor/charting/chartView.ts @@ -21,7 +21,7 @@ import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/int import { Registry } from 'vs/platform/registry/common/platform'; import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom'; import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; -import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { Builder } from 'sql/base/browser/builder'; import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; @@ -84,11 +84,10 @@ export class ChartView extends Disposable implements IPanelView { @IContextViewService private _contextViewService: IContextViewService, @IThemeService private _themeService: IThemeService, @IInstantiationService private _instantiationService: IInstantiationService, - @IContextMenuService contextMenuService: IContextMenuService ) { super(); this.taskbarContainer = $('div.taskbar-container'); - this.taskbar = new Taskbar(this.taskbarContainer, contextMenuService); + this.taskbar = new Taskbar(this.taskbarContainer); this.optionsControl = $('div.options-container'); let generalControls = $('div.general-controls'); this.optionsControl.appendChild(generalControls); diff --git a/src/sql/parts/query/editor/queryEditor.ts b/src/sql/parts/query/editor/queryEditor.ts index 21524855fd..ada03a5936 100644 --- a/src/sql/parts/query/editor/queryEditor.ts +++ b/src/sql/parts/query/editor/queryEditor.ts @@ -23,7 +23,6 @@ import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResour import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { Action } from 'vs/base/common/actions'; import { ISelectionData } from 'azdata'; @@ -94,7 +93,6 @@ export class QueryEditor extends BaseEditor { @IThemeService themeService: IThemeService, @IInstantiationService private _instantiationService: IInstantiationService, @IEditorService private _editorService: IEditorService, - @IContextMenuService private _contextMenuService: IContextMenuService, @IQueryModelService private _queryModelService: IQueryModelService, @IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService, @IContextKeyService contextKeyService: IContextKeyService, @@ -464,7 +462,7 @@ export class QueryEditor extends BaseEditor { private _createTaskbar(parentElement: HTMLElement): void { // Create QueryTaskbar this._taskbarContainer = DOM.append(parentElement, DOM.$('div')); - this._taskbar = new Taskbar(this._taskbarContainer, this._contextMenuService, { + this._taskbar = new Taskbar(this._taskbarContainer, { actionItemProvider: (action: Action) => this._getActionItemForAction(action), }); @@ -753,7 +751,7 @@ export class QueryEditor extends BaseEditor { } private getTaskBarHeight(): number { - let taskBarElement = this.taskbar.getContainer().getHTMLElement(); + let taskBarElement = this.taskbar.getContainer(); return DOM.getContentHeight(taskBarElement); } diff --git a/src/sql/parts/query/execution/queryActions.ts b/src/sql/parts/query/execution/queryActions.ts index a045431c01..b857dab5d6 100644 --- a/src/sql/parts/query/execution/queryActions.ts +++ b/src/sql/parts/query/execution/queryActions.ts @@ -28,6 +28,7 @@ import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox'; import { attachEditableDropdownStyler, attachSelectBoxStyler } from 'sql/platform/theme/common/styler'; import { EventEmitter } from 'sql/base/common/eventEmitter'; import { Dropdown } from 'sql/base/browser/ui/editableDropdown/dropdown'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; /** * Action class that query-based Actions will extend. This base class automatically handles activating and @@ -448,7 +449,8 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem @IConnectionManagementService private _connectionManagementService: IConnectionManagementService, @INotificationService private _notificationService: INotificationService, @IContextViewService contextViewProvider: IContextViewService, - @IConfigurationService private readonly _configurationService: IConfigurationService + @IConfigurationService private readonly _configurationService: IConfigurationService, + @ILayoutService layoutService: ILayoutService ) { super(); this._toDispose = []; @@ -462,7 +464,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem this._databaseSelectBox.disable(); } else { - this._dropdown = new Dropdown(this._databaseListDropdown, contextViewProvider, { + this._dropdown = new Dropdown(this._databaseListDropdown, contextViewProvider, layoutService, { strictSelection: true, placeholder: this._selectDatabaseString, ariaLabel: this._selectDatabaseString, diff --git a/src/sql/platform/angularEventing/node/angularEventingService.ts b/src/sql/platform/angularEventing/node/angularEventingService.ts index 836e103700..b69c442ab6 100644 --- a/src/sql/platform/angularEventing/node/angularEventingService.ts +++ b/src/sql/platform/angularEventing/node/angularEventingService.ts @@ -14,22 +14,21 @@ export class AngularEventingService implements IAngularEventingService { private _angularMap = new Map>(); public onAngularEvent(uri: string, cb: (event: IAngularEvent) => void): Subscription { - let subject: Subject; - if (!this._angularMap.has(uri)) { + let subject = this._angularMap.get(uri); + if (!subject) { subject = new Subject(); this._angularMap.set(uri, subject); - } else { - subject = this._angularMap.get(uri); } let sub = subject.subscribe(cb); return sub; } public sendAngularEvent(uri: string, event: AngularEventType, payload?: any): void { - if (!this._angularMap.has(uri)) { + const subject = this._angularMap.get(uri); + if (!subject) { warn('Got request to send an event to a dashboard that has not started listening'); } else { - this._angularMap.get(uri).next({ event, payload }); + subject.next({ event, payload }); } } } diff --git a/src/sql/workbench/browser/modal/modal.ts b/src/sql/workbench/browser/modal/modal.ts index 34c104ec94..e2d86d6420 100644 --- a/src/sql/workbench/browser/modal/modal.ts +++ b/src/sql/workbench/browser/modal/modal.ts @@ -23,7 +23,7 @@ import { localize } from 'vs/nls'; import { MessageLevel } from 'sql/workbench/api/common/sqlExtHostTypes'; import * as os from 'os'; import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; export const MODAL_SHOWING_KEY = 'modalShowing'; export const MODAL_SHOWING_CONTEXT = new RawContextKey>(MODAL_SHOWING_KEY, []); @@ -152,7 +152,7 @@ export abstract class Modal extends Disposable implements IThemable { private _title: string, private _name: string, private _telemetryService: ITelemetryService, - protected layoutService: IWorkbenchLayoutService, + protected layoutService: ILayoutService, protected _clipboardService: IClipboardService, protected _themeService: IThemeService, _contextKeyService: IContextKeyService, @@ -394,7 +394,7 @@ export abstract class Modal extends Disposable implements IThemable { */ protected show() { this._modalShowingContext.get().push(this._staticKey); - this._builder.appendTo(this.layoutService.getWorkbenchElement()); + this._builder.appendTo(this.layoutService.container); this.setFocusableElements(); diff --git a/src/sql/workbench/services/connection/browser/connectionWidget.ts b/src/sql/workbench/services/connection/browser/connectionWidget.ts index 484840804f..b4e1e810c0 100644 --- a/src/sql/workbench/services/connection/browser/connectionWidget.ts +++ b/src/sql/workbench/services/connection/browser/connectionWidget.ts @@ -36,6 +36,7 @@ import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; import { endsWith, startsWith } from 'vs/base/common/strings'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; export class ConnectionWidget { private _container: HTMLElement; @@ -99,6 +100,7 @@ export class ConnectionWidget { providerName: string, @IThemeService private _themeService: IThemeService, @IContextViewService private _contextViewService: IContextViewService, + @ILayoutService private _layoutService: ILayoutService, @IConnectionManagementService private _connectionManagementService: IConnectionManagementService, @ICapabilitiesService private _capabilitiesService: ICapabilitiesService, @IClipboardService private _clipboardService: IClipboardService, @@ -222,7 +224,7 @@ export class ConnectionWidget { let databaseOption = this._optionsMaps[ConnectionOptionSpecialType.databaseName]; let databaseName = DialogHelper.appendRow(this._tableContainer, databaseOption.displayName, 'connection-label', 'connection-input'); - this._databaseNameInputBox = new Dropdown(databaseName, this._contextViewService, { + this._databaseNameInputBox = new Dropdown(databaseName, this._contextViewService, this._layoutService, { values: [this._defaultDatabaseName, this._loadingDatabaseName], strictSelection: false, placeholder: this._defaultDatabaseName, diff --git a/src/sqltest/parts/query/editor/queryActions.test.ts b/src/sqltest/parts/query/editor/queryActions.test.ts index 9a02e435f0..13078626c2 100644 --- a/src/sqltest/parts/query/editor/queryActions.test.ts +++ b/src/sqltest/parts/query/editor/queryActions.test.ts @@ -31,7 +31,7 @@ import { ConfigurationService } from 'vs/platform/configuration/node/configurati import * as TypeMoq from 'typemoq'; import * as assert from 'assert'; -import { TestStorageService } from 'vs/workbench/test/workbenchTestServices'; +import { TestStorageService, TestLayoutService } from 'vs/workbench/test/workbenchTestServices'; let none: void; @@ -51,7 +51,7 @@ suite('SQL QueryAction Tests', () => { // Setup a reusable mock QueryEditor editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(), undefined, undefined, undefined, undefined, - undefined, undefined, undefined, undefined, new TestStorageService()); + undefined, undefined, undefined, new TestStorageService()); editor.setup(x => x.connectedUri).returns(() => testUri); editor.setup(x => x.currentQueryInput).returns(() => testQueryInput.object); editor.setup(x => x.uri).returns(() => testUri); @@ -88,7 +88,7 @@ suite('SQL QueryAction Tests', () => { // ... Create an editor let editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(), undefined, undefined, undefined, undefined, - undefined, undefined, undefined, undefined, new TestStorageService()); + undefined, undefined, undefined, new TestStorageService()); editor.setup(x => x.currentQueryInput).returns(() => testQueryInput.object); // If I create a QueryTaskbarAction and I pass a non-connected editor to _getConnectedQueryEditorUri @@ -175,7 +175,7 @@ suite('SQL QueryAction Tests', () => { countCalledRunQuery++; }); let queryEditor: TypeMoq.Mock = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(), undefined, - undefined, undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService()); + undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService()); queryEditor.setup(x => x.currentQueryInput).returns(() => queryInput.object); queryEditor.setup(x => x.getSelection()).returns(() => undefined); queryEditor.setup(x => x.getSelection(false)).returns(() => undefined); @@ -242,7 +242,7 @@ suite('SQL QueryAction Tests', () => { // ... Mock "getSelection" in QueryEditor let queryEditor: TypeMoq.Mock = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(), undefined, - undefined, undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService()); + undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService()); queryEditor.setup(x => x.currentQueryInput).returns(() => queryInput.object); queryEditor.setup(x => x.getSelection()).returns(() => { return selectionToReturnInGetSelection; @@ -475,8 +475,10 @@ suite('SQL QueryAction Tests', () => { databaseName: databaseName }); + const layoutService = new TestLayoutService(); + // If I query without having initialized anything, state should be clear - listItem = new ListDatabasesActionItem(editor.object, connectionManagementService.object, undefined, undefined, configurationService.object); + listItem = new ListDatabasesActionItem(editor.object, connectionManagementService.object, undefined, undefined, configurationService.object, layoutService); assert.equal(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected'); assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected'); @@ -510,8 +512,10 @@ suite('SQL QueryAction Tests', () => { cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event); cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => { databaseName: databaseName }); + const layoutService = new TestLayoutService(); + // ... Create a database dropdown that has been connected - let listItem = new ListDatabasesActionItem(editor.object, cms.object, null, null, configurationService.object); + let listItem = new ListDatabasesActionItem(editor.object, cms.object, null, null, configurationService.object, layoutService); listItem.onConnected(); // If: I raise a connection changed event @@ -534,8 +538,10 @@ suite('SQL QueryAction Tests', () => { cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event); cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => { databaseName: databaseName }); + const layoutService = new TestLayoutService(); + // ... Create a database dropdown that has been connected - let listItem = new ListDatabasesActionItem(editor.object, cms.object, null, null, configurationService.object); + let listItem = new ListDatabasesActionItem(editor.object, cms.object, null, null, configurationService.object, layoutService); listItem.onConnected(); // If: I raise a connection changed event for the 'wrong' URI @@ -561,8 +567,10 @@ suite('SQL QueryAction Tests', () => { cms.callBase = true; cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event); + const layoutService = new TestLayoutService(); + // ... Create a database dropdown - let listItem = new ListDatabasesActionItem(editor.object, cms.object, null, null, configurationService.object); + let listItem = new ListDatabasesActionItem(editor.object, cms.object, null, null, configurationService.object, layoutService); // If: I raise a connection changed event let eventParams = { diff --git a/src/sqltest/parts/query/editor/queryEditor.test.ts b/src/sqltest/parts/query/editor/queryEditor.test.ts index 07b21578e8..9ee4ec42da 100644 --- a/src/sqltest/parts/query/editor/queryEditor.test.ts +++ b/src/sqltest/parts/query/editor/queryEditor.test.ts @@ -47,7 +47,6 @@ suite('SQL QueryEditor Tests', () => { instantiationService.object, undefined, undefined, - undefined, editorDescriptorService.object, undefined, undefined, @@ -82,7 +81,7 @@ suite('SQL QueryEditor Tests', () => { instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => { if (classDef.ID) { if (classDef.ID === 'listDatabaseQueryActionItem') { - return new ListDatabasesActionItem(editor, connectionManagementService.object, undefined, undefined, configurationService.object); + return new ListDatabasesActionItem(editor, connectionManagementService.object, undefined, undefined, configurationService.object, undefined); } } // Default @@ -318,7 +317,7 @@ suite('SQL QueryEditor Tests', () => { queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns((definition, editor, action, selectBox) => { if (definition.ID === 'listDatabaseQueryActionItem') { - let item = new ListDatabasesActionItem(editor, queryConnectionService.object, undefined, undefined, configurationService.object); + let item = new ListDatabasesActionItem(editor, queryConnectionService.object, undefined, undefined, configurationService.object, undefined); return item; } // Default diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 7e0f0fa968..f21bb317de 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -15,6 +15,7 @@ "./sql/base/browser/ui/button/*.ts", "./sql/base/browser/ui/checkbox/*.ts", "./sql/base/browser/ui/dropdownList/*.ts", + "./sql/base/browser/ui/editableDropdown/*.ts", "./sql/base/browser/ui/inputBox/*.ts", "./sql/base/browser/ui/listBox/*.ts", "./sql/base/browser/ui/panel/*.ts", @@ -22,6 +23,14 @@ "./sql/base/browser/ui/scrollable/*.ts", "./sql/base/browser/ui/selectBox/*.ts", "./sql/base/browser/ui/table/*.ts", + "./sql/base/browser/ui/taskbar/*.ts", + "./sql/base/common/**/*.ts", + "./sql/base/node/**/*.ts", + "./sql/platform/angularEventing/**/*.ts", + "./sql/platform/clipboard/**/*.ts", + "./sql/platform/credentials/**/*.ts", + "./sql/platform/theme/**/*.ts", + "./sql/platform/telemetry/**/*.ts" ], "exclude": [ "node_modules/**" diff --git a/src/vs/base/parts/tree/browser/treeModel.ts b/src/vs/base/parts/tree/browser/treeModel.ts index 4c6515ab72..95b4513d13 100644 --- a/src/vs/base/parts/tree/browser/treeModel.ts +++ b/src/vs/base/parts/tree/browser/treeModel.ts @@ -9,8 +9,6 @@ import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle'; import { INavigator } from 'vs/base/common/iterator'; import * as _ from './tree'; import { Event, Emitter, EventMultiplexer, Relay } from 'vs/base/common/event'; -// {{SQL CARBON EDIT}} -import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode'; interface IMap { [id: string]: T; } interface IItemMap extends IMap { } @@ -374,14 +372,7 @@ export class Item { return result.then(() => { this._setExpanded(true); this._onDidExpand.fire(eventData); - // {{SQL CARBON EDIT}} - Original code does not handle the need to refresh children in case previous refreshchildren errored out. - if ((this.element instanceof TreeNode) && (this.element.errorStateMessage)) { - this.needsChildrenRefresh = true; - return false; - } // We may need special handling for other types of this.element apart from TreeNode as well. - else { - return true; - } + return true; }); }); diff --git a/src/vs/base/parts/tree/browser/treeView.ts b/src/vs/base/parts/tree/browser/treeView.ts index 196165e2f1..4a8f1f4a4a 100644 --- a/src/vs/base/parts/tree/browser/treeView.ts +++ b/src/vs/base/parts/tree/browser/treeView.ts @@ -1527,7 +1527,7 @@ export class TreeView extends HeightMap { this.onDragEnd(e); } else { // {{SQL CARBON EDIT}} - this.context.dnd.dropAbort(this.context.tree, this.currentDragAndDropData); + this.context.dnd!.dropAbort(this.context.tree, this.currentDragAndDropData!); } this.cancelDragAndDropScrollInterval(); } @@ -1538,7 +1538,7 @@ export class TreeView extends HeightMap { this.currentDropTargets = []; } else { // {{SQL CARBON EDIT}} - this.context.dnd.dropAbort(this.context.tree, this.currentDragAndDropData); + this.context.dnd!.dropAbort(this.context.tree, this.currentDragAndDropData!); } this.currentDropDisposable.dispose(); diff --git a/src/vs/platform/contextkey/common/contextkey.ts b/src/vs/platform/contextkey/common/contextkey.ts index 8b17487155..86a611b78f 100644 --- a/src/vs/platform/contextkey/common/contextkey.ts +++ b/src/vs/platform/contextkey/common/contextkey.ts @@ -622,8 +622,12 @@ export class ContextKeyGreaterThanEqualsExpr implements ContextKeyExpr { } public evaluate(context: IContext): boolean { - let keyInt = parseFloat(context.getValue(this.key)); - let valueInt = parseFloat(this.value); + const keyVal = context.getValue(this.key); + if (!keyVal) { + return false; + } + const keyInt = parseFloat(keyVal); + const valueInt = parseFloat(this.value); return (keyInt >= valueInt); } @@ -677,8 +681,12 @@ export class ContextKeyLessThanEqualsExpr implements ContextKeyExpr { } public evaluate(context: IContext): boolean { - let keyInt = parseFloat(context.getValue(this.key)); - let valueInt = parseFloat(this.value); + const keyVal = context.getValue(this.key); + if (!keyVal) { + return false; + } + const keyInt = parseFloat(keyVal); + const valueInt = parseFloat(this.value); return (keyInt <= valueInt); }