Strict Null Checks, Builder Removal, Formatting (#4849)

* remove builder; more null checks

* null checks

* formatting

* wip

* fix dropdown themeing

* formatting

* formatting

* fix tests

* update what files are checked

* add code to help refresh bad nodes
This commit is contained in:
Anthony Dresser
2019-04-08 13:27:41 -07:00
committed by GitHub
parent 01784dd186
commit 22ec1d5f0a
57 changed files with 177 additions and 206 deletions

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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!sql/media/icons/common-icons';
import 'vs/css!./media/breadcrumb'; import 'vs/css!./media/breadcrumb';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 { Button as vsButton, IButtonOptions, IButtonStyles as vsIButtonStyles } from 'vs/base/browser/ui/button/button';
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { Color } from 'vs/base/common/color'; import { Color } from 'vs/base/common/color';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { import {
Component, Inject, forwardRef, ElementRef, OnInit, Input, Component, Inject, forwardRef, ElementRef, OnInit, Input,
Output, OnChanges, SimpleChanges, EventEmitter Output, OnChanges, SimpleChanges, EventEmitter

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./media/dropdownList'; import 'vs/css!./media/dropdownList';
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { Dropdown, IDropdownOptions } from 'vs/base/browser/ui/dropdown/dropdown'; import { Dropdown, IDropdownOptions } from 'vs/base/browser/ui/dropdown/dropdown';

View File

@@ -10,7 +10,6 @@ import { DropdownDataSource, DropdownFilter, DropdownModel, DropdownRenderer, Dr
import { IContextViewProvider, ContextView } from 'vs/base/browser/ui/contextview/contextview'; import { IContextViewProvider, ContextView } from 'vs/base/browser/ui/contextview/contextview';
import { mixin } from 'vs/base/common/objects'; 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 { InputBox, IInputBoxStyles } from 'sql/base/browser/ui/inputBox/inputBox';
import { IMessage, MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; import { IMessage, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; 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 { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes'; import { KeyCode } from 'vs/base/common/keyCodes';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl'; import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
export interface IDropdownOptions extends IDropdownStyles { export interface IDropdownOptions extends IDropdownStyles {
/** /**
@@ -74,9 +74,9 @@ const defaults: IDropdownOptions = {
}; };
export class Dropdown extends Disposable { export class Dropdown extends Disposable {
private $el: Builder; private _el: HTMLElement;
private $input: Builder; private _inputContainer: HTMLElement;
private $treeContainer: Builder; private _treeContainer: HTMLElement;
private _input: InputBox; private _input: InputBox;
private _tree: Tree; private _tree: Tree;
private _options: IDropdownOptions; private _options: IDropdownOptions;
@@ -101,16 +101,19 @@ export class Dropdown extends Disposable {
constructor( constructor(
container: HTMLElement, container: HTMLElement,
contextViewService: IContextViewProvider, contextViewService: IContextViewProvider,
readonly layoutService: ILayoutService,
opt?: IDropdownOptions opt?: IDropdownOptions
) { ) {
super(); super();
this._contextView = new ContextView(document.body); this._contextView = new ContextView(layoutService.container);
this._options = opt || Object.create(null); this._options = opt || Object.create(null);
mixin(this._options, defaults, false) as IDropdownOptions; 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._inputContainer = DOM.append(this._el, DOM.$('.dropdown-input'));
this.$treeContainer = $('.dropdown-tree'); this._inputContainer.style.width = '100%';
this._treeContainer = DOM.$('.dropdown-tree');
this._toggleAction = new ToggleDropdownAction(() => { this._toggleAction = new ToggleDropdownAction(() => {
this._showList(); this._showList();
@@ -118,7 +121,7 @@ export class Dropdown extends Disposable {
this._tree.focusFirst(); this._tree.focusFirst();
}, this._options.actionLabel); }, this._options.actionLabel);
this._input = new InputBox(this.$input.getHTMLElement(), contextViewService, { this._input = new InputBox(this._inputContainer, contextViewService, {
validationOptions: { validationOptions: {
// @SQLTODO // @SQLTODO
//showMessage: false, //showMessage: false,
@@ -156,7 +159,7 @@ export class Dropdown extends Disposable {
e.stopPropagation(); e.stopPropagation();
break; break;
case KeyCode.Escape: case KeyCode.Escape:
if (this.$treeContainer.getHTMLElement().parentElement) { if (this._treeContainer.parentElement) {
this._input.validate(); this._input.validate();
this._onBlur.fire(); this._onBlur.fire();
this._contextView.hide(); this._contextView.hide();
@@ -170,7 +173,7 @@ export class Dropdown extends Disposable {
e.stopPropagation(); e.stopPropagation();
break; break;
case KeyCode.DownArrow: case KeyCode.DownArrow:
if (!this.$treeContainer.getHTMLElement().parentElement) { if (!this._treeContainer.parentElement) {
this._showList(); this._showList();
} }
this._tree.domFocus(); 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, dataSource: this._dataSource,
filter: this._filter, filter: this._filter,
renderer: this._renderer, renderer: this._renderer,
@@ -214,9 +217,6 @@ export class Dropdown extends Disposable {
}); });
this._register(this._contextView); this._register(this._contextView);
this._register(this.$el);
this._register(this.$input);
this._register(this.$treeContainer);
this._register(this._tree); this._register(this._tree);
this._register(this._input); this._register(this._input);
this._register(this._contextView); this._register(this._contextView);
@@ -227,14 +227,14 @@ export class Dropdown extends Disposable {
this._onFocus.fire(); this._onFocus.fire();
this._filter.filterString = ''; this._filter.filterString = '';
this._contextView.show({ this._contextView.show({
getAnchor: () => this.$input.getHTMLElement(), getAnchor: () => this._inputContainer,
render: container => { render: container => {
this.$treeContainer.appendTo(container); DOM.append(container, this._treeContainer);
this._layoutTree(); this._layoutTree();
return { dispose: () => { } }; return { dispose: () => { } };
}, },
onDOMEvent: (e: any) => { onDOMEvent: e => {
if (!DOM.isAncestor(e.srcElement, this.$el.getHTMLElement()) && !DOM.isAncestor(e.srcElement, this.$treeContainer.getHTMLElement())) { if (!DOM.isAncestor((<HTMLElement>e.srcElement), this._el) && !DOM.isAncestor((<HTMLElement>e.srcElement), this._treeContainer)) {
this._input.validate(); this._input.validate();
this._onBlur.fire(); this._onBlur.fire();
this._contextView.hide(); this._contextView.hide();
@@ -254,8 +254,9 @@ export class Dropdown extends Disposable {
} }
}, 0); }, 0);
let height = filteredLength * this._renderer.getHeight() > this._options.maxHeight! ? this._options.maxHeight! : filteredLength * this._renderer.getHeight(); 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._treeContainer.style.height = height + 'px';
this._tree.layout(parseInt(this.$treeContainer.style('height'))); this._treeContainer.style.width = DOM.getContentWidth(this._inputContainer) - 2 + 'px';
this._tree.layout(parseInt(this._treeContainer.style.height));
this._tree.refresh(); this._tree.refresh();
} }
} }
@@ -265,8 +266,9 @@ export class Dropdown extends Disposable {
this._filter.filterString = ''; this._filter.filterString = '';
this._dataSource.options = vals.map(i => { return { value: i }; }); 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; 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._treeContainer.style.height = height + 'px';
this._tree.layout(parseInt(this.$treeContainer.style('height'))); this._treeContainer.style.width = DOM.getContentWidth(this._inputContainer) - 2 + 'px';
this._tree.layout(parseInt(this._treeContainer.style.height));
this._tree.setInput(new DropdownModel()); this._tree.setInput(new DropdownModel());
this._input.validate(); this._input.validate();
} }
@@ -292,10 +294,8 @@ export class Dropdown extends Disposable {
style(style: IListStyles & IInputBoxStyles & IDropdownStyles) { style(style: IListStyles & IInputBoxStyles & IDropdownStyles) {
this._tree.style(style); this._tree.style(style);
this._input.style(style); this._input.style(style);
if (style.contextBackground) { this._treeContainer.style.backgroundColor = style.contextBackground ? style.contextBackground.toString() : null;
this.$treeContainer.style('background-color', style.contextBackground.toString()); this._treeContainer.style.outline = `1px solid ${style.contextBorder || this._options.contextBorder}`;
}
this.$treeContainer.style('outline', `1px solid ${style.contextBorder || this._options.contextBorder}`);
} }
private _inputValidator(value: string): IMessage | null { private _inputValidator(value: string): IMessage | null {

View File

@@ -9,7 +9,6 @@ import { generateUuid } from 'vs/base/common/uuid';
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { $ } from 'sql/base/browser/builder';
export interface Template { export interface Template {
label: HTMLElement; label: HTMLElement;
@@ -34,9 +33,13 @@ export class DropdownRenderer implements tree.IRenderer {
} }
public renderTemplate(tree: tree.ITree, templateId: string, container: HTMLElement): Template { 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); 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); DOM.append(row, label);
return { label, row }; return { label, row };

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { import {
Component, Inject, forwardRef, ElementRef, OnInit, Input, Component, Inject, forwardRef, ElementRef, OnInit, Input,
Output, OnChanges, SimpleChanges, EventEmitter Output, OnChanges, SimpleChanges, EventEmitter
@@ -12,10 +10,11 @@ import {
import { Dropdown, IDropdownOptions } from 'sql/base/browser/ui/editableDropdown/dropdown'; import { Dropdown, IDropdownOptions } from 'sql/base/browser/ui/editableDropdown/dropdown';
import { AngularDisposable } from 'sql/base/node/lifecycle'; import { AngularDisposable } from 'sql/base/node/lifecycle';
import { attachEditableDropdownStyler } from 'sql/platform/theme/common/styler';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; 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 { IThemeService } from 'vs/platform/theme/common/themeService';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
@Component({ @Component({
selector: 'editable-select-box', selector: 'editable-select-box',
@@ -35,7 +34,8 @@ export class EditableDropDown extends AngularDisposable implements OnInit, OnCha
constructor( constructor(
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(IThemeService) private themeService: IThemeService, @Inject(IThemeService) private themeService: IThemeService,
@Inject(IContextViewService) private contextViewService: IContextViewService @Inject(IContextViewService) private contextViewService: IContextViewService,
@Inject(ILayoutService) private layoutService: ILayoutService
) { ) {
super(); super();
} }
@@ -49,7 +49,7 @@ export class EditableDropDown extends AngularDisposable implements OnInit, OnCha
ariaLabel: '', ariaLabel: '',
actionLabel: '' 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.values = this.options;
this._selectbox.value = this.selectedOption; this._selectbox.value = this.selectedOption;

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { import {
Component, Inject, forwardRef, ElementRef, OnInit, Input, Component, Inject, forwardRef, ElementRef, OnInit, Input,
Output, OnChanges, SimpleChanges, EventEmitter Output, OnChanges, SimpleChanges, EventEmitter

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 { 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 { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { Color } from 'vs/base/common/color'; import { Color } from 'vs/base/common/color';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 { SelectBox, ISelectBoxStyles, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color'; import { Color } from 'vs/base/common/color';
import { IMessage, MessageType, defaultOpts } from 'vs/base/browser/ui/inputbox/inputBox'; import { IMessage, MessageType, defaultOpts } from 'vs/base/browser/ui/inputbox/inputBox';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/panel'; import 'vs/css!./media/panel';
import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 { Component, Input, ContentChild, OnDestroy, TemplateRef, ChangeDetectorRef, forwardRef, Inject } from '@angular/core';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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!sql/media/icons/common-icons';
import 'vs/css!./tabHeader'; import 'vs/css!./tabHeader';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./scrollableSplitview'; import 'vs/css!./scrollableSplitview';
import { HeightMap, IView as HeightIView, IViewItem as HeightIViewItem } from './heightMap'; import { HeightMap, IView as HeightIView, IViewItem as HeightIViewItem } from './heightMap';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { import {
Component, Inject, forwardRef, ElementRef, OnInit, Input, Component, Inject, forwardRef, ElementRef, OnInit, Input,
Output, OnChanges, SimpleChanges, EventEmitter Output, OnChanges, SimpleChanges, EventEmitter

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./media/selectBox'; import 'vs/css!./media/selectBox';
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox'; import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';

View File

@@ -3,11 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; 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 * Implements the various additional navigation keybindings we want out of slickgrid

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Emitter, Event } from 'vs/base/common/event'; import { Emitter, Event } from 'vs/base/common/event';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 DOM from 'vs/base/browser/dom';
import * as Platform from 'vs/base/common/platform'; import * as Platform from 'vs/base/common/platform';
import { StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent'; import { StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
export interface IRowNumberColumnOptions { export interface IRowNumberColumnOptions {
numberOfRows: number; numberOfRows: number;
cssClass?: string; cssClass?: string;

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer'; import { Observer } from 'rxjs/Observer';

View File

@@ -5,7 +5,6 @@
import 'vs/css!vs/base/browser/ui/actionbar/actionbar'; 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 { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
@@ -35,21 +34,22 @@ export class ActionBar extends ActionRunner implements IActionRunner {
// Items // Items
private _items: IActionItem[]; private _items: IActionItem[];
private _focusedItem: number; private _focusedItem?: number;
private _focusTracker: DOM.IFocusTracker; private _focusTracker: DOM.IFocusTracker;
// Elements // Elements
private _domNode: HTMLElement; private _domNode: HTMLElement;
private _actionsList: HTMLElement; private _actionsList: HTMLElement;
constructor(container: HTMLElement | Builder, options: IActionBarOptions = defaultOptions) { constructor(container: HTMLElement, options: IActionBarOptions = defaultOptions) {
super(); super();
this._options = options; this._options = options;
this._context = options.context; this._context = options.context;
this._toDispose = []; 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._actionRunner = new ActionRunner();
this._toDispose.push(this._actionRunner); this._toDispose.push(this._actionRunner);
} }
@@ -71,7 +71,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
this._domNode.className += ' vertical'; 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 event = new StandardKeyboardEvent(e);
let eventHandled = true; let eventHandled = true;
@@ -91,15 +91,15 @@ export class ActionBar extends ActionRunner implements IActionRunner {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
} }
}); }));
// Prevent native context menu on actions // 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.preventDefault();
e.stopPropagation(); 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); let event = new StandardKeyboardEvent(e);
// Run action on Enter/Space // 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)) { else if (event.equals(KeyCode.Tab) || event.equals(KeyMod.Shift | KeyCode.Tab)) {
this.updateFocusedItem(); this.updateFocusedItem();
} }
}); }));
this._focusTracker = DOM.trackFocus(this._domNode); this._focusTracker = this._register(DOM.trackFocus(this._domNode));
this._focusTracker.onDidBlur(() => { this._focusTracker.onDidBlur(() => {
if (document.activeElement === this._domNode || !DOM.isAncestor(document.activeElement, this._domNode)) { 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); this._domNode.appendChild(this._actionsList);
((container instanceof Builder) ? container.getHTMLElement() : container).appendChild(this._domNode); container.appendChild(this._domNode);
} }
public setAriaLabel(label: string): void { public setAriaLabel(label: string): void {
@@ -183,8 +183,8 @@ export class ActionBar extends ActionRunner implements IActionRunner {
} }
} }
public getContainer(): Builder { public getContainer(): HTMLElement {
return $(this._domNode); return this._domNode;
} }
/** /**
@@ -216,7 +216,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
actionItemElement.className = 'action-item'; actionItemElement.className = 'action-item';
actionItemElement.setAttribute('role', 'presentation'); actionItemElement.setAttribute('role', 'presentation');
let item: IActionItem = null; let item: IActionItem | undefined = undefined;
if (this._options.actionItemProvider) { if (this._options.actionItemProvider) {
item = this._options.actionItemProvider(action); item = this._options.actionItemProvider(action);
@@ -251,7 +251,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
public clear(): void { public clear(): void {
// Do not dispose action items if they were provided from outside // Do not dispose action items if they were provided from outside
this._items = this._options.actionItemProvider ? [] : lifecycle.dispose(this._items); this._items = this._options.actionItemProvider ? [] : lifecycle.dispose(this._items);
$(this._actionsList).empty(); DOM.clearNode(this._actionsList);
} }
public length(): number { public length(): number {
@@ -364,19 +364,12 @@ export class ActionBar extends ActionRunner implements IActionRunner {
} }
public dispose(): void { public dispose(): void {
if (this._items !== null) { lifecycle.dispose(this._items);
lifecycle.dispose(this._items); this._items = [];
}
this._items = null;
if (this._focusTracker) {
this._focusTracker.dispose();
this._focusTracker = null;
}
this._toDispose = lifecycle.dispose(this._toDispose); this._toDispose = lifecycle.dispose(this._toDispose);
this.getContainer().destroy(); this._domNode.remove();
super.dispose(); super.dispose();
} }

View File

@@ -3,18 +3,14 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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/taskbar';
import 'vs/css!./media/icons'; import 'vs/css!./media/icons';
import 'vs/css!sql/media/icons/common-icons'; import 'vs/css!sql/media/icons/common-icons';
import { ActionBar } from './actionbar'; import { ActionBar } from './actionbar';
import { Builder, $ } from 'sql/base/browser/builder';
import { Action, IActionRunner, IAction } from 'vs/base/common/actions'; import { Action, IActionRunner, IAction } from 'vs/base/common/actions';
import { ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; 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'; import { IToolBarOptions } from 'vs/base/browser/ui/toolbar/toolbar';
/** /**
@@ -37,21 +33,19 @@ export interface ITaskbarContent {
export class Taskbar { export class Taskbar {
private options: IToolBarOptions; private options: IToolBarOptions;
private actionBar: ActionBar; 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.options = options;
this.lookupKeybindings = typeof this.options.getKeyBinding === 'function' && typeof this.options.getKeyBinding === 'function';
let element = document.createElement('div'); let element = document.createElement('div');
element.className = 'monaco-toolbar carbon-taskbar'; element.className = 'monaco-toolbar carbon-taskbar';
container.appendChild(element); container.appendChild(element);
this.actionBar = new ActionBar($(element), { this.actionBar = new ActionBar(element, {
orientation: options.orientation, orientation: options.orientation,
ariaLabel: options.ariaLabel, ariaLabel: options.ariaLabel,
actionItemProvider: (action: Action) => { 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; this.actionBar.context = context;
} }
public getContainer(): Builder { public getContainer(): HTMLElement {
return this.actionBar.getContainer(); return this.actionBar.getContainer();
} }
@@ -131,8 +125,9 @@ export class Taskbar {
} }
private getKeybindingLabel(action: IAction): string { private getKeybindingLabel(action: IAction): string {
const key = this.lookupKeybindings ? this.options.getKeyBinding(action) : void 0; const key = this.options.getKeyBinding ? this.options.getKeyBinding(action) : undefined;
return key ? key.getLabel() : ''; const label = key ? key.getLabel() : undefined;
return label || '';
} }
public addAction(primaryAction: IAction): void { public addAction(primaryAction: IAction): void {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 * Alterable version of the vs memorize function; to unmemoize use unmemoize
*/ */

View File

@@ -2,9 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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'; import { IDisposable } from 'vs/base/common/lifecycle';
export class EmitterEvent { export class EmitterEvent {
@@ -288,7 +287,7 @@ function safeInvokeNoArg<T>(func: Function): T | undefined {
try { try {
return func(); return func();
} catch (e) { } catch (e) {
Errors.onUnexpectedError(e); errors.onUnexpectedError(e);
} }
return undefined; return undefined;
} }
@@ -297,6 +296,6 @@ function safeInvoke1Arg(func: Function, arg1: any): any {
try { try {
return func(arg1); return func(arg1);
} catch (e) { } catch (e) {
Errors.onUnexpectedError(e); errors.onUnexpectedError(e);
} }
} }

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
export function log(...args: any[]): void { export function log(...args: any[]): void {
console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args); console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
} }

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
export function toObject<V>(map: Map<string, V>): { [key: string]: V } { export function toObject<V>(map: Map<string, V>): { [key: string]: V } {
if (map) { if (map) {
let rt: { [key: string]: V } = Object.create(null); let rt: { [key: string]: V } = Object.create(null);

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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'; import * as Types from 'vs/base/common/types';
export function clone<T>(obj: T): T { export function clone<T>(obj: T): T {

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
/** /**
* Deferred promise * Deferred promise

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * 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 * Converts HTML characters inside the string to use entities instead. Makes the string safe from

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { OnDestroy } from '@angular/core'; import { OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';
import { IDisposable } from 'vs/base/common/lifecycle'; import { IDisposable } from 'vs/base/common/lifecycle';

View File

@@ -42,6 +42,7 @@ import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
import { IFileBrowserDialogController } from 'sql/workbench/services/fileBrowser/common/fileBrowserDialogController'; import { IFileBrowserDialogController } from 'sql/workbench/services/fileBrowser/common/fileBrowserDialogController';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
interface FileListElement { interface FileListElement {
logicalFileName: string; logicalFileName: string;
@@ -128,13 +129,13 @@ export class RestoreDialog extends Modal {
constructor( constructor(
optionsMetadata: azdata.ServiceOption[], optionsMetadata: azdata.ServiceOption[],
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, @IWorkbenchLayoutService layoutService: ILayoutService,
@IThemeService themeService: IThemeService, @IThemeService themeService: IThemeService,
@IContextViewService private _contextViewService: IContextViewService, @IContextViewService private _contextViewService: IContextViewService,
@ITelemetryService telemetryService: ITelemetryService, @ITelemetryService telemetryService: ITelemetryService,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@IFileBrowserDialogController private fileBrowserDialogService: IFileBrowserDialogController, @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 }); 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'); this._restoreTitle = localize('restoreDialog.restoreTitle', 'Restore database');
@@ -233,7 +234,7 @@ export class RestoreDialog extends Modal {
inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => { inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => {
// Get the bootstrap params and perform the bootstrap // Get the bootstrap params and perform the bootstrap
inputCellContainer.style('width', '100%'); inputCellContainer.style('width', '100%');
this._databaseDropdown = new Dropdown(inputCellContainer.getHTMLElement(), this._contextViewService, this._databaseDropdown = new Dropdown(inputCellContainer.getHTMLElement(), this._contextViewService, this.layoutService,
{ {
strictSelection: false, strictSelection: false,
ariaLabel: LocalizedStrings.TARGETDATABASE, ariaLabel: LocalizedStrings.TARGETDATABASE,

View File

@@ -21,7 +21,6 @@ import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import * as queryContext from 'sql/parts/query/common/queryContext'; import * as queryContext from 'sql/parts/query/common/queryContext';
import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar'; 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 { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { IQueryModelService } from 'sql/platform/query/common/queryModel'; import { IQueryModelService } from 'sql/platform/query/common/queryModel';
@@ -80,7 +79,6 @@ export class EditDataEditor extends BaseEditor {
@IThemeService themeService: IThemeService, @IThemeService themeService: IThemeService,
@IInstantiationService private _instantiationService: IInstantiationService, @IInstantiationService private _instantiationService: IInstantiationService,
@IEditorService private _editorService: IEditorService, @IEditorService private _editorService: IEditorService,
@IContextMenuService private _contextMenuService: IContextMenuService,
@IQueryModelService private _queryModelService: IQueryModelService, @IQueryModelService private _queryModelService: IQueryModelService,
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService, @IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@@ -319,7 +317,7 @@ export class EditDataEditor extends BaseEditor {
private _createTaskbar(parentElement: HTMLElement): void { private _createTaskbar(parentElement: HTMLElement): void {
// Create QueryTaskbar // Create QueryTaskbar
this._taskbarContainer = DOM.append(parentElement, DOM.$('div')); 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) actionItemProvider: (action: Action) => this._getChangeMaxRowsAction(action)
}); });
@@ -488,7 +486,7 @@ export class EditDataEditor extends BaseEditor {
} }
private _getTaskBarHeight(): number { private _getTaskBarHeight(): number {
let taskBarElement = this._taskbar.getContainer().getHTMLElement(); let taskBarElement = this._taskbar.getContainer();
return DOM.getContentHeight(taskBarElement); return DOM.getContentHeight(taskBarElement);
} }

View File

@@ -71,13 +71,12 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
private static readonly HEADING_HEIGHT: number = 24; private static readonly HEADING_HEIGHT: number = 24;
constructor( constructor(
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
@Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface,
@Inject(forwardRef(() => AgentViewComponent)) _agentViewComponent: AgentViewComponent, @Inject(forwardRef(() => AgentViewComponent)) _agentViewComponent: AgentViewComponent,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IInstantiationService) private instantiationService: IInstantiationService, @Inject(IInstantiationService) private instantiationService: IInstantiationService,
@Inject(IContextMenuService) private contextMenuService: IContextMenuService, @Inject(IContextMenuService) contextMenuService: IContextMenuService,
@Inject(IJobManagementService) private _jobManagementService: IJobManagementService, @Inject(IJobManagementService) private _jobManagementService: IJobManagementService,
@Inject(IKeybindingService) keybindingService: IKeybindingService, @Inject(IKeybindingService) keybindingService: IKeybindingService,
@Inject(IDashboardService) dashboardService: IDashboardService, @Inject(IDashboardService) dashboardService: IDashboardService,
@@ -191,7 +190,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
let cachedHistory = self._jobCacheObject.getJobHistory(element.jobID); let cachedHistory = self._jobCacheObject.getJobHistory(element.jobID);
if (cachedHistory) { if (cachedHistory) {
self.agentJobHistoryInfo = cachedHistory.find( self.agentJobHistoryInfo = cachedHistory.find(
history => self.formatTime(history.runDate) === self.formatTime(element.runDate)); history => self.formatTime(history.runDate) === self.formatTime(element.runDate));
} else { } else {
self.agentJobHistoryInfo = self._treeController.jobHistories.find( self.agentJobHistoryInfo = self._treeController.jobHistories.find(
history => self.formatTime(history.runDate) === self.formatTime(element.runDate)); 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 editJobAction = this.instantiationService.createInstance(EditJobAction);
let refreshAction = this.instantiationService.createInstance(JobsRefreshAction); let refreshAction = this.instantiationService.createInstance(JobsRefreshAction);
let taskbar = <HTMLElement>this.actionBarContainer.nativeElement; let taskbar = <HTMLElement>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.context = { targetObject: this._agentJobInfo, ownerUri: this.ownerUri, component: this };
this._actionBar.setContent([ this._actionBar.setContent([
{ action: runJobAction }, { action: runJobAction },

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata'; 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 { Table } from 'sql/base/browser/ui/table/table';
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; 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 { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Taskbar } from '../../../base/browser/ui/taskbar/taskbar'; 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 { TabChild } from 'sql/base/browser/ui/panel/tab.component';
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService'; 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 refreshAction = this._instantiationService.createInstance(JobsRefreshAction);
let newAction: Action = this._instantiationService.createInstance(this.contextAction); let newAction: Action = this._instantiationService.createInstance(this.contextAction);
let taskbar = <HTMLElement>this.actionBarContainer.nativeElement; let taskbar = <HTMLElement>this.actionBarContainer.nativeElement;
this._actionBar = new Taskbar(taskbar, this._contextMenuService); this._actionBar = new Taskbar(taskbar);
this._actionBar.setContent([ this._actionBar.setContent([
{ action: refreshAction }, { action: refreshAction },
{ action: newAction } { action: newAction }

View File

@@ -2,25 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import 'vs/css!./declarativeTable'; import 'vs/css!./declarativeTable';
import { import {
Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver, Component, Input, Inject, ChangeDetectorRef, forwardRef, ViewChild, ElementRef, OnDestroy, AfterViewInit
ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, QueryList, AfterViewInit
} from '@angular/core'; } from '@angular/core';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { ComponentBase } from 'sql/parts/modelComponents/componentBase'; import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces'; 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 { 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 { export enum DeclarativeDataType {
string = 'string', string = 'string',
@@ -37,7 +30,7 @@ export enum DeclarativeDataType {
<ng-container *ngFor="let column of columns;let h = index"> <ng-container *ngFor="let column of columns;let h = index">
<th class="declarative-table-header" tabindex="-1" role="button" aria-sort="none">{{column.displayName}}</th> <th class="declarative-table-header" tabindex="-1" role="button" aria-sort="none">{{column.displayName}}</th>
</ng-container> </ng-container>
</thead> </thead>
<ng-container *ngIf="data"> <ng-container *ngIf="data">
<ng-container *ngFor="let row of data;let r = index"> <ng-container *ngFor="let row of data;let r = index">
<tr class="declarative-table-row" > <tr class="declarative-table-row" >
@@ -63,8 +56,6 @@ export default class DeclarativeTableComponent extends ComponentBase implements
@ViewChild('container', { read: ElementRef }) private _tableContainer: ElementRef; @ViewChild('container', { read: ElementRef }) private _tableContainer: ElementRef;
constructor( constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, @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
) { ) {
super(changeRef, el); super(changeRef, el);

View File

@@ -19,6 +19,7 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
@Component({ @Component({
selector: 'modelview-dropdown', selector: 'modelview-dropdown',
@@ -42,7 +43,8 @@ export default class DropDownComponent extends ComponentBase implements ICompone
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IContextViewService) private contextViewService: IContextViewService, @Inject(IContextViewService) private contextViewService: IContextViewService,
@Inject(forwardRef(() => ElementRef)) el: ElementRef @Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(ILayoutService) private readonly layoutService: ILayoutService
) { ) {
super(changeRef, el); super(changeRef, el);
} }
@@ -61,7 +63,7 @@ export default class DropDownComponent extends ComponentBase implements ICompone
ariaLabel: '', ariaLabel: '',
actionLabel: '' actionLabel: ''
}; };
this._editableDropdown = new Dropdown(this._editableDropDownContainer.nativeElement, this.contextViewService, this._editableDropdown = new Dropdown(this._editableDropDownContainer.nativeElement, this.contextViewService, this.layoutService,
dropdownOptions); dropdownOptions);
this._register(this._editableDropdown); this._register(this._editableDropdown);

View File

@@ -25,7 +25,6 @@ import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorIn
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { IModeService } from 'vs/editor/common/services/modeService'; import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService'; 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 { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { CellTypes } from 'sql/parts/notebook/models/contracts'; 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) { @Input() public set cellModel(value: ICellModel) {
this._cellModel = value; this._cellModel = value;
if (this.toolbarElement && value && value.cellType === CellTypes.Markdown) { if (this.toolbarElement && value && value.cellType === CellTypes.Markdown) {
let nativeToolbar = <HTMLElement> this.toolbarElement.nativeElement; let nativeToolbar = <HTMLElement>this.toolbarElement.nativeElement;
DOM.addClass(nativeToolbar, MARKDOWN_CLASS); DOM.addClass(nativeToolbar, MARKDOWN_CLASS);
} }
} }
@@ -102,13 +101,12 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
@Inject(IInstantiationService) private _instantiationService: IInstantiationService, @Inject(IInstantiationService) private _instantiationService: IInstantiationService,
@Inject(IModelService) private _modelService: IModelService, @Inject(IModelService) private _modelService: IModelService,
@Inject(IModeService) private _modeService: IModeService, @Inject(IModeService) private _modeService: IModeService,
@Inject(IContextMenuService) private contextMenuService: IContextMenuService,
@Inject(IConfigurationService) private _configurationService: IConfigurationService @Inject(IConfigurationService) private _configurationService: IConfigurationService
) { ) {
super(); super();
this._cellToggleMoreActions = this._instantiationService.createInstance(CellToggleMoreActions); this._cellToggleMoreActions = this._instantiationService.createInstance(CellToggleMoreActions);
this._register(Event.debounce(this._layoutEmitter.event, (l, e) => e, 250, /*leading=*/false) 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 // Handle disconnect on removal of the cell, if it was the active cell
this._register({ dispose: () => this.updateConnectionState(false) }); 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 runCellAction = this._instantiationService.createInstance(RunCellAction, context);
let taskbar = <HTMLElement>this.toolbarElement.nativeElement; let taskbar = <HTMLElement>this.toolbarElement.nativeElement;
this._actionBar = new Taskbar(taskbar, this.contextMenuService); this._actionBar = new Taskbar(taskbar);
this._actionBar.context = context; this._actionBar.context = context;
this._actionBar.setContent([ this._actionBar.setContent([
{ action: runCellAction } { action: runCellAction }

View File

@@ -20,7 +20,6 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { fillInActions, LabeledMenuItemActionItem } from 'vs/platform/actions/browser/menuItemActionItem'; import { fillInActions, LabeledMenuItemActionItem } from 'vs/platform/actions/browser/menuItemActionItem';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; 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 { AngularDisposable } from 'sql/base/node/lifecycle';
import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts'; import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts';
import { ICellModel, IModelFactory, INotebookModel, NotebookContentChange } from 'sql/parts/notebook/models/modelInterfaces'; import { ICellModel, IModelFactory, INotebookModel, NotebookContentChange } from 'sql/parts/notebook/models/modelInterfaces';
@@ -69,7 +68,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
constructor( constructor(
@Inject(forwardRef(() => CommonServiceInterface)) private _bootstrapService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IConnectionManagementService) private connectionManagementService: IConnectionManagementService, @Inject(IConnectionManagementService) private connectionManagementService: IConnectionManagementService,
@@ -163,8 +161,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
} }
//Saves scrollTop value on scroll change //Saves scrollTop value on scroll change
public scrollHandler(event: Event){ public scrollHandler(event: Event) {
this._scrollTop = (<any>event.srcElement).scrollTop; this._scrollTop = (<HTMLElement>event.srcElement).scrollTop;
} }
public unselectActiveCell() { public unselectActiveCell() {
@@ -380,7 +378,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
this._trustedAction.enabled = false; this._trustedAction.enabled = false;
let taskbar = <HTMLElement>this.toolbar.nativeElement; let taskbar = <HTMLElement>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.context = this;
this._actionBar.setContent([ this._actionBar.setContent([
{ element: kernelContainer }, { element: kernelContainer },

View File

@@ -80,6 +80,10 @@ export class ServerTreeDataSource implements IDataSource {
node.setExpandedState(TreeItemCollapsibleState.Collapsed); node.setExpandedState(TreeItemCollapsibleState.Collapsed);
node.errorStateMessage = expandError; node.errorStateMessage = expandError;
this.showError(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([]); resolve([]);
}); });
} }

View File

@@ -17,7 +17,7 @@ import { CONTEXT_PROFILER_EDITOR, PROFILER_TABLE_COMMAND_SEARCH } from './interf
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox'; import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
import { textFormatter, slickGridDataItemColumnValueExtractor } from 'sql/parts/grid/services/sharedServices'; import { textFormatter, slickGridDataItemColumnValueExtractor } from 'sql/parts/grid/services/sharedServices';
import { ProfilerResourceEditor } from './profilerResourceEditor'; 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 { ITextModel } from 'vs/editor/common/model';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput'; import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
@@ -151,7 +151,6 @@ export class ProfilerEditor extends BaseEditor {
@ITelemetryService telemetryService: ITelemetryService, @ITelemetryService telemetryService: ITelemetryService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService, @IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IInstantiationService private _instantiationService: IInstantiationService, @IInstantiationService private _instantiationService: IInstantiationService,
@IContextMenuService private _contextMenuService: IContextMenuService,
@IModelService private _modelService: IModelService, @IModelService private _modelService: IModelService,
@IProfilerService private _profilerService: IProfilerService, @IProfilerService private _profilerService: IProfilerService,
@IContextKeyService private _contextKeyService: IContextKeyService, @IContextKeyService private _contextKeyService: IContextKeyService,
@@ -207,7 +206,7 @@ export class ProfilerEditor extends BaseEditor {
this._header = document.createElement('div'); this._header = document.createElement('div');
this._header.className = 'profiler-header'; this._header.className = 'profiler-header';
this._container.appendChild(this._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 = this._instantiationService.createInstance(Actions.ProfilerStart, Actions.ProfilerStart.ID, Actions.ProfilerStart.LABEL);
this._startAction.enabled = false; this._startAction.enabled = false;
this._createAction = this._instantiationService.createInstance(Actions.ProfilerCreate, Actions.ProfilerCreate.ID, Actions.ProfilerCreate.LABEL); this._createAction = this._instantiationService.createInstance(Actions.ProfilerCreate, Actions.ProfilerCreate.ID, Actions.ProfilerCreate.LABEL);

View File

@@ -21,7 +21,7 @@ import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/int
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom'; import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; 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 { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { Builder } from 'sql/base/browser/builder'; import { Builder } from 'sql/base/browser/builder';
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
@@ -84,11 +84,10 @@ export class ChartView extends Disposable implements IPanelView {
@IContextViewService private _contextViewService: IContextViewService, @IContextViewService private _contextViewService: IContextViewService,
@IThemeService private _themeService: IThemeService, @IThemeService private _themeService: IThemeService,
@IInstantiationService private _instantiationService: IInstantiationService, @IInstantiationService private _instantiationService: IInstantiationService,
@IContextMenuService contextMenuService: IContextMenuService
) { ) {
super(); super();
this.taskbarContainer = $('div.taskbar-container'); this.taskbarContainer = $('div.taskbar-container');
this.taskbar = new Taskbar(this.taskbarContainer, contextMenuService); this.taskbar = new Taskbar(this.taskbarContainer);
this.optionsControl = $('div.options-container'); this.optionsControl = $('div.options-container');
let generalControls = $('div.general-controls'); let generalControls = $('div.general-controls');
this.optionsControl.appendChild(generalControls); this.optionsControl.appendChild(generalControls);

View File

@@ -23,7 +23,6 @@ import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResour
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; 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 { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { ISelectionData } from 'azdata'; import { ISelectionData } from 'azdata';
@@ -94,7 +93,6 @@ export class QueryEditor extends BaseEditor {
@IThemeService themeService: IThemeService, @IThemeService themeService: IThemeService,
@IInstantiationService private _instantiationService: IInstantiationService, @IInstantiationService private _instantiationService: IInstantiationService,
@IEditorService private _editorService: IEditorService, @IEditorService private _editorService: IEditorService,
@IContextMenuService private _contextMenuService: IContextMenuService,
@IQueryModelService private _queryModelService: IQueryModelService, @IQueryModelService private _queryModelService: IQueryModelService,
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService, @IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@@ -464,7 +462,7 @@ export class QueryEditor extends BaseEditor {
private _createTaskbar(parentElement: HTMLElement): void { private _createTaskbar(parentElement: HTMLElement): void {
// Create QueryTaskbar // Create QueryTaskbar
this._taskbarContainer = DOM.append(parentElement, DOM.$('div')); 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), actionItemProvider: (action: Action) => this._getActionItemForAction(action),
}); });
@@ -753,7 +751,7 @@ export class QueryEditor extends BaseEditor {
} }
private getTaskBarHeight(): number { private getTaskBarHeight(): number {
let taskBarElement = this.taskbar.getContainer().getHTMLElement(); let taskBarElement = this.taskbar.getContainer();
return DOM.getContentHeight(taskBarElement); return DOM.getContentHeight(taskBarElement);
} }

View File

@@ -28,6 +28,7 @@ import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
import { attachEditableDropdownStyler, attachSelectBoxStyler } from 'sql/platform/theme/common/styler'; import { attachEditableDropdownStyler, attachSelectBoxStyler } from 'sql/platform/theme/common/styler';
import { EventEmitter } from 'sql/base/common/eventEmitter'; import { EventEmitter } from 'sql/base/common/eventEmitter';
import { Dropdown } from 'sql/base/browser/ui/editableDropdown/dropdown'; 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 * 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, @IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@INotificationService private _notificationService: INotificationService, @INotificationService private _notificationService: INotificationService,
@IContextViewService contextViewProvider: IContextViewService, @IContextViewService contextViewProvider: IContextViewService,
@IConfigurationService private readonly _configurationService: IConfigurationService @IConfigurationService private readonly _configurationService: IConfigurationService,
@ILayoutService layoutService: ILayoutService
) { ) {
super(); super();
this._toDispose = []; this._toDispose = [];
@@ -462,7 +464,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
this._databaseSelectBox.disable(); this._databaseSelectBox.disable();
} else { } else {
this._dropdown = new Dropdown(this._databaseListDropdown, contextViewProvider, { this._dropdown = new Dropdown(this._databaseListDropdown, contextViewProvider, layoutService, {
strictSelection: true, strictSelection: true,
placeholder: this._selectDatabaseString, placeholder: this._selectDatabaseString,
ariaLabel: this._selectDatabaseString, ariaLabel: this._selectDatabaseString,

View File

@@ -14,22 +14,21 @@ export class AngularEventingService implements IAngularEventingService {
private _angularMap = new Map<string, Subject<IAngularEvent>>(); private _angularMap = new Map<string, Subject<IAngularEvent>>();
public onAngularEvent(uri: string, cb: (event: IAngularEvent) => void): Subscription { public onAngularEvent(uri: string, cb: (event: IAngularEvent) => void): Subscription {
let subject: Subject<IAngularEvent>; let subject = this._angularMap.get(uri);
if (!this._angularMap.has(uri)) { if (!subject) {
subject = new Subject<IAngularEvent>(); subject = new Subject<IAngularEvent>();
this._angularMap.set(uri, subject); this._angularMap.set(uri, subject);
} else {
subject = this._angularMap.get(uri);
} }
let sub = subject.subscribe(cb); let sub = subject.subscribe(cb);
return sub; return sub;
} }
public sendAngularEvent(uri: string, event: AngularEventType, payload?: any): void { 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'); warn('Got request to send an event to a dashboard that has not started listening');
} else { } else {
this._angularMap.get(uri).next({ event, payload }); subject.next({ event, payload });
} }
} }
} }

View File

@@ -23,7 +23,7 @@ import { localize } from 'vs/nls';
import { MessageLevel } from 'sql/workbench/api/common/sqlExtHostTypes'; import { MessageLevel } from 'sql/workbench/api/common/sqlExtHostTypes';
import * as os from 'os'; import * as os from 'os';
import { IThemeService } from 'vs/platform/theme/common/themeService'; 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_KEY = 'modalShowing';
export const MODAL_SHOWING_CONTEXT = new RawContextKey<Array<string>>(MODAL_SHOWING_KEY, []); export const MODAL_SHOWING_CONTEXT = new RawContextKey<Array<string>>(MODAL_SHOWING_KEY, []);
@@ -152,7 +152,7 @@ export abstract class Modal extends Disposable implements IThemable {
private _title: string, private _title: string,
private _name: string, private _name: string,
private _telemetryService: ITelemetryService, private _telemetryService: ITelemetryService,
protected layoutService: IWorkbenchLayoutService, protected layoutService: ILayoutService,
protected _clipboardService: IClipboardService, protected _clipboardService: IClipboardService,
protected _themeService: IThemeService, protected _themeService: IThemeService,
_contextKeyService: IContextKeyService, _contextKeyService: IContextKeyService,
@@ -394,7 +394,7 @@ export abstract class Modal extends Disposable implements IThemable {
*/ */
protected show() { protected show() {
this._modalShowingContext.get().push(this._staticKey); this._modalShowingContext.get().push(this._staticKey);
this._builder.appendTo(this.layoutService.getWorkbenchElement()); this._builder.appendTo(this.layoutService.container);
this.setFocusableElements(); this.setFocusableElements();

View File

@@ -36,6 +36,7 @@ import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { endsWith, startsWith } from 'vs/base/common/strings'; import { endsWith, startsWith } from 'vs/base/common/strings';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
export class ConnectionWidget { export class ConnectionWidget {
private _container: HTMLElement; private _container: HTMLElement;
@@ -99,6 +100,7 @@ export class ConnectionWidget {
providerName: string, providerName: string,
@IThemeService private _themeService: IThemeService, @IThemeService private _themeService: IThemeService,
@IContextViewService private _contextViewService: IContextViewService, @IContextViewService private _contextViewService: IContextViewService,
@ILayoutService private _layoutService: ILayoutService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService, @IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService, @ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
@IClipboardService private _clipboardService: IClipboardService, @IClipboardService private _clipboardService: IClipboardService,
@@ -222,7 +224,7 @@ export class ConnectionWidget {
let databaseOption = this._optionsMaps[ConnectionOptionSpecialType.databaseName]; let databaseOption = this._optionsMaps[ConnectionOptionSpecialType.databaseName];
let databaseName = DialogHelper.appendRow(this._tableContainer, databaseOption.displayName, 'connection-label', 'connection-input'); 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], values: [this._defaultDatabaseName, this._loadingDatabaseName],
strictSelection: false, strictSelection: false,
placeholder: this._defaultDatabaseName, placeholder: this._defaultDatabaseName,

View File

@@ -31,7 +31,7 @@ import { ConfigurationService } from 'vs/platform/configuration/node/configurati
import * as TypeMoq from 'typemoq'; import * as TypeMoq from 'typemoq';
import * as assert from 'assert'; import * as assert from 'assert';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices'; import { TestStorageService, TestLayoutService } from 'vs/workbench/test/workbenchTestServices';
let none: void; let none: void;
@@ -51,7 +51,7 @@ suite('SQL QueryAction Tests', () => {
// Setup a reusable mock QueryEditor // Setup a reusable mock QueryEditor
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(), undefined, undefined, undefined, undefined, 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.connectedUri).returns(() => testUri);
editor.setup(x => x.currentQueryInput).returns(() => testQueryInput.object); editor.setup(x => x.currentQueryInput).returns(() => testQueryInput.object);
editor.setup(x => x.uri).returns(() => testUri); editor.setup(x => x.uri).returns(() => testUri);
@@ -88,7 +88,7 @@ suite('SQL QueryAction Tests', () => {
// ... Create an editor // ... Create an editor
let editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(), undefined, undefined, undefined, undefined, 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); editor.setup(x => x.currentQueryInput).returns(() => testQueryInput.object);
// If I create a QueryTaskbarAction and I pass a non-connected editor to _getConnectedQueryEditorUri // If I create a QueryTaskbarAction and I pass a non-connected editor to _getConnectedQueryEditorUri
@@ -175,7 +175,7 @@ suite('SQL QueryAction Tests', () => {
countCalledRunQuery++; countCalledRunQuery++;
}); });
let queryEditor: TypeMoq.Mock<QueryEditor> = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(), undefined, let queryEditor: TypeMoq.Mock<QueryEditor> = 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.currentQueryInput).returns(() => queryInput.object);
queryEditor.setup(x => x.getSelection()).returns(() => undefined); queryEditor.setup(x => x.getSelection()).returns(() => undefined);
queryEditor.setup(x => x.getSelection(false)).returns(() => undefined); queryEditor.setup(x => x.getSelection(false)).returns(() => undefined);
@@ -242,7 +242,7 @@ suite('SQL QueryAction Tests', () => {
// ... Mock "getSelection" in QueryEditor // ... Mock "getSelection" in QueryEditor
let queryEditor: TypeMoq.Mock<QueryEditor> = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(), undefined, let queryEditor: TypeMoq.Mock<QueryEditor> = 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.currentQueryInput).returns(() => queryInput.object);
queryEditor.setup(x => x.getSelection()).returns(() => { queryEditor.setup(x => x.getSelection()).returns(() => {
return selectionToReturnInGetSelection; return selectionToReturnInGetSelection;
@@ -475,8 +475,10 @@ suite('SQL QueryAction Tests', () => {
databaseName: databaseName databaseName: databaseName
}); });
const layoutService = new TestLayoutService();
// If I query without having initialized anything, state should be clear // 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.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries 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.onConnectionChanged).returns(() => dbChangedEmitter.event);
cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName }); cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
const layoutService = new TestLayoutService();
// ... Create a database dropdown that has been connected // ... 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(); listItem.onConnected();
// If: I raise a connection changed event // 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.onConnectionChanged).returns(() => dbChangedEmitter.event);
cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName }); cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
const layoutService = new TestLayoutService();
// ... Create a database dropdown that has been connected // ... 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(); listItem.onConnected();
// If: I raise a connection changed event for the 'wrong' URI // If: I raise a connection changed event for the 'wrong' URI
@@ -561,8 +567,10 @@ suite('SQL QueryAction Tests', () => {
cms.callBase = true; cms.callBase = true;
cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event); cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
const layoutService = new TestLayoutService();
// ... Create a database dropdown // ... 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 // If: I raise a connection changed event
let eventParams = <IConnectionParams>{ let eventParams = <IConnectionParams>{

View File

@@ -47,7 +47,6 @@ suite('SQL QueryEditor Tests', () => {
instantiationService.object, instantiationService.object,
undefined, undefined,
undefined, undefined,
undefined,
editorDescriptorService.object, editorDescriptorService.object,
undefined, undefined,
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) => { instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
if (classDef.ID) { if (classDef.ID) {
if (classDef.ID === 'listDatabaseQueryActionItem') { 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 // Default
@@ -318,7 +317,7 @@ suite('SQL QueryEditor Tests', () => {
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
.returns((definition, editor, action, selectBox) => { .returns((definition, editor, action, selectBox) => {
if (definition.ID === 'listDatabaseQueryActionItem') { 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; return item;
} }
// Default // Default

View File

@@ -15,6 +15,7 @@
"./sql/base/browser/ui/button/*.ts", "./sql/base/browser/ui/button/*.ts",
"./sql/base/browser/ui/checkbox/*.ts", "./sql/base/browser/ui/checkbox/*.ts",
"./sql/base/browser/ui/dropdownList/*.ts", "./sql/base/browser/ui/dropdownList/*.ts",
"./sql/base/browser/ui/editableDropdown/*.ts",
"./sql/base/browser/ui/inputBox/*.ts", "./sql/base/browser/ui/inputBox/*.ts",
"./sql/base/browser/ui/listBox/*.ts", "./sql/base/browser/ui/listBox/*.ts",
"./sql/base/browser/ui/panel/*.ts", "./sql/base/browser/ui/panel/*.ts",
@@ -22,6 +23,14 @@
"./sql/base/browser/ui/scrollable/*.ts", "./sql/base/browser/ui/scrollable/*.ts",
"./sql/base/browser/ui/selectBox/*.ts", "./sql/base/browser/ui/selectBox/*.ts",
"./sql/base/browser/ui/table/*.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": [ "exclude": [
"node_modules/**" "node_modules/**"

View File

@@ -9,8 +9,6 @@ import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { INavigator } from 'vs/base/common/iterator'; import { INavigator } from 'vs/base/common/iterator';
import * as _ from './tree'; import * as _ from './tree';
import { Event, Emitter, EventMultiplexer, Relay } from 'vs/base/common/event'; import { Event, Emitter, EventMultiplexer, Relay } from 'vs/base/common/event';
// {{SQL CARBON EDIT}}
import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
interface IMap<T> { [id: string]: T; } interface IMap<T> { [id: string]: T; }
interface IItemMap extends IMap<Item> { } interface IItemMap extends IMap<Item> { }
@@ -374,14 +372,7 @@ export class Item {
return result.then(() => { return result.then(() => {
this._setExpanded(true); this._setExpanded(true);
this._onDidExpand.fire(eventData); this._onDidExpand.fire(eventData);
// {{SQL CARBON EDIT}} - Original code does not handle the need to refresh children in case previous refreshchildren errored out. return true;
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;
}
}); });
}); });

View File

@@ -1527,7 +1527,7 @@ export class TreeView extends HeightMap {
this.onDragEnd(e); this.onDragEnd(e);
} else { } else {
// {{SQL CARBON EDIT}} // {{SQL CARBON EDIT}}
this.context.dnd.dropAbort(this.context.tree, this.currentDragAndDropData); this.context.dnd!.dropAbort(this.context.tree, this.currentDragAndDropData!);
} }
this.cancelDragAndDropScrollInterval(); this.cancelDragAndDropScrollInterval();
} }
@@ -1538,7 +1538,7 @@ export class TreeView extends HeightMap {
this.currentDropTargets = []; this.currentDropTargets = [];
} else { } else {
// {{SQL CARBON EDIT}} // {{SQL CARBON EDIT}}
this.context.dnd.dropAbort(this.context.tree, this.currentDragAndDropData); this.context.dnd!.dropAbort(this.context.tree, this.currentDragAndDropData!);
} }
this.currentDropDisposable.dispose(); this.currentDropDisposable.dispose();

View File

@@ -622,8 +622,12 @@ export class ContextKeyGreaterThanEqualsExpr implements ContextKeyExpr {
} }
public evaluate(context: IContext): boolean { public evaluate(context: IContext): boolean {
let keyInt = parseFloat(context.getValue(this.key)); const keyVal = context.getValue<string>(this.key);
let valueInt = parseFloat(this.value); if (!keyVal) {
return false;
}
const keyInt = parseFloat(keyVal);
const valueInt = parseFloat(this.value);
return (keyInt >= valueInt); return (keyInt >= valueInt);
} }
@@ -677,8 +681,12 @@ export class ContextKeyLessThanEqualsExpr implements ContextKeyExpr {
} }
public evaluate(context: IContext): boolean { public evaluate(context: IContext): boolean {
let keyInt = parseFloat(context.getValue(this.key)); const keyVal = context.getValue<string>(this.key);
let valueInt = parseFloat(this.value); if (!keyVal) {
return false;
}
const keyInt = parseFloat(keyVal);
const valueInt = parseFloat(this.value);
return (keyInt <= valueInt); return (keyInt <= valueInt);
} }