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.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!sql/media/icons/common-icons';
import 'vs/css!./media/breadcrumb';

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,6 @@ import { generateUuid } from 'vs/base/common/uuid';
import * as DOM from 'vs/base/browser/dom';
import { Event, Emitter } from 'vs/base/common/event';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { $ } from 'sql/base/browser/builder';
export interface Template {
label: HTMLElement;
@@ -34,9 +33,13 @@ export class DropdownRenderer implements tree.IRenderer {
}
public renderTemplate(tree: tree.ITree, templateId: string, container: HTMLElement): Template {
const row = $('div.list-row').style('height', '22px').style('padding-left', '5px').getHTMLElement();
const row = DOM.$('div.list-row');
row.style.height = '22px';
row.style.paddingLeft = '5px';
DOM.append(container, row);
const label = $('span.label').style('margin', 'auto').style('vertical-align', 'middle').getHTMLElement();
const label = DOM.$('span.label');
label.style.margin = 'auto';
label.style.verticalAlign = 'middle';
DOM.append(row, label);
return { label, row };

View File

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

View File

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

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { InputBox as vsInputBox, IInputOptions, IInputBoxStyles as vsIInputBoxStyles, IMessage } from 'vs/base/browser/ui/inputbox/inputBox';
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { Color } from 'vs/base/common/color';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
/**
* Alterable version of the vs memorize function; to unmemoize use unmemoize
*/

View File

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

View File

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

View File

@@ -3,8 +3,6 @@
* 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 } {
if (map) {
let rt: { [key: string]: V } = Object.create(null);

View File

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

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
/**
* Deferred promise
@@ -23,4 +22,4 @@ export class Deferred<T> {
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult> | void): Thenable<TResult> {
return this.promise.then(onfulfilled, onrejected);
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import { ElementRef, AfterContentChecked, ViewChild, forwardRef, Inject } from '@angular/core';
import { ElementRef, AfterContentChecked, ViewChild } from '@angular/core';
import { Table } from 'sql/base/browser/ui/table/table';
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
@@ -14,7 +14,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Taskbar } from '../../../base/browser/ui/taskbar/taskbar';
import { JobsRefreshAction, IJobActionInfo } from 'sql/platform/jobManagement/common/jobActions';
import { JobsRefreshAction } from 'sql/platform/jobManagement/common/jobActions';
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService';
@@ -111,7 +111,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent
let refreshAction = this._instantiationService.createInstance(JobsRefreshAction);
let newAction: Action = this._instantiationService.createInstance(this.contextAction);
let taskbar = <HTMLElement>this.actionBarContainer.nativeElement;
this._actionBar = new Taskbar(taskbar, this._contextMenuService);
this._actionBar = new Taskbar(taskbar);
this._actionBar.setContent([
{ action: refreshAction },
{ action: newAction }
@@ -127,4 +127,4 @@ export abstract class JobManagementView extends TabChild implements AfterContent
export interface JobActionContext {
canEdit: boolean;
job: azdata.AgentJobInfo;
}
}

View File

@@ -2,25 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./declarativeTable';
import {
Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver,
ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, QueryList, AfterViewInit
Component, Input, Inject, ChangeDetectorRef, forwardRef, ViewChild, ElementRef, OnDestroy, AfterViewInit
} from '@angular/core';
import * as azdata from 'azdata';
import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { Event, Emitter } from 'vs/base/common/event';
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editableDropdown.component';
import { ISelectData } from 'vs/base/browser/ui/selectBox/selectBox';
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
import * as nls from 'vs/nls';
export enum DeclarativeDataType {
string = 'string',
@@ -37,7 +30,7 @@ export enum DeclarativeDataType {
<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>
</ng-container>
</thead>
</thead>
<ng-container *ngIf="data">
<ng-container *ngFor="let row of data;let r = index">
<tr class="declarative-table-row" >
@@ -63,8 +56,6 @@ export default class DeclarativeTableComponent extends ComponentBase implements
@ViewChild('container', { read: ElementRef }) private _tableContainer: ElementRef;
constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IContextViewService) private contextViewService: IContextViewService,
@Inject(forwardRef(() => ElementRef)) el: ElementRef
) {
super(changeRef, el);

View File

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

View File

@@ -25,7 +25,6 @@ import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorIn
import * as DOM from 'vs/base/browser/dom';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Event, Emitter } from 'vs/base/common/event';
import { CellTypes } from 'sql/parts/notebook/models/contracts';
@@ -53,7 +52,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
@Input() public set cellModel(value: ICellModel) {
this._cellModel = value;
if (this.toolbarElement && value && value.cellType === CellTypes.Markdown) {
let nativeToolbar = <HTMLElement> this.toolbarElement.nativeElement;
let nativeToolbar = <HTMLElement>this.toolbarElement.nativeElement;
DOM.addClass(nativeToolbar, MARKDOWN_CLASS);
}
}
@@ -102,13 +101,12 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
@Inject(IModelService) private _modelService: IModelService,
@Inject(IModeService) private _modeService: IModeService,
@Inject(IContextMenuService) private contextMenuService: IContextMenuService,
@Inject(IConfigurationService) private _configurationService: IConfigurationService
) {
super();
this._cellToggleMoreActions = this._instantiationService.createInstance(CellToggleMoreActions);
this._register(Event.debounce(this._layoutEmitter.event, (l, e) => e, 250, /*leading=*/false)
(() => this.layout()));
(() => this.layout()));
// Handle disconnect on removal of the cell, if it was the active cell
this._register({ dispose: () => this.updateConnectionState(false) });
@@ -230,7 +228,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
let runCellAction = this._instantiationService.createInstance(RunCellAction, context);
let taskbar = <HTMLElement>this.toolbarElement.nativeElement;
this._actionBar = new Taskbar(taskbar, this.contextMenuService);
this._actionBar = new Taskbar(taskbar);
this._actionBar.context = context;
this._actionBar.setContent([
{ 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 { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { AngularDisposable } from 'sql/base/node/lifecycle';
import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts';
import { ICellModel, IModelFactory, INotebookModel, NotebookContentChange } from 'sql/parts/notebook/models/modelInterfaces';
@@ -69,7 +68,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
constructor(
@Inject(forwardRef(() => CommonServiceInterface)) private _bootstrapService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IConnectionManagementService) private connectionManagementService: IConnectionManagementService,
@@ -163,8 +161,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
}
//Saves scrollTop value on scroll change
public scrollHandler(event: Event){
this._scrollTop = (<any>event.srcElement).scrollTop;
public scrollHandler(event: Event) {
this._scrollTop = (<HTMLElement>event.srcElement).scrollTop;
}
public unselectActiveCell() {
@@ -380,7 +378,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
this._trustedAction.enabled = false;
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.setContent([
{ element: kernelContainer },

View File

@@ -80,6 +80,10 @@ export class ServerTreeDataSource implements IDataSource {
node.setExpandedState(TreeItemCollapsibleState.Collapsed);
node.errorStateMessage = expandError;
this.showError(expandError);
// collapse node and refresh in case of error so remove tree cache
setTimeout(() => {
tree.collapse(element).then(() => tree.refresh(element));
});
resolve([]);
});
}
@@ -109,4 +113,4 @@ export class ServerTreeDataSource implements IDataSource {
this._errorMessageService.showDialog(Severity.Error, '', errorMessage);
}
}
}
}

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

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

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

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 { EventEmitter } from 'sql/base/common/eventEmitter';
import { Dropdown } from 'sql/base/browser/ui/editableDropdown/dropdown';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
/**
* Action class that query-based Actions will extend. This base class automatically handles activating and
@@ -448,7 +449,8 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@INotificationService private _notificationService: INotificationService,
@IContextViewService contextViewProvider: IContextViewService,
@IConfigurationService private readonly _configurationService: IConfigurationService
@IConfigurationService private readonly _configurationService: IConfigurationService,
@ILayoutService layoutService: ILayoutService
) {
super();
this._toDispose = [];
@@ -462,7 +464,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
this._databaseSelectBox.disable();
} else {
this._dropdown = new Dropdown(this._databaseListDropdown, contextViewProvider, {
this._dropdown = new Dropdown(this._databaseListDropdown, contextViewProvider, layoutService, {
strictSelection: true,
placeholder: this._selectDatabaseString,
ariaLabel: this._selectDatabaseString,

View File

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

View File

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

View File

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