mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Remove builder references from options dialog (#4774)
* remove more builder references; remove $ from declarations * fix jquery references * formatting * fixing backup * fix backup box
This commit is contained in:
@@ -41,7 +41,7 @@ const defaultStyles: ISplitViewStyles = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const defaultOptions: ISplitViewOptions = {
|
const defaultOptions: ISplitViewOptions = {
|
||||||
enableResizing: true
|
enableResizing: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IView extends HeightIView {
|
export interface IView extends HeightIView {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
this.onPostEventHandler.subscribe(this._grid.onRendered, () => this.onPostRender());
|
this.onPostEventHandler.subscribe(this._grid.onRendered, () => this.onPostRender());
|
||||||
}
|
}
|
||||||
|
|
||||||
this._$container = $(this._grid.getContainerNode());
|
this._$container = jQuery(this._grid.getContainerNode());
|
||||||
this._$container.on('dblclick.autosize', '.slick-resizable-handle', e => this.handleDoubleClick(e));
|
this._$container.on('dblclick.autosize', '.slick-resizable-handle', e => this.handleDoubleClick(e));
|
||||||
this._context = document.createElement('canvas').getContext('2d');
|
this._context = document.createElement('canvas').getContext('2d');
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let headerColumnsQuery = $(this._grid.getContainerNode()).find('.slick-header-columns');
|
let headerColumnsQuery = jQuery(this._grid.getContainerNode()).find('.slick-header-columns');
|
||||||
if (headerColumnsQuery && headerColumnsQuery.length) {
|
if (headerColumnsQuery && headerColumnsQuery.length) {
|
||||||
let headerColumns = headerColumnsQuery[0];
|
let headerColumns = headerColumnsQuery[0];
|
||||||
let origCols = this._grid.getColumns();
|
let origCols = this._grid.getColumns();
|
||||||
@@ -78,7 +78,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
});
|
});
|
||||||
let change = false;
|
let change = false;
|
||||||
for (let i = 0; i <= headerColumns.children.length; i++) {
|
for (let i = 0; i <= headerColumns.children.length; i++) {
|
||||||
let headerEl = $(headerColumns.children.item(i));
|
let headerEl = jQuery(headerColumns.children.item(i));
|
||||||
let columnDef = headerEl.data('column');
|
let columnDef = headerEl.data('column');
|
||||||
if (columnDef) {
|
if (columnDef) {
|
||||||
let headerWidth = this.getElementWidth(headerEl[0]);
|
let headerWidth = this.getElementWidth(headerEl[0]);
|
||||||
@@ -100,7 +100,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleDoubleClick(e: JQuery.Event<HTMLElement, string>) {
|
private handleDoubleClick(e: JQuery.Event<HTMLElement, string>) {
|
||||||
let headerEl = $(e.currentTarget).closest('.slick-header-column');
|
let headerEl = jQuery(e.currentTarget).closest('.slick-header-column');
|
||||||
let columnDef = headerEl.data('column');
|
let columnDef = headerEl.data('column');
|
||||||
|
|
||||||
if (!columnDef || !columnDef.resizable) {
|
if (!columnDef || !columnDef.resizable) {
|
||||||
@@ -150,9 +150,9 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getTemplateWidth(rowEl: JQuery, template: JQuery | HTMLElement): number {
|
private getTemplateWidth(rowEl: JQuery, template: JQuery | HTMLElement): number {
|
||||||
let cell = $(rowEl.find('.slick-cell'));
|
let cell = jQuery(rowEl.find('.slick-cell'));
|
||||||
cell.append(template);
|
cell.append(template);
|
||||||
$(cell).find('*').css('position', 'relative');
|
jQuery(cell).find('*').css('position', 'relative');
|
||||||
return cell.outerWidth() + 1;
|
return cell.outerWidth() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
texts.forEach((text, index) => {
|
texts.forEach((text, index) => {
|
||||||
let template;
|
let template;
|
||||||
if (formatFun) {
|
if (formatFun) {
|
||||||
template = $('<span>' + formatFun(index, colIndex, text, columnDef, data[index]) + '</span>');
|
template = jQuery('<span>' + formatFun(index, colIndex, text, columnDef, data[index]) + '</span>');
|
||||||
text = template.text() || text;
|
text = template.text() || text;
|
||||||
}
|
}
|
||||||
let length = text ? this.getElementWidthUsingCanvas(rowEl, text) : 0;
|
let length = text ? this.getElementWidthUsingCanvas(rowEl, text) : 0;
|
||||||
@@ -176,19 +176,19 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createRow(columnDef): JQuery {
|
private createRow(columnDef): JQuery {
|
||||||
let rowEl = $('<div class="slick-row"><div class="slick-cell"></div></div>');
|
let rowEl = jQuery('<div class="slick-row"><div class="slick-cell"></div></div>');
|
||||||
rowEl.find('.slick-cell').css({
|
rowEl.find('.slick-cell').css({
|
||||||
'visibility': 'hidden',
|
'visibility': 'hidden',
|
||||||
'text-overflow': 'initial',
|
'text-overflow': 'initial',
|
||||||
'white-space': 'nowrap'
|
'white-space': 'nowrap'
|
||||||
});
|
});
|
||||||
let gridCanvas = this._$container.find('.grid-canvas');
|
let gridCanvas = this._$container.find('.grid-canvas');
|
||||||
$(gridCanvas).append(rowEl);
|
jQuery(gridCanvas).append(rowEl);
|
||||||
return rowEl;
|
return rowEl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private deleteRow(rowEl: JQuery) {
|
private deleteRow(rowEl: JQuery) {
|
||||||
$(rowEl).remove();
|
jQuery(rowEl).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
private getElementWidth(element: HTMLElement): number {
|
private getElementWidth(element: HTMLElement): number {
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ export class CellRangeSelector<T> implements ICellRangeSelector<T> {
|
|||||||
this.grid.setActiveCell(cell.row, cell.cell);
|
this.grid.setActiveCell(cell.row, cell.cell);
|
||||||
|
|
||||||
let start = this.grid.getCellFromPoint(
|
let start = this.grid.getCellFromPoint(
|
||||||
dd.startX - $(this.canvas).offset().left,
|
dd.startX - jQuery(this.canvas).offset().left,
|
||||||
dd.startY - $(this.canvas).offset().top);
|
dd.startY - jQuery(this.canvas).offset().top);
|
||||||
|
|
||||||
dd.range = { start: start, end: undefined };
|
dd.range = { start: start, end: undefined };
|
||||||
this.currentlySelectedRange = dd.range;
|
this.currentlySelectedRange = dd.range;
|
||||||
@@ -108,8 +108,8 @@ export class CellRangeSelector<T> implements ICellRangeSelector<T> {
|
|||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
let end = this.grid.getCellFromPoint(
|
let end = this.grid.getCellFromPoint(
|
||||||
e.pageX - $(this.canvas).offset().left,
|
e.pageX - jQuery(this.canvas).offset().left,
|
||||||
e.pageY - $(this.canvas).offset().top);
|
e.pageY - jQuery(this.canvas).offset().top);
|
||||||
|
|
||||||
if (!this.grid.canCellBeSelected(end.row, end.cell)) {
|
if (!this.grid.canCellBeSelected(end.row, end.cell)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export class CheckboxSelectColumn<T> implements Slick.Plugin<T> {
|
|||||||
|
|
||||||
private handleClick(e: Event, args: Slick.OnClickEventArgs<T>): void {
|
private handleClick(e: Event, args: Slick.OnClickEventArgs<T>): void {
|
||||||
// clicking on a row select checkbox
|
// clicking on a row select checkbox
|
||||||
if (this._grid.getColumns()[args.cell].id === this._options.columnId && $(e.target).is('input[type="checkbox"]')) {
|
if (this._grid.getColumns()[args.cell].id === this._options.columnId && jQuery(e.target).is('input[type="checkbox"]')) {
|
||||||
// if editing, try to commit
|
// if editing, try to commit
|
||||||
if (this._grid.getEditorLock().isActive() && !this._grid.getEditorLock().commitCurrentEdit()) {
|
if (this._grid.getEditorLock().isActive() && !this._grid.getEditorLock().commitCurrentEdit()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -131,7 +131,7 @@ export class CheckboxSelectColumn<T> implements Slick.Plugin<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleHeaderClick(e: Event, args: Slick.OnHeaderClickEventArgs<T>): void {
|
private handleHeaderClick(e: Event, args: Slick.OnHeaderClickEventArgs<T>): void {
|
||||||
if (!this._options.title && args.column.id === this._options.columnId && $(e.target).is('input[type="checkbox"]')) {
|
if (!this._options.title && args.column.id === this._options.columnId && jQuery(e.target).is('input[type="checkbox"]')) {
|
||||||
// if editing, try to commit
|
// if editing, try to commit
|
||||||
if (this._grid.getEditorLock().isActive() && !this._grid.getEditorLock().commitCurrentEdit()) {
|
if (this._grid.getEditorLock().isActive() && !this._grid.getEditorLock().commitCurrentEdit()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -139,7 +139,7 @@ export class CheckboxSelectColumn<T> implements Slick.Plugin<T> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(e.target).is('input[checked]')) {
|
if (jQuery(e.target).is('input[checked]')) {
|
||||||
let rows = [];
|
let rows = [];
|
||||||
for (let i = 0; i < this._grid.getDataLength(); i++) {
|
for (let i = 0; i < this._grid.getDataLength(); i++) {
|
||||||
rows.push(i);
|
rows.push(i);
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ export class HeaderFilter {
|
|||||||
.subscribe(this.grid.onKeyDown, (e) => this.handleKeyDown);
|
.subscribe(this.grid.onKeyDown, (e) => this.handleKeyDown);
|
||||||
this.grid.setColumns(this.grid.getColumns());
|
this.grid.setColumns(this.grid.getColumns());
|
||||||
|
|
||||||
$(document.body).bind('mousedown', this.handleBodyMouseDown);
|
jQuery(document.body).bind('mousedown', this.handleBodyMouseDown);
|
||||||
$(document.body).bind('keydown', this.handleKeyDown);
|
jQuery(document.body).bind('keydown', this.handleKeyDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
this.handler.unsubscribeAll();
|
this.handler.unsubscribeAll();
|
||||||
$(document.body).unbind('mousedown', this.handleBodyMouseDown);
|
jQuery(document.body).unbind('mousedown', this.handleBodyMouseDown);
|
||||||
$(document.body).unbind('keydown', this.handleKeyDown);
|
jQuery(document.body).unbind('keydown', this.handleKeyDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleKeyDown = (e) => {
|
private handleKeyDown = (e) => {
|
||||||
@@ -60,7 +60,7 @@ export class HeaderFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleBodyMouseDown = (e) => {
|
private handleBodyMouseDown = (e) => {
|
||||||
if (this.$menu && this.$menu[0] !== e.target && !$.contains(this.$menu[0], e.target)) {
|
if (this.$menu && this.$menu[0] !== e.target && !jQuery.contains(this.$menu[0], e.target)) {
|
||||||
this.hideMenu();
|
this.hideMenu();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -79,7 +79,7 @@ export class HeaderFilter {
|
|||||||
if (column.id === '_detail_selector') {
|
if (column.id === '_detail_selector') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let $el = $('<div></div>')
|
let $el = jQuery('<div></div>')
|
||||||
.addClass('slick-header-menubutton')
|
.addClass('slick-header-menubutton')
|
||||||
.data('column', column);
|
.data('column', column);
|
||||||
|
|
||||||
@@ -87,19 +87,19 @@ export class HeaderFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleBeforeHeaderCellDestroy(e, args) {
|
private handleBeforeHeaderCellDestroy(e, args) {
|
||||||
$(args.node)
|
jQuery(args.node)
|
||||||
.find('.slick-header-menubutton')
|
.find('.slick-header-menubutton')
|
||||||
.remove();
|
.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
private addMenuItem(menu, columnDef, title, command, image) {
|
private addMenuItem(menu, columnDef, title, command, image) {
|
||||||
let $item = $('<div class="slick-header-menuitem">')
|
let $item = jQuery('<div class="slick-header-menuitem">')
|
||||||
.data('command', command)
|
.data('command', command)
|
||||||
.data('column', columnDef)
|
.data('column', columnDef)
|
||||||
.bind('click', (e) => this.handleMenuItemClick(e, command, columnDef))
|
.bind('click', (e) => this.handleMenuItemClick(e, command, columnDef))
|
||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
|
|
||||||
let $icon = $('<div class="slick-header-menuicon">')
|
let $icon = jQuery('<div class="slick-header-menuicon">')
|
||||||
.appendTo($item);
|
.appendTo($item);
|
||||||
|
|
||||||
if (title === 'Sort Ascending') {
|
if (title === 'Sort Ascending') {
|
||||||
@@ -108,17 +108,17 @@ export class HeaderFilter {
|
|||||||
$icon.get(0).className += ' descending';
|
$icon.get(0).className += ' descending';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<span class="slick-header-menucontent">')
|
jQuery('<span class="slick-header-menucontent">')
|
||||||
.text(title)
|
.text(title)
|
||||||
.appendTo($item);
|
.appendTo($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private addMenuInput(menu, columnDef) {
|
private addMenuInput(menu, columnDef) {
|
||||||
const self = this;
|
const self = this;
|
||||||
$('<input class="input" placeholder="Search" style="margin-top: 5px; width: 206px">')
|
jQuery('<input class="input" placeholder="Search" style="margin-top: 5px; width: 206px">')
|
||||||
.data('column', columnDef)
|
.data('column', columnDef)
|
||||||
.bind('keyup', (e) => {
|
.bind('keyup', (e) => {
|
||||||
let filterVals = this.getFilterValuesByInput($(e.target));
|
let filterVals = this.getFilterValuesByInput(jQuery(e.target));
|
||||||
self.updateFilterInputs(menu, columnDef, filterVals);
|
self.updateFilterInputs(menu, columnDef, filterVals);
|
||||||
})
|
})
|
||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
@@ -139,15 +139,15 @@ export class HeaderFilter {
|
|||||||
+ '/>' + filterItems[i] + '</label>';
|
+ '/>' + filterItems[i] + '</label>';
|
||||||
}
|
}
|
||||||
let $filter = menu.find('.filter');
|
let $filter = menu.find('.filter');
|
||||||
$filter.empty().append($(filterOptions));
|
$filter.empty().append(jQuery(filterOptions));
|
||||||
|
|
||||||
$(':checkbox', $filter).bind('click', (e) => {
|
jQuery(':checkbox', $filter).bind('click', (e) => {
|
||||||
this.workingFilters = this.changeWorkingFilter(filterItems, this.workingFilters, $(e.target));
|
this.workingFilters = this.changeWorkingFilter(filterItems, this.workingFilters, jQuery(e.target));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private showFilter(e) {
|
private showFilter(e) {
|
||||||
let $menuButton = $(e.target);
|
let $menuButton = jQuery(e.target);
|
||||||
this.columnDef = $menuButton.data('column');
|
this.columnDef = $menuButton.data('column');
|
||||||
|
|
||||||
this.columnDef.filterValues = this.columnDef.filterValues || [];
|
this.columnDef.filterValues = this.columnDef.filterValues || [];
|
||||||
@@ -167,7 +167,7 @@ export class HeaderFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.$menu) {
|
if (!this.$menu) {
|
||||||
this.$menu = $('<div class="slick-header-menu">').appendTo(document.body);
|
this.$menu = jQuery('<div class="slick-header-menu">').appendTo(document.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$menu.empty();
|
this.$menu.empty();
|
||||||
@@ -186,15 +186,15 @@ export class HeaderFilter {
|
|||||||
+ '/>' + escape(filterItems[i]) + '</label>';
|
+ '/>' + escape(filterItems[i]) + '</label>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let $filter = $('<div class="filter">')
|
let $filter = jQuery('<div class="filter">')
|
||||||
.append($(filterOptions))
|
.append(jQuery(filterOptions))
|
||||||
.appendTo(this.$menu);
|
.appendTo(this.$menu);
|
||||||
|
|
||||||
this.okButton = new Button(this.$menu.get(0));
|
this.okButton = new Button(this.$menu.get(0));
|
||||||
this.okButton.label = 'OK';
|
this.okButton.label = 'OK';
|
||||||
this.okButton.title = 'OK';
|
this.okButton.title = 'OK';
|
||||||
this.okButton.element.id = 'filter-ok-button';
|
this.okButton.element.id = 'filter-ok-button';
|
||||||
let okElement = $('#filter-ok-button');
|
let okElement = jQuery('#filter-ok-button');
|
||||||
okElement.bind('click', (ev) => {
|
okElement.bind('click', (ev) => {
|
||||||
this.columnDef.filterValues = this.workingFilters.splice(0);
|
this.columnDef.filterValues = this.workingFilters.splice(0);
|
||||||
this.setButtonImage($menuButton, this.columnDef.filterValues.length > 0);
|
this.setButtonImage($menuButton, this.columnDef.filterValues.length > 0);
|
||||||
@@ -205,7 +205,7 @@ export class HeaderFilter {
|
|||||||
this.clearButton.label = 'Clear';
|
this.clearButton.label = 'Clear';
|
||||||
this.clearButton.title = 'Clear';
|
this.clearButton.title = 'Clear';
|
||||||
this.clearButton.element.id = 'filter-clear-button';
|
this.clearButton.element.id = 'filter-clear-button';
|
||||||
let clearElement = $('#filter-clear-button');
|
let clearElement = jQuery('#filter-clear-button');
|
||||||
clearElement.bind('click', (ev) => {
|
clearElement.bind('click', (ev) => {
|
||||||
this.columnDef.filterValues.length = 0;
|
this.columnDef.filterValues.length = 0;
|
||||||
this.setButtonImage($menuButton, false);
|
this.setButtonImage($menuButton, false);
|
||||||
@@ -216,23 +216,23 @@ export class HeaderFilter {
|
|||||||
this.cancelButton.label = 'Cancel';
|
this.cancelButton.label = 'Cancel';
|
||||||
this.cancelButton.title = 'Cancel';
|
this.cancelButton.title = 'Cancel';
|
||||||
this.cancelButton.element.id = 'filter-cancel-button';
|
this.cancelButton.element.id = 'filter-cancel-button';
|
||||||
let cancelElement = $('#filter-cancel-button');
|
let cancelElement = jQuery('#filter-cancel-button');
|
||||||
cancelElement.bind('click', () => this.hideMenu());
|
cancelElement.bind('click', () => this.hideMenu());
|
||||||
attachButtonStyler(this.okButton, this._themeService);
|
attachButtonStyler(this.okButton, this._themeService);
|
||||||
attachButtonStyler(this.clearButton, this._themeService);
|
attachButtonStyler(this.clearButton, this._themeService);
|
||||||
attachButtonStyler(this.cancelButton, this._themeService);
|
attachButtonStyler(this.cancelButton, this._themeService);
|
||||||
|
|
||||||
$(':checkbox', $filter).bind('click', (e) => {
|
jQuery(':checkbox', $filter).bind('click', (e) => {
|
||||||
this.workingFilters = this.changeWorkingFilter(filterItems, this.workingFilters, $(e.target));
|
this.workingFilters = this.changeWorkingFilter(filterItems, this.workingFilters, jQuery(e.target));
|
||||||
});
|
});
|
||||||
|
|
||||||
let offset = $(e.target).offset();
|
let offset = jQuery(e.target).offset();
|
||||||
let left = offset.left - this.$menu.width() + $(e.target).width() - 8;
|
let left = offset.left - this.$menu.width() + jQuery(e.target).width() - 8;
|
||||||
|
|
||||||
let menutop = offset.top + $(e.target).height();
|
let menutop = offset.top + jQuery(e.target).height();
|
||||||
|
|
||||||
if (menutop + offset.top > $(window).height()) {
|
if (menutop + offset.top > jQuery(window).height()) {
|
||||||
menutop -= (this.$menu.height() + $(e.target).height() + 8);
|
menutop -= (this.$menu.height() + jQuery(e.target).height() + 8);
|
||||||
}
|
}
|
||||||
this.$menu.css('top', menutop)
|
this.$menu.css('top', menutop)
|
||||||
.css('left', (left > 0 ? left : 0));
|
.css('left', (left > 0 ? left : 0));
|
||||||
@@ -249,10 +249,10 @@ export class HeaderFilter {
|
|||||||
if ($checkbox.val() < 0) {
|
if ($checkbox.val() < 0) {
|
||||||
// Select All
|
// Select All
|
||||||
if ($checkbox.prop('checked')) {
|
if ($checkbox.prop('checked')) {
|
||||||
$(':checkbox', $filter).prop('checked', true);
|
jQuery(':checkbox', $filter).prop('checked', true);
|
||||||
workingFilters = filterItems.slice(0);
|
workingFilters = filterItems.slice(0);
|
||||||
} else {
|
} else {
|
||||||
$(':checkbox', $filter).prop('checked', false);
|
jQuery(':checkbox', $filter).prop('checked', false);
|
||||||
workingFilters.length = 0;
|
workingFilters.length = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -359,4 +359,4 @@ export class HeaderFilter {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ export class RowDetailView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setOptions(options: any) {
|
public setOptions(options: any) {
|
||||||
this._options = $.extend(true, {}, this._options, options);
|
this._options = jQuery.extend(true, {}, this._options, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleClick(e: any, args: any): void {
|
public handleClick(e: any, args: any): void {
|
||||||
// clicking on a row select checkbox
|
// clicking on a row select checkbox
|
||||||
if (this._options.useRowClick || this._grid.getColumns()[args.cell].id === this._options.columnId && $(e.target).hasClass('detailView-toggle')) {
|
if (this._options.useRowClick || this._grid.getColumns()[args.cell].id === this._options.columnId && jQuery(e.target).hasClass('detailView-toggle')) {
|
||||||
// if editing, try to commit
|
// if editing, try to commit
|
||||||
if (this._grid.getEditorLock().isActive() && !this._grid.getEditorLock().commitCurrentEdit()) {
|
if (this._grid.getEditorLock().isActive() && !this._grid.getEditorLock().commitCurrentEdit()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -151,9 +151,9 @@ export class RowDetailView {
|
|||||||
|
|
||||||
// Saves the current state of the detail view
|
// Saves the current state of the detail view
|
||||||
public saveDetailView(item) {
|
public saveDetailView(item) {
|
||||||
let view = $('#innerDetailView_' + item.id);
|
let view = jQuery('#innerDetailView_' + item.id);
|
||||||
if (view) {
|
if (view) {
|
||||||
let html = $('#innerDetailView_' + item.id).html();
|
let html = jQuery('#innerDetailView_' + item.id).html();
|
||||||
if (html !== undefined) {
|
if (html !== undefined) {
|
||||||
item._detailContent = html;
|
item._detailContent = html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export class RowSelectionModel<T extends Slick.SlickData> implements Slick.Selec
|
|||||||
}
|
}
|
||||||
|
|
||||||
let selection = this.rangesToRows(this._ranges);
|
let selection = this.rangesToRows(this._ranges);
|
||||||
let idx = $.inArray(cell.row, selection);
|
let idx = jQuery.inArray(cell.row, selection);
|
||||||
|
|
||||||
if (idx === -1 && (e.ctrlKey || e.metaKey)) {
|
if (idx === -1 && (e.ctrlKey || e.metaKey)) {
|
||||||
selection.push(cell.row);
|
selection.push(cell.row);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox';
|
|||||||
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||||
import { ListBox } from 'sql/base/browser/ui/listBox/listBox';
|
import { ListBox } from 'sql/base/browser/ui/listBox/listBox';
|
||||||
import { ModalFooterStyle } from 'sql/workbench/browser/modal/modal';
|
import { ModalFooterStyle } from 'sql/workbench/browser/modal/modal';
|
||||||
import { CategoryView } from 'sql/workbench/browser/modal/optionsDialog';
|
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||||
import { attachButtonStyler, attachListBoxStyler, attachInputBoxStyler, attachSelectBoxStyler, attachCheckboxStyler } from 'sql/platform/theme/common/styler';
|
import { attachButtonStyler, attachListBoxStyler, attachInputBoxStyler, attachSelectBoxStyler, attachCheckboxStyler } from 'sql/platform/theme/common/styler';
|
||||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||||
@@ -19,20 +18,19 @@ import * as BackupConstants from 'sql/parts/disasterRecovery/backup/constants';
|
|||||||
import { IBackupService, TaskExecutionMode } from 'sql/platform/backup/common/backupService';
|
import { IBackupService, TaskExecutionMode } from 'sql/platform/backup/common/backupService';
|
||||||
import * as FileValidationConstants from 'sql/workbench/services/fileBrowser/common/fileValidationServiceConstants';
|
import * as FileValidationConstants from 'sql/workbench/services/fileBrowser/common/fileValidationServiceConstants';
|
||||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||||
import { ScrollableSplitView } from 'sql/base/browser/ui/scrollableSplitview/scrollableSplitview';
|
|
||||||
import { IFileBrowserDialogController } from 'sql/workbench/services/fileBrowser/common/fileBrowserDialogController';
|
import { IFileBrowserDialogController } from 'sql/workbench/services/fileBrowser/common/fileBrowserDialogController';
|
||||||
import { IBackupUiService } from 'sql/workbench/services/backup/common/backupUiService';
|
import { IBackupUiService } from 'sql/workbench/services/backup/common/backupUiService';
|
||||||
|
|
||||||
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import * as DOM from 'vs/base/browser/dom';
|
|
||||||
import * as types from 'vs/base/common/types';
|
import * as types from 'vs/base/common/types';
|
||||||
import * as strings from 'vs/base/common/strings';
|
import * as strings from 'vs/base/common/strings';
|
||||||
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 { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||||
|
|
||||||
export const BACKUP_SELECTOR: string = 'backup-component';
|
export const BACKUP_SELECTOR: string = 'backup-component';
|
||||||
|
|
||||||
@@ -337,13 +335,6 @@ export class BackupComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
// Set category view for advanced options. This should be defined in ngAfterViewInit so that it correctly calculates the text height after data binding.
|
|
||||||
var splitview = new ScrollableSplitView(this.advancedOptionElement.nativeElement);
|
|
||||||
var advancedBodySize = DOM.getTotalHeight(this.advancedOptionBodyElement.nativeElement);
|
|
||||||
var categoryView = this.instantiationService.createInstance(CategoryView, this.advancedOptionBodyElement.nativeElement, advancedBodySize, { title: LocalizedStrings.ADVANCED_CONFIGURATION, id: LocalizedStrings.ADVANCED_CONFIGURATION, ariaHeaderLabel: LocalizedStrings.ADVANCED_CONFIGURATION });
|
|
||||||
splitview.addView(categoryView, 0);
|
|
||||||
splitview.layout(advancedBodySize + this._advancedHeaderSize);
|
|
||||||
|
|
||||||
this._backupUiService.onShowBackupDialog();
|
this._backupUiService.onShowBackupDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,14 +425,14 @@ export class BackupComponent {
|
|||||||
|
|
||||||
// Set backup path list
|
// Set backup path list
|
||||||
this.setDefaultBackupPaths();
|
this.setDefaultBackupPaths();
|
||||||
var pathlist = [];
|
let pathlist: ISelectOptionItem[] = [];
|
||||||
for (var i in this.backupPathTypePairs) {
|
for (let i in this.backupPathTypePairs) {
|
||||||
pathlist.push(i);
|
pathlist.push({ text: i });
|
||||||
}
|
}
|
||||||
this.pathListBox.setOptions(pathlist, 0);
|
this.pathListBox.setOptions(pathlist, 0);
|
||||||
|
|
||||||
// Set encryption
|
// Set encryption
|
||||||
var encryptorItems = this.populateEncryptorCombo();
|
let encryptorItems = this.populateEncryptorCombo();
|
||||||
this.encryptorSelectBox.setOptions(encryptorItems, 0);
|
this.encryptorSelectBox.setOptions(encryptorItems, 0);
|
||||||
|
|
||||||
if (encryptorItems.length === 0) {
|
if (encryptorItems.length === 0) {
|
||||||
@@ -729,9 +720,9 @@ export class BackupComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private populateEncryptorCombo(): string[] {
|
private populateEncryptorCombo(): string[] {
|
||||||
var encryptorCombo = [];
|
let encryptorCombo = [];
|
||||||
this.backupEncryptors.forEach((encryptor) => {
|
this.backupEncryptors.forEach((encryptor) => {
|
||||||
var encryptorTypeStr = (encryptor.encryptorType === 0 ? BackupConstants.serverCertificate : BackupConstants.asymmetricKey);
|
let encryptorTypeStr = (encryptor.encryptorType === 0 ? BackupConstants.serverCertificate : BackupConstants.asymmetricKey);
|
||||||
encryptorCombo.push(encryptor.encryptorName + '(' + encryptorTypeStr + ')');
|
encryptorCombo.push(encryptor.encryptorName + '(' + encryptorTypeStr + ')');
|
||||||
});
|
});
|
||||||
return encryptorCombo;
|
return encryptorCombo;
|
||||||
@@ -867,18 +858,18 @@ export class BackupComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createBackupInfo(): MssqlBackupInfo {
|
private createBackupInfo(): MssqlBackupInfo {
|
||||||
var backupPathArray = [];
|
let backupPathArray = [];
|
||||||
for (var i in this.backupPathTypePairs) {
|
for (let i in this.backupPathTypePairs) {
|
||||||
backupPathArray.push(i);
|
backupPathArray.push(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get encryptor type and name
|
// get encryptor type and name
|
||||||
var encryptorName = '';
|
let encryptorName = '';
|
||||||
var encryptorType;
|
let encryptorType;
|
||||||
|
|
||||||
if (this.encryptCheckBox.checked && this.encryptorSelectBox.value !== '') {
|
if (this.encryptCheckBox.checked && this.encryptorSelectBox.value !== '') {
|
||||||
var selectedEncryptor = this.encryptorSelectBox.value;
|
let selectedEncryptor = this.encryptorSelectBox.value;
|
||||||
var encryptorTypeStr = selectedEncryptor.substring(selectedEncryptor.lastIndexOf('(') + 1, selectedEncryptor.lastIndexOf(')'));
|
let encryptorTypeStr = selectedEncryptor.substring(selectedEncryptor.lastIndexOf('(') + 1, selectedEncryptor.lastIndexOf(')'));
|
||||||
encryptorType = (encryptorTypeStr === BackupConstants.serverCertificate ? 0 : 1);
|
encryptorType = (encryptorTypeStr === BackupConstants.serverCertificate ? 0 : 1);
|
||||||
encryptorName = selectedEncryptor.substring(0, selectedEncryptor.lastIndexOf('('));
|
encryptorName = selectedEncryptor.substring(0, selectedEncryptor.lastIndexOf('('));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
import { ElementRef, Directive, Inject, Output, EventEmitter, forwardRef } from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
|
||||||
selector: '[mousedown]'
|
|
||||||
})
|
|
||||||
export class MouseDownDirective {
|
|
||||||
@Output('mousedown') onMouseDown = new EventEmitter();
|
|
||||||
|
|
||||||
constructor(@Inject(forwardRef(() => ElementRef)) private _el: ElementRef) {
|
|
||||||
const self = this;
|
|
||||||
setTimeout(() => {
|
|
||||||
let $gridCanvas = $(this._el.nativeElement).find('.grid-canvas');
|
|
||||||
$gridCanvas.on('mousedown', () => {
|
|
||||||
self.onMouseDown.emit();
|
|
||||||
});
|
|
||||||
let jQueryCast: any = $;
|
|
||||||
let mouseDownFuncs: any[] = jQueryCast._data($gridCanvas[0], 'events')['mousedown'];
|
|
||||||
// reverse the event array so that our event fires first.
|
|
||||||
mouseDownFuncs.reverse();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
import { ElementRef, Directive, Input, Output, EventEmitter, forwardRef,
|
|
||||||
Inject } from '@angular/core';
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
|
||||||
|
|
||||||
@Directive({
|
|
||||||
selector: '[onScroll]'
|
|
||||||
})
|
|
||||||
export class ScrollDirective {
|
|
||||||
@Input() scrollEnabled: boolean = true;
|
|
||||||
@Output('onScroll') onScroll = new EventEmitter();
|
|
||||||
|
|
||||||
constructor(@Inject(forwardRef(() => ElementRef)) private _el: ElementRef) {
|
|
||||||
const self = this;
|
|
||||||
Observable.fromEvent(this._el.nativeElement, 'scroll').subscribe((event) => {
|
|
||||||
if (self.scrollEnabled) {
|
|
||||||
self.onScroll.emit(self._el.nativeElement.scrollTop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -173,7 +173,7 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
|||||||
this.onActiveCellChanged = this.onCellSelect;
|
this.onActiveCellChanged = this.onCellSelect;
|
||||||
|
|
||||||
this.onCellEditEnd = (event: Slick.OnCellChangeEventArgs<any>): void => {
|
this.onCellEditEnd = (event: Slick.OnCellChangeEventArgs<any>): void => {
|
||||||
if(self.currentEditCellValue !== event.item[event.cell]) {
|
if (self.currentEditCellValue !== event.item[event.cell]) {
|
||||||
self.currentCell.isDirty = true;
|
self.currentCell.isDirty = true;
|
||||||
}
|
}
|
||||||
// Store the value that was set
|
// Store the value that was set
|
||||||
@@ -541,12 +541,12 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
|||||||
let grid = slick._grid;
|
let grid = slick._grid;
|
||||||
if (dirtyState) {
|
if (dirtyState) {
|
||||||
// Change cell color
|
// Change cell color
|
||||||
$(grid.getCellNode(row, column)).addClass('dirtyCell').removeClass('selected');
|
jQuery(grid.getCellNode(row, column)).addClass('dirtyCell').removeClass('selected');
|
||||||
if (this.dirtyCells.indexOf(column) === -1) {
|
if (this.dirtyCells.indexOf(column) === -1) {
|
||||||
this.dirtyCells.push(column);
|
this.dirtyCells.push(column);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$(grid.getCellNode(row, column)).removeClass('dirtyCell');
|
jQuery(grid.getCellNode(row, column)).removeClass('dirtyCell');
|
||||||
if (this.dirtyCells.indexOf(column) !== -1) {
|
if (this.dirtyCells.indexOf(column) !== -1) {
|
||||||
this.dirtyCells.splice(this.dirtyCells.indexOf(column), 1);
|
this.dirtyCells.splice(this.dirtyCells.indexOf(column), 1);
|
||||||
}
|
}
|
||||||
@@ -559,17 +559,17 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
|||||||
let grid = slick._grid;
|
let grid = slick._grid;
|
||||||
if (dirtyState) {
|
if (dirtyState) {
|
||||||
// Change row header color
|
// Change row header color
|
||||||
$(grid.getCellNode(row, 0)).addClass('dirtyRowHeader');
|
jQuery(grid.getCellNode(row, 0)).addClass('dirtyRowHeader');
|
||||||
} else {
|
} else {
|
||||||
$(grid.getCellNode(row, 0)).removeClass('dirtyRowHeader');
|
jQuery(grid.getCellNode(row, 0)).removeClass('dirtyRowHeader');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets CSS to clean the entire grid of dirty state cells and rows
|
// Sets CSS to clean the entire grid of dirty state cells and rows
|
||||||
private setGridClean(): void {
|
private setGridClean(): void {
|
||||||
// Remove dirty classes from the entire table
|
// Remove dirty classes from the entire table
|
||||||
let allRows = $($('.grid-canvas').children());
|
let allRows = jQuery(jQuery('.grid-canvas').children());
|
||||||
let allCells = $(allRows.children());
|
let allCells = jQuery(allRows.children());
|
||||||
allCells.removeClass('dirtyCell').removeClass('dirtyRowHeader');
|
allCells.removeClass('dirtyCell').removeClass('dirtyRowHeader');
|
||||||
this.dirtyCells = [];
|
this.dirtyCells = [];
|
||||||
}
|
}
|
||||||
@@ -720,7 +720,7 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
|||||||
|
|
||||||
private setCurrentCell(row: number, column: number) {
|
private setCurrentCell(row: number, column: number) {
|
||||||
// Only update if we're actually changing cells
|
// Only update if we're actually changing cells
|
||||||
if(this.currentCell && (row !== this.currentCell.row || column !== this.currentCell.column)) {
|
if (this.currentCell && (row !== this.currentCell.row || column !== this.currentCell.column)) {
|
||||||
this.currentCell = {
|
this.currentCell = {
|
||||||
row: row,
|
row: row,
|
||||||
column: column,
|
column: column,
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ export abstract class GridParentComponent {
|
|||||||
|
|
||||||
private handleQueryPlanLink(cellRef: string, value: string): void {
|
private handleQueryPlanLink(cellRef: string, value: string): void {
|
||||||
const self = this;
|
const self = this;
|
||||||
$(cellRef).children('.xmlLink').click(function (): void {
|
jQuery(cellRef).children('.xmlLink').click(function (): void {
|
||||||
self.queryEditorService.newQueryPlanEditor(value);
|
self.queryEditorService.newQueryPlanEditor(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -527,7 +527,7 @@ export abstract class GridParentComponent {
|
|||||||
private handleLink(cellRef: string, row: number, dataContext: JSON, colDef: any, linkType: string): void {
|
private handleLink(cellRef: string, row: number, dataContext: JSON, colDef: any, linkType: string): void {
|
||||||
const self = this;
|
const self = this;
|
||||||
let value = self.getCellValueString(dataContext, colDef);
|
let value = self.getCellValueString(dataContext, colDef);
|
||||||
$(cellRef).children('.xmlLink').click(function (): void {
|
jQuery(cellRef).children('.xmlLink').click(function (): void {
|
||||||
self.dataService.openLink(value, colDef.name, linkType);
|
self.dataService.openLink(value, colDef.name, linkType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
|||||||
panelRows: 1
|
panelRows: 1
|
||||||
});
|
});
|
||||||
columns.unshift(rowDetail.getColumnDefinition());
|
columns.unshift(rowDetail.getColumnDefinition());
|
||||||
$(this._gridEl.nativeElement).empty();
|
jQuery(this._gridEl.nativeElement).empty();
|
||||||
$(this.actionBarContainer.nativeElement).empty();
|
jQuery(this.actionBarContainer.nativeElement).empty();
|
||||||
this.initActionBar();
|
this.initActionBar();
|
||||||
|
|
||||||
this._table = new Table(this._gridEl.nativeElement, { columns }, this.options);
|
this._table = new Table(this._gridEl.nativeElement, { columns }, this.options);
|
||||||
@@ -230,4 +230,4 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
|||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._commandService.executeCommand('agent.openAlertDialog', ownerUri, null, null);
|
this._commandService.executeCommand('agent.openAlertDialog', ownerUri, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ import { RunJobAction, StopJobAction, EditJobAction, JobsRefreshAction } from 's
|
|||||||
import { JobCacheObject } from 'sql/platform/jobManagement/common/jobManagementService';
|
import { JobCacheObject } from 'sql/platform/jobManagement/common/jobManagementService';
|
||||||
import { JobManagementUtilities } from 'sql/platform/jobManagement/common/jobManagementUtilities';
|
import { JobManagementUtilities } from 'sql/platform/jobManagement/common/jobManagementUtilities';
|
||||||
import { IJobManagementService } from 'sql/platform/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/platform/jobManagement/common/interfaces';
|
||||||
import { JobHistoryController, JobHistoryDataSource,
|
import {
|
||||||
JobHistoryRenderer, JobHistoryFilter, JobHistoryModel, JobHistoryRow } from 'sql/parts/jobManagement/views/jobHistoryTree';
|
JobHistoryController, JobHistoryDataSource,
|
||||||
|
JobHistoryRenderer, JobHistoryFilter, JobHistoryModel, JobHistoryRow
|
||||||
|
} from 'sql/parts/jobManagement/views/jobHistoryTree';
|
||||||
import { JobStepsViewRow } from 'sql/parts/jobManagement/views/jobStepsViewTree';
|
import { JobStepsViewRow } from 'sql/parts/jobManagement/views/jobStepsViewTree';
|
||||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||||
@@ -210,7 +212,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
|
|||||||
});
|
});
|
||||||
self._stepRows.unshift(new JobStepsViewRow());
|
self._stepRows.unshift(new JobStepsViewRow());
|
||||||
self._stepRows[0].rowID = 'stepsColumn' + self._agentJobInfo.jobId;
|
self._stepRows[0].rowID = 'stepsColumn' + self._agentJobInfo.jobId;
|
||||||
self._stepRows[0].stepId = nls.localize('stepRow.stepID','Step ID');
|
self._stepRows[0].stepId = nls.localize('stepRow.stepID', 'Step ID');
|
||||||
self._stepRows[0].stepName = nls.localize('stepRow.stepName', 'Step Name');
|
self._stepRows[0].stepName = nls.localize('stepRow.stepName', 'Step Name');
|
||||||
self._stepRows[0].message = nls.localize('stepRow.message', 'Message');
|
self._stepRows[0].message = nls.localize('stepRow.message', 'Message');
|
||||||
this._showSteps = self._stepRows.length > 1;
|
this._showSteps = self._stepRows.length > 1;
|
||||||
@@ -251,7 +253,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private toggleCollapse(): void {
|
private toggleCollapse(): void {
|
||||||
let arrow: HTMLElement = $('.resultsViewCollapsible').get(0);
|
let arrow: HTMLElement = jQuery('.resultsViewCollapsible').get(0);
|
||||||
let checkbox: any = document.getElementById('accordion');
|
let checkbox: any = document.getElementById('accordion');
|
||||||
if (arrow.className === 'resultsViewCollapsible' && checkbox.checked === false) {
|
if (arrow.className === 'resultsViewCollapsible' && checkbox.checked === false) {
|
||||||
arrow.className = 'resultsViewCollapsible collapsed';
|
arrow.className = 'resultsViewCollapsible collapsed';
|
||||||
@@ -318,8 +320,8 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
let historyDetails = $('.overview-container').get(0);
|
let historyDetails = jQuery('.overview-container').get(0);
|
||||||
let statusBar = $('.part.statusbar').get(0);
|
let statusBar = jQuery('.part.statusbar').get(0);
|
||||||
if (historyDetails && statusBar) {
|
if (historyDetails && statusBar) {
|
||||||
let historyBottom = historyDetails.getBoundingClientRect().bottom;
|
let historyBottom = historyDetails.getBoundingClientRect().bottom;
|
||||||
let statusTop = statusBar.getBoundingClientRect().top;
|
let statusTop = statusBar.getBoundingClientRect().top;
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ export class JobStepsViewComponent extends JobManagementView implements OnInit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentChecked() {
|
ngAfterContentChecked() {
|
||||||
$('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
jQuery('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
||||||
this.layout();
|
this.layout();
|
||||||
this._tree.onDidScroll(() => {
|
this._tree.onDidScroll(() => {
|
||||||
$('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
jQuery('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
||||||
});
|
});
|
||||||
this._treeController.onClick = (tree, element, event, origin = 'mouse') => {
|
this._treeController.onClick = (tree, element, event, origin = 'mouse') => {
|
||||||
const payload = { origin: origin };
|
const payload = { origin: origin };
|
||||||
@@ -80,12 +80,12 @@ export class JobStepsViewComponent extends JobManagementView implements OnInit,
|
|||||||
tree.setFocus(element, payload);
|
tree.setFocus(element, payload);
|
||||||
tree.setSelection([element], payload);
|
tree.setSelection([element], payload);
|
||||||
}
|
}
|
||||||
$('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
jQuery('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
this._treeController.onKeyDown = (tree, event) => {
|
this._treeController.onKeyDown = (tree, event) => {
|
||||||
this._treeController.onKeyDownWrapper(tree, event);
|
this._treeController.onKeyDownWrapper(tree, event);
|
||||||
$('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
jQuery('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
this._tree.onDidFocus(() => {
|
this._tree.onDidFocus(() => {
|
||||||
@@ -118,4 +118,3 @@ export class JobStepsViewComponent extends JobManagementView implements OnInit,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
let jobsViewToolbar = $('jobsview-component .agent-actionbar-container').get(0);
|
let jobsViewToolbar = jQuery('jobsview-component .agent-actionbar-container').get(0);
|
||||||
let statusBar = $('.part.statusbar').get(0);
|
let statusBar = jQuery('.part.statusbar').get(0);
|
||||||
if (jobsViewToolbar && statusBar) {
|
if (jobsViewToolbar && statusBar) {
|
||||||
let toolbarBottom = jobsViewToolbar.getBoundingClientRect().bottom + ACTIONBAR_PADDING;
|
let toolbarBottom = jobsViewToolbar.getBoundingClientRect().bottom + ACTIONBAR_PADDING;
|
||||||
let statusTop = statusBar.getBoundingClientRect().top;
|
let statusTop = statusBar.getBoundingClientRect().top;
|
||||||
@@ -181,8 +181,8 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
columns.unshift(this.rowDetail.getColumnDefinition());
|
columns.unshift(this.rowDetail.getColumnDefinition());
|
||||||
let filterPlugin = new HeaderFilter({}, this._themeService);
|
let filterPlugin = new HeaderFilter({}, this._themeService);
|
||||||
this.filterPlugin = filterPlugin;
|
this.filterPlugin = filterPlugin;
|
||||||
$(this._gridEl.nativeElement).empty();
|
jQuery(this._gridEl.nativeElement).empty();
|
||||||
$(this.actionBarContainer.nativeElement).empty();
|
jQuery(this.actionBarContainer.nativeElement).empty();
|
||||||
this.initActionBar();
|
this.initActionBar();
|
||||||
this._table = new Table(this._gridEl.nativeElement, { columns }, options);
|
this._table = new Table(this._gridEl.nativeElement, { columns }, options);
|
||||||
this._table.grid.setData(this.dataView, true);
|
this._table.grid.setData(this.dataView, true);
|
||||||
@@ -353,7 +353,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
|
|
||||||
this.expandJobs(start);
|
this.expandJobs(start);
|
||||||
// tooltip for job name
|
// tooltip for job name
|
||||||
$('.jobview-jobnamerow').hover(e => {
|
jQuery('.jobview-jobnamerow').hover(e => {
|
||||||
let currentTarget = e.currentTarget;
|
let currentTarget = e.currentTarget;
|
||||||
currentTarget.title = currentTarget.innerText;
|
currentTarget.title = currentTarget.innerText;
|
||||||
});
|
});
|
||||||
@@ -362,9 +362,9 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
this._table.grid.onColumnsResized.subscribe((e, data: any) => {
|
this._table.grid.onColumnsResized.subscribe((e, data: any) => {
|
||||||
let nameWidth: number = data.grid.getColumns()[1].width;
|
let nameWidth: number = data.grid.getColumns()[1].width;
|
||||||
// adjust job name when resized
|
// adjust job name when resized
|
||||||
$('#jobsDiv .jobview-grid .slick-cell.l1.r1 .jobview-jobnametext').css('width', `${nameWidth - 10}px`);
|
jQuery('#jobsDiv .jobview-grid .slick-cell.l1.r1 .jobview-jobnametext').css('width', `${nameWidth - 10}px`);
|
||||||
// adjust error message when resized
|
// adjust error message when resized
|
||||||
$('#jobsDiv .jobview-grid .slick-cell.l1.r1.error-row .jobview-jobnametext').css('width', '100%');
|
jQuery('#jobsDiv .jobview-grid .slick-cell.l1.r1.error-row .jobview-jobnametext').css('width', '100%');
|
||||||
|
|
||||||
// generate job charts again
|
// generate job charts again
|
||||||
self.jobs.forEach(job => {
|
self.jobs.forEach(job => {
|
||||||
@@ -376,11 +376,11 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#jobsDiv .jobview-grid .monaco-table .slick-viewport .grid-canvas .ui-widget-content.slick-row').hover((e1) =>
|
jQuery('#jobsDiv .jobview-grid .monaco-table .slick-viewport .grid-canvas .ui-widget-content.slick-row').hover((e1) =>
|
||||||
this.highlightErrorRows(e1), (e2) => this.hightlightNonErrorRows(e2));
|
this.highlightErrorRows(e1), (e2) => this.hightlightNonErrorRows(e2));
|
||||||
|
|
||||||
this._table.grid.onScroll.subscribe((e) => {
|
this._table.grid.onScroll.subscribe((e) => {
|
||||||
$('#jobsDiv .jobview-grid .monaco-table .slick-viewport .grid-canvas .ui-widget-content.slick-row').hover((e1) =>
|
jQuery('#jobsDiv .jobview-grid .monaco-table .slick-viewport .grid-canvas .ui-widget-content.slick-row').hover((e1) =>
|
||||||
this.highlightErrorRows(e1), (e2) => this.hightlightNonErrorRows(e2));
|
this.highlightErrorRows(e1), (e2) => this.hightlightNonErrorRows(e2));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -393,15 +393,15 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
private highlightErrorRows(e) {
|
private highlightErrorRows(e) {
|
||||||
// highlight the error row as well if a failing job row is hovered
|
// highlight the error row as well if a failing job row is hovered
|
||||||
if (e.currentTarget.children.item(0).classList.contains('job-with-error')) {
|
if (e.currentTarget.children.item(0).classList.contains('job-with-error')) {
|
||||||
let target = $(e.currentTarget);
|
let target = jQuery(e.currentTarget);
|
||||||
let targetChildren = $(e.currentTarget.children);
|
let targetChildren = jQuery(e.currentTarget.children);
|
||||||
let siblings = target.nextAll().toArray();
|
let siblings = target.nextAll().toArray();
|
||||||
let top = parseInt(target.css('top'), 10);
|
let top = parseInt(target.css('top'), 10);
|
||||||
for (let i = 0; i < siblings.length; i++) {
|
for (let i = 0; i < siblings.length; i++) {
|
||||||
let sibling = siblings[i];
|
let sibling = siblings[i];
|
||||||
let siblingTop = parseInt($(sibling).css('top'), 10);
|
let siblingTop = parseInt(jQuery(sibling).css('top'), 10);
|
||||||
if (siblingTop === top + ROW_HEIGHT) {
|
if (siblingTop === top + ROW_HEIGHT) {
|
||||||
$(sibling.children).addClass('hovered');
|
jQuery(sibling.children).addClass('hovered');
|
||||||
sibling.onmouseenter = (e) => {
|
sibling.onmouseenter = (e) => {
|
||||||
targetChildren.addClass('hovered');
|
targetChildren.addClass('hovered');
|
||||||
};
|
};
|
||||||
@@ -417,14 +417,14 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
private hightlightNonErrorRows(e) {
|
private hightlightNonErrorRows(e) {
|
||||||
// switch back to original background
|
// switch back to original background
|
||||||
if (e.currentTarget.children.item(0).classList.contains('job-with-error')) {
|
if (e.currentTarget.children.item(0).classList.contains('job-with-error')) {
|
||||||
let target = $(e.currentTarget);
|
let target = jQuery(e.currentTarget);
|
||||||
let siblings = target.nextAll().toArray();
|
let siblings = target.nextAll().toArray();
|
||||||
let top = parseInt(target.css('top'), 10);
|
let top = parseInt(target.css('top'), 10);
|
||||||
for (let i = 0; i < siblings.length; i++) {
|
for (let i = 0; i < siblings.length; i++) {
|
||||||
let sibling = siblings[i];
|
let sibling = siblings[i];
|
||||||
let siblingTop = parseInt($(sibling).css('top'), 10);
|
let siblingTop = parseInt(jQuery(sibling).css('top'), 10);
|
||||||
if (siblingTop === top + ROW_HEIGHT) {
|
if (siblingTop === top + ROW_HEIGHT) {
|
||||||
$(sibling.children).removeClass('hovered');
|
jQuery(sibling.children).removeClass('hovered');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -622,7 +622,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
let chartHeights = this.getChartHeights(jobHistories);
|
let chartHeights = this.getChartHeights(jobHistories);
|
||||||
let runCharts = [];
|
let runCharts = [];
|
||||||
for (let i = 0; i < chartHeights.length; i++) {
|
for (let i = 0; i < chartHeights.length; i++) {
|
||||||
let runGraph = $(`table.jobprevruns#${jobId} > tbody > tr > td > div.bar${i}`);
|
let runGraph = jQuery(`table.jobprevruns#${jobId} > tbody > tr > td > div.bar${i}`);
|
||||||
if (runGraph.length > 0) {
|
if (runGraph.length > 0) {
|
||||||
runGraph.css('height', chartHeights[i]);
|
runGraph.css('height', chartHeights[i]);
|
||||||
let bgColor = jobHistories[i].runStatus === 0 ? 'red' : 'green';
|
let bgColor = jobHistories[i].runStatus === 0 ? 'red' : 'green';
|
||||||
@@ -842,9 +842,9 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
let bgColor = theme.getColor(tableBackground);
|
let bgColor = theme.getColor(tableBackground);
|
||||||
let cellColor = theme.getColor(cellBackground);
|
let cellColor = theme.getColor(cellBackground);
|
||||||
let borderColor = theme.getColor(cellBorderColor);
|
let borderColor = theme.getColor(cellBorderColor);
|
||||||
let headerColumns = $('#agentViewDiv .slick-header-column');
|
let headerColumns = jQuery('#agentViewDiv .slick-header-column');
|
||||||
let cells = $('.grid-canvas .ui-widget-content.slick-row .slick-cell');
|
let cells = jQuery('.grid-canvas .ui-widget-content.slick-row .slick-cell');
|
||||||
let cellDetails = $('#jobsDiv .dynamic-cell-detail');
|
let cellDetails = jQuery('#jobsDiv .dynamic-cell-detail');
|
||||||
headerColumns.toArray().forEach(col => {
|
headerColumns.toArray().forEach(col => {
|
||||||
col.style.background = bgColor.toString();
|
col.style.background = bgColor.toString();
|
||||||
});
|
});
|
||||||
@@ -952,4 +952,4 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
await this._commandService.executeCommand('agent.openJobDialog', ownerUri);
|
await this._commandService.executeCommand('agent.openJobDialog', ownerUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit,
|
|||||||
});
|
});
|
||||||
columns.unshift(rowDetail.getColumnDefinition());
|
columns.unshift(rowDetail.getColumnDefinition());
|
||||||
|
|
||||||
$(this._gridEl.nativeElement).empty();
|
jQuery(this._gridEl.nativeElement).empty();
|
||||||
$(this.actionBarContainer.nativeElement).empty();
|
jQuery(this.actionBarContainer.nativeElement).empty();
|
||||||
this.initActionBar();
|
this.initActionBar();
|
||||||
this._table = new Table(this._gridEl.nativeElement, { columns }, this.options);
|
this._table = new Table(this._gridEl.nativeElement, { columns }, this.options);
|
||||||
this._table.grid.setData(this.dataView, true);
|
this._table.grid.setData(this.dataView, true);
|
||||||
@@ -226,4 +226,4 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit,
|
|||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._commandService.executeCommand('agent.openOperatorDialog', ownerUri);
|
this._commandService.executeCommand('agent.openOperatorDialog', ownerUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit, O
|
|||||||
});
|
});
|
||||||
columns.unshift(rowDetail.getColumnDefinition());
|
columns.unshift(rowDetail.getColumnDefinition());
|
||||||
|
|
||||||
$(this._gridEl.nativeElement).empty();
|
jQuery(this._gridEl.nativeElement).empty();
|
||||||
$(this.actionBarContainer.nativeElement).empty();
|
jQuery(this.actionBarContainer.nativeElement).empty();
|
||||||
this.initActionBar();
|
this.initActionBar();
|
||||||
this._table = new Table(this._gridEl.nativeElement, { columns }, this.options);
|
this._table = new Table(this._gridEl.nativeElement, { columns }, this.options);
|
||||||
this._table.grid.setData(this.dataView, true);
|
this._table.grid.setData(this.dataView, true);
|
||||||
@@ -234,4 +234,4 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit, O
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,50 +6,38 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||||
import { Button } from 'sql/base/browser/ui/button/button';
|
import { Button } from 'sql/base/browser/ui/button/button';
|
||||||
|
import { append, $, addClass, addClasses } from 'vs/base/browser/dom';
|
||||||
|
|
||||||
import { Builder } from 'sql/base/browser/builder';
|
|
||||||
import * as types from 'vs/base/common/types';
|
import * as types from 'vs/base/common/types';
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
|
|
||||||
export function appendRow(container: Builder, label: string, labelClass: string, cellContainerClass: string, rowContainerClass?: string): Builder {
|
export function appendRow(container: HTMLElement, label: string, labelClass: string, cellContainerClass: string, rowContainerClass?: string | Array<string>): HTMLElement {
|
||||||
let cellContainer: Builder;
|
let rowContainer = append(container, $('tr'));
|
||||||
let rowAttributes = rowContainerClass ? { class: rowContainerClass } : {};
|
if (rowContainerClass) {
|
||||||
container.element('tr', rowAttributes, (rowContainer) => {
|
if (types.isString(rowContainerClass)) {
|
||||||
rowContainer.element('td', { class: labelClass }, (labelCellContainer) => {
|
addClass(rowContainer, rowContainerClass);
|
||||||
labelCellContainer.div({}, (labelContainer) => {
|
} else {
|
||||||
labelContainer.text(label);
|
addClasses(rowContainer, ...rowContainerClass);
|
||||||
});
|
}
|
||||||
});
|
}
|
||||||
rowContainer.element('td', { class: cellContainerClass }, (inputCellContainer) => {
|
append(append(rowContainer, $(`td.${labelClass}`)), $('div')).innerText = label;
|
||||||
cellContainer = inputCellContainer;
|
let inputCellContainer = append(rowContainer, $(`td.${cellContainerClass}`));
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return cellContainer;
|
return inputCellContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function appendRowLink(container: Builder, label: string, labelClass: string, cellContainerClass: string): Builder {
|
export function appendRowLink(container: HTMLElement, label: string, labelClass: string, cellContainerClass: string): HTMLElement {
|
||||||
let rowButton: Button;
|
let rowContainer = append(container, $('tr'));
|
||||||
container.element('tr', {}, (rowContainer) => {
|
append(append(rowContainer, $(`td.${labelClass}`)), $('div')).innerText = label;
|
||||||
rowContainer.element('td', { class: labelClass }, (labelCellContainer) => {
|
let buttonContainer = append(append(rowContainer, $(`td.${cellContainerClass}`)), $('div'));
|
||||||
labelCellContainer.div({}, (labelContainer) => {
|
let rowButton = new Button(buttonContainer);
|
||||||
labelContainer.text(label);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
rowContainer.element('td', { class: cellContainerClass }, (inputCellContainer) => {
|
|
||||||
inputCellContainer.element('div', {}, (rowContainer) => {
|
|
||||||
rowButton = new Button(rowContainer.getHTMLElement());
|
|
||||||
|
|
||||||
});
|
return rowButton.element;
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Builder(rowButton.element);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function appendInputSelectBox(container: Builder, selectBox: SelectBox): SelectBox {
|
export function appendInputSelectBox(container: HTMLElement, selectBox: SelectBox): SelectBox {
|
||||||
selectBox.render(container.getHTMLElement());
|
selectBox.render(container);
|
||||||
return selectBox;
|
return selectBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,4 +68,4 @@ export function getCategoryName(categories: azdata.CategoryValue[], categoryDisp
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return categoryName;
|
return categoryName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import { IWorkbenchThemeService, IColorTheme } from 'vs/workbench/services/theme
|
|||||||
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||||
import * as styler from 'vs/platform/theme/common/styler';
|
import * as styler from 'vs/platform/theme/common/styler';
|
||||||
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 { Widget } from 'vs/base/browser/ui/widget';
|
import { Widget } from 'vs/base/browser/ui/widget';
|
||||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||||
import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
|
import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||||
@@ -34,6 +33,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
|||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||||
|
import { append, $ } from 'vs/base/browser/dom';
|
||||||
|
|
||||||
export class CategoryView extends ViewletPanel {
|
export class CategoryView extends ViewletPanel {
|
||||||
|
|
||||||
@@ -68,9 +68,9 @@ export interface IOptionsDialogOptions extends IModalOptions {
|
|||||||
export class OptionsDialog extends Modal {
|
export class OptionsDialog extends Modal {
|
||||||
private _body: HTMLElement;
|
private _body: HTMLElement;
|
||||||
private _optionGroups: HTMLElement;
|
private _optionGroups: HTMLElement;
|
||||||
private _dividerBuilder: Builder;
|
private _dividerBuilder: HTMLElement;
|
||||||
private _optionTitle: Builder;
|
private _optionTitle: HTMLElement;
|
||||||
private _optionDescription: Builder;
|
private _optionDescription: HTMLElement;
|
||||||
private _optionElements: { [optionName: string]: OptionsDialogHelper.IOptionElement } = {};
|
private _optionElements: { [optionName: string]: OptionsDialogHelper.IOptionElement } = {};
|
||||||
private _optionValues: { [optionName: string]: string };
|
private _optionValues: { [optionName: string]: string };
|
||||||
private _optionRowSize = 31;
|
private _optionRowSize = 31;
|
||||||
@@ -116,23 +116,14 @@ export class OptionsDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected renderBody(container: HTMLElement) {
|
protected renderBody(container: HTMLElement) {
|
||||||
new Builder(container).div({ class: 'optionsDialog-options' }, (bodyBuilder) => {
|
this._body = append(container, $('div.optionsDialog-options'));
|
||||||
this._body = bodyBuilder.getHTMLElement();
|
|
||||||
});
|
|
||||||
|
|
||||||
let builder = new Builder(this._body);
|
this._dividerBuilder = append(this._body, $('div'));
|
||||||
builder.div({}, (dividerContainer) => {
|
|
||||||
this._dividerBuilder = dividerContainer;
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.div({ class: 'optionsDialog-description' }, (descriptionContainer) => {
|
let descriptionContainer = append(this._body, $('div.optionsDialog-description'));
|
||||||
descriptionContainer.div({ class: 'modal-title' }, (optionTitle) => {
|
|
||||||
this._optionTitle = optionTitle;
|
this._optionTitle = append(descriptionContainer, $('div.modal-title'));
|
||||||
});
|
this._optionDescription = append(descriptionContainer, $('div.optionsDialog-description-content'));
|
||||||
descriptionContainer.div({ class: 'optionsDialog-description-content' }, (optionDescription) => {
|
|
||||||
this._optionDescription = optionDescription;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update theming that is specific to options dialog flyout body
|
// Update theming that is specific to options dialog flyout body
|
||||||
@@ -140,19 +131,19 @@ export class OptionsDialog extends Modal {
|
|||||||
let borderColor = theme.getColor(contrastBorder);
|
let borderColor = theme.getColor(contrastBorder);
|
||||||
let border = borderColor ? borderColor.toString() : null;
|
let border = borderColor ? borderColor.toString() : null;
|
||||||
if (this._dividerBuilder) {
|
if (this._dividerBuilder) {
|
||||||
this._dividerBuilder.style('border-top-width', border ? '1px' : null);
|
this._dividerBuilder.style.borderTopWidth = border ? '1px' : null;
|
||||||
this._dividerBuilder.style('border-top-style', border ? 'solid' : null);
|
this._dividerBuilder.style.borderTopStyle = border ? 'solid' : null;
|
||||||
this._dividerBuilder.style('border-top-color', border);
|
this._dividerBuilder.style.borderTopColor = border;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onOptionLinkClicked(optionName: string): void {
|
private onOptionLinkClicked(optionName: string): void {
|
||||||
let option = this._optionElements[optionName].option;
|
let option = this._optionElements[optionName].option;
|
||||||
this._optionTitle.text(option.displayName);
|
this._optionTitle.innerText = option.displayName;
|
||||||
this._optionDescription.text(option.description);
|
this._optionDescription.innerText = option.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private fillInOptions(container: Builder, options: azdata.ServiceOption[]): void {
|
private fillInOptions(container: HTMLElement, options: azdata.ServiceOption[]): void {
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
let option: azdata.ServiceOption = options[i];
|
let option: azdata.ServiceOption = options[i];
|
||||||
let rowContainer = DialogHelper.appendRow(container, option.displayName, 'optionsDialog-label', 'optionsDialog-input');
|
let rowContainer = DialogHelper.appendRow(container, option.displayName, 'optionsDialog-label', 'optionsDialog-input');
|
||||||
@@ -226,21 +217,16 @@ export class OptionsDialog extends Modal {
|
|||||||
public open(options: azdata.ServiceOption[], optionValues: { [name: string]: any }) {
|
public open(options: azdata.ServiceOption[], optionValues: { [name: string]: any }) {
|
||||||
this._optionValues = optionValues;
|
this._optionValues = optionValues;
|
||||||
let firstOption: string;
|
let firstOption: string;
|
||||||
let containerGroup: Builder;
|
this._optionGroups = $('div.optionsDialog-options-groups.monaco-panel-view');
|
||||||
let optionsContentBuilder: Builder = $().div({ class: 'optionsDialog-options-groups monaco-panel-view' }, (container) => {
|
this.splitview = new ScrollableSplitView(this._optionGroups, { enableResizing: false, scrollDebounce: 0 });
|
||||||
containerGroup = container;
|
|
||||||
this._optionGroups = container.getHTMLElement();
|
|
||||||
});
|
|
||||||
this.splitview = new ScrollableSplitView(containerGroup.getHTMLElement(), { enableResizing: false, scrollDebounce: 0 });
|
|
||||||
let categoryMap = OptionsDialogHelper.groupOptionsByCategory(options);
|
let categoryMap = OptionsDialogHelper.groupOptionsByCategory(options);
|
||||||
for (let category in categoryMap) {
|
for (let category in categoryMap) {
|
||||||
let serviceOptions: azdata.ServiceOption[] = categoryMap[category];
|
let serviceOptions: azdata.ServiceOption[] = categoryMap[category];
|
||||||
let bodyContainer = $().element('table', { class: 'optionsDialog-table' }, (tableContainer: Builder) => {
|
let bodyContainer = $('table.optionsDialog-table');
|
||||||
this.fillInOptions(tableContainer, serviceOptions);
|
this.fillInOptions(bodyContainer, serviceOptions);
|
||||||
});
|
|
||||||
|
|
||||||
let viewSize = this._optionCategoryPadding + serviceOptions.length * this._optionRowSize;
|
let viewSize = this._optionCategoryPadding + serviceOptions.length * this._optionRowSize;
|
||||||
let categoryView = this._instantiationService.createInstance(CategoryView, bodyContainer.getHTMLElement(), viewSize, { title: category, ariaHeaderLabel: category, id: category });
|
let categoryView = this._instantiationService.createInstance(CategoryView, bodyContainer, viewSize, { title: category, ariaHeaderLabel: category, id: category });
|
||||||
this.splitview.addView(categoryView, viewSize);
|
this.splitview.addView(categoryView, viewSize);
|
||||||
categoryView.render();
|
categoryView.render();
|
||||||
attachPanelStyler(categoryView, this._themeService);
|
attachPanelStyler(categoryView, this._themeService);
|
||||||
@@ -252,8 +238,7 @@ export class OptionsDialog extends Modal {
|
|||||||
if (this.height) {
|
if (this.height) {
|
||||||
this.splitview.layout(this.height - 120);
|
this.splitview.layout(this.height - 120);
|
||||||
}
|
}
|
||||||
let body = new Builder(this._body);
|
append(this._body, this._optionGroups);
|
||||||
body.append(optionsContentBuilder.getHTMLElement(), 0);
|
|
||||||
this.show();
|
this.show();
|
||||||
let firstOptionWidget = this._optionElements[firstOption].optionWidget;
|
let firstOptionWidget = this._optionElements[firstOption].optionWidget;
|
||||||
this.registerStyling();
|
this.registerStyling();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import * as DialogHelper from './dialogHelper';
|
import * as DialogHelper from './dialogHelper';
|
||||||
import { Builder } from 'sql/base/browser/builder';
|
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||||
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||||
@@ -22,7 +21,7 @@ export interface IOptionElement {
|
|||||||
optionValue: any;
|
optionValue: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOptionElement(option: azdata.ServiceOption, rowContainer: Builder, options: { [name: string]: any },
|
export function createOptionElement(option: azdata.ServiceOption, rowContainer: HTMLElement, options: { [name: string]: any },
|
||||||
optionsMap: { [optionName: string]: IOptionElement }, contextViewService: IContextViewService, onFocus: (name) => void): void {
|
optionsMap: { [optionName: string]: IOptionElement }, contextViewService: IContextViewService, onFocus: (name) => void): void {
|
||||||
let possibleInputs: string[] = [];
|
let possibleInputs: string[] = [];
|
||||||
let optionValue = getOptionValueAndCategoryValues(option, options, possibleInputs);
|
let optionValue = getOptionValueAndCategoryValues(option, options, possibleInputs);
|
||||||
@@ -32,7 +31,7 @@ export function createOptionElement(option: azdata.ServiceOption, rowContainer:
|
|||||||
let invalidInputMessage = localize('optionsDialog.invalidInput', 'Invalid input. Numeric value expected.');
|
let invalidInputMessage = localize('optionsDialog.invalidInput', 'Invalid input. Numeric value expected.');
|
||||||
|
|
||||||
if (option.valueType === ServiceOptionType.number) {
|
if (option.valueType === ServiceOptionType.number) {
|
||||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
optionWidget = new InputBox(rowContainer, contextViewService, {
|
||||||
validationOptions: {
|
validationOptions: {
|
||||||
validation: (value: string) => {
|
validation: (value: string) => {
|
||||||
if (!value && option.isRequired) {
|
if (!value && option.isRequired) {
|
||||||
@@ -53,7 +52,7 @@ export function createOptionElement(option: azdata.ServiceOption, rowContainer:
|
|||||||
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
||||||
inputElement = findElement(rowContainer, 'monaco-select-box');
|
inputElement = findElement(rowContainer, 'monaco-select-box');
|
||||||
} else if (option.valueType === ServiceOptionType.string || option.valueType === ServiceOptionType.password) {
|
} else if (option.valueType === ServiceOptionType.string || option.valueType === ServiceOptionType.password) {
|
||||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
optionWidget = new InputBox(rowContainer, contextViewService, {
|
||||||
validationOptions: {
|
validationOptions: {
|
||||||
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
||||||
},
|
},
|
||||||
@@ -149,16 +148,16 @@ export function updateOptions(options: { [optionName: string]: any }, optionsMap
|
|||||||
export let trueInputValue: string = 'True';
|
export let trueInputValue: string = 'True';
|
||||||
export let falseInputValue: string = 'False';
|
export let falseInputValue: string = 'False';
|
||||||
|
|
||||||
export function findElement(container: Builder, className: string): HTMLElement {
|
export function findElement(container: HTMLElement, className: string): HTMLElement {
|
||||||
var elementBuilder: Builder = container;
|
var elementBuilder = container;
|
||||||
while (elementBuilder.getHTMLElement()) {
|
while (elementBuilder) {
|
||||||
var htmlElement = elementBuilder.getHTMLElement();
|
var htmlElement = elementBuilder;
|
||||||
if (htmlElement.className.startsWith(className)) {
|
if (htmlElement.className.startsWith(className)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
elementBuilder = elementBuilder.child(0);
|
elementBuilder = elementBuilder.firstChild as HTMLElement;
|
||||||
}
|
}
|
||||||
return elementBuilder.getHTMLElement();
|
return elementBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function groupOptionsByCategory(options: azdata.ServiceOption[]): { [category: string]: azdata.ServiceOption[] } {
|
export function groupOptionsByCategory(options: azdata.ServiceOption[]): { [category: string]: azdata.ServiceOption[] } {
|
||||||
@@ -176,4 +175,4 @@ export function groupOptionsByCategory(options: azdata.ServiceOption[]): { [cate
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return connectionOptionsMap;
|
return connectionOptionsMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
this._bodyBuilder.div({ class: 'connection-type' }, (modelTableContent) => {
|
this._bodyBuilder.div({ class: 'connection-type' }, (modelTableContent) => {
|
||||||
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
||||||
DialogHelper.appendInputSelectBox(
|
DialogHelper.appendInputSelectBox(
|
||||||
DialogHelper.appendRow(tableContainer, connectTypeLabel, 'connection-label', 'connection-input'), this._providerTypeSelectBox);
|
DialogHelper.appendRow(tableContainer.getHTMLElement(), connectTypeLabel, 'connection-label', 'connection-input'), this._providerTypeSelectBox);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,13 @@ import { localize } from 'vs/nls';
|
|||||||
import * as DOM from 'vs/base/browser/dom';
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
import { OS, OperatingSystem } from 'vs/base/common/platform';
|
import { OS, OperatingSystem } from 'vs/base/common/platform';
|
||||||
import { Builder, $ } from 'sql/base/browser/builder';
|
|
||||||
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
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';
|
||||||
|
|
||||||
export class ConnectionWidget {
|
export class ConnectionWidget {
|
||||||
private _builder: Builder;
|
private _container: HTMLElement;
|
||||||
private _serverGroupSelectBox: SelectBox;
|
private _serverGroupSelectBox: SelectBox;
|
||||||
private _previousGroupOption: string;
|
private _previousGroupOption: string;
|
||||||
private _serverGroupOptions: IConnectionProfileGroup[];
|
private _serverGroupOptions: IConnectionProfileGroup[];
|
||||||
@@ -52,7 +51,7 @@ export class ConnectionWidget {
|
|||||||
private _rememberPasswordCheckBox: Checkbox;
|
private _rememberPasswordCheckBox: Checkbox;
|
||||||
private _azureAccountDropdown: SelectBox;
|
private _azureAccountDropdown: SelectBox;
|
||||||
private _azureTenantDropdown: SelectBox;
|
private _azureTenantDropdown: SelectBox;
|
||||||
private _refreshCredentialsLinkBuilder: Builder;
|
private _refreshCredentialsLink: HTMLLinkElement;
|
||||||
private _addAzureAccountMessage: string = localize('connectionWidget.AddAzureAccount', 'Add an account...');
|
private _addAzureAccountMessage: string = localize('connectionWidget.AddAzureAccount', 'Add an account...');
|
||||||
private readonly _azureProviderId = 'azurePublicCloud';
|
private readonly _azureProviderId = 'azurePublicCloud';
|
||||||
private _azureTenantId: string;
|
private _azureTenantId: string;
|
||||||
@@ -62,7 +61,7 @@ export class ConnectionWidget {
|
|||||||
private _authTypeSelectBox: SelectBox;
|
private _authTypeSelectBox: SelectBox;
|
||||||
private _toDispose: lifecycle.IDisposable[];
|
private _toDispose: lifecycle.IDisposable[];
|
||||||
private _optionsMaps: { [optionType: number]: azdata.ConnectionOption };
|
private _optionsMaps: { [optionType: number]: azdata.ConnectionOption };
|
||||||
private _tableContainer: Builder;
|
private _tableContainer: HTMLElement;
|
||||||
private _focusedBeforeHandleOnConnection: HTMLElement;
|
private _focusedBeforeHandleOnConnection: HTMLElement;
|
||||||
private _providerName: string;
|
private _providerName: string;
|
||||||
private _authTypeMap: { [providerName: string]: AuthenticationType[] } = {
|
private _authTypeMap: { [providerName: string]: AuthenticationType[] } = {
|
||||||
@@ -130,11 +129,8 @@ export class ConnectionWidget {
|
|||||||
this._serverGroupOptions = [this.DefaultServerGroup];
|
this._serverGroupOptions = [this.DefaultServerGroup];
|
||||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService, undefined, { ariaLabel: this._serverGroupDisplayString });
|
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService, undefined, { ariaLabel: this._serverGroupDisplayString });
|
||||||
this._previousGroupOption = this._serverGroupSelectBox.value;
|
this._previousGroupOption = this._serverGroupSelectBox.value;
|
||||||
this._builder = $().div({ class: 'connection-table' }, (modelTableContent) => {
|
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||||
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||||
this._tableContainer = tableContainer;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.fillInConnectionForm();
|
this.fillInConnectionForm();
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
if (this._authTypeSelectBox) {
|
if (this._authTypeSelectBox) {
|
||||||
@@ -144,8 +140,6 @@ export class ConnectionWidget {
|
|||||||
DOM.addDisposableListener(container, 'paste', e => {
|
DOM.addDisposableListener(container, 'paste', e => {
|
||||||
this._handleClipboard();
|
this._handleClipboard();
|
||||||
});
|
});
|
||||||
|
|
||||||
DOM.append(container, this._builder.getHTMLElement());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleClipboard(): void {
|
private _handleClipboard(): void {
|
||||||
@@ -166,8 +160,8 @@ export class ConnectionWidget {
|
|||||||
private fillInConnectionForm(): void {
|
private fillInConnectionForm(): void {
|
||||||
// Server name
|
// Server name
|
||||||
let serverNameOption = this._optionsMaps[ConnectionOptionSpecialType.serverName];
|
let serverNameOption = this._optionsMaps[ConnectionOptionSpecialType.serverName];
|
||||||
let serverNameBuilder = DialogHelper.appendRow(this._tableContainer, serverNameOption.displayName, 'connection-label', 'connection-input');
|
let serverName = DialogHelper.appendRow(this._tableContainer, serverNameOption.displayName, 'connection-label', 'connection-input');
|
||||||
this._serverNameInputBox = new InputBox(serverNameBuilder.getHTMLElement(), this._contextViewService, {
|
this._serverNameInputBox = new InputBox(serverName, this._contextViewService, {
|
||||||
validationOptions: {
|
validationOptions: {
|
||||||
validation: (value: string) => {
|
validation: (value: string) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
@@ -183,15 +177,15 @@ export class ConnectionWidget {
|
|||||||
|
|
||||||
// Authentication type
|
// Authentication type
|
||||||
if (this._optionsMaps[ConnectionOptionSpecialType.authType]) {
|
if (this._optionsMaps[ConnectionOptionSpecialType.authType]) {
|
||||||
let authTypeBuilder = DialogHelper.appendRow(this._tableContainer, this._optionsMaps[ConnectionOptionSpecialType.authType].displayName, 'connection-label', 'connection-input');
|
let authType = DialogHelper.appendRow(this._tableContainer, this._optionsMaps[ConnectionOptionSpecialType.authType].displayName, 'connection-label', 'connection-input');
|
||||||
DialogHelper.appendInputSelectBox(authTypeBuilder, this._authTypeSelectBox);
|
DialogHelper.appendInputSelectBox(authType, this._authTypeSelectBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Username
|
// Username
|
||||||
let self = this;
|
let self = this;
|
||||||
let userNameOption = this._optionsMaps[ConnectionOptionSpecialType.userName];
|
let userNameOption = this._optionsMaps[ConnectionOptionSpecialType.userName];
|
||||||
let userNameBuilder = DialogHelper.appendRow(this._tableContainer, userNameOption.displayName, 'connection-label', 'connection-input', 'username-password-row');
|
let userName = DialogHelper.appendRow(this._tableContainer, userNameOption.displayName, 'connection-label', 'connection-input', 'username-password-row');
|
||||||
this._userNameInputBox = new InputBox(userNameBuilder.getHTMLElement(), this._contextViewService, {
|
this._userNameInputBox = new InputBox(userName, this._contextViewService, {
|
||||||
validationOptions: {
|
validationOptions: {
|
||||||
validation: (value: string) => self.validateUsername(value, userNameOption.isRequired) ? ({ type: MessageType.ERROR, content: localize('connectionWidget.missingRequireField', '{0} is required.', userNameOption.displayName) }) : null
|
validation: (value: string) => self.validateUsername(value, userNameOption.isRequired) ? ({ type: MessageType.ERROR, content: localize('connectionWidget.missingRequireField', '{0} is required.', userNameOption.displayName) }) : null
|
||||||
},
|
},
|
||||||
@@ -199,34 +193,36 @@ export class ConnectionWidget {
|
|||||||
});
|
});
|
||||||
// Password
|
// Password
|
||||||
let passwordOption = this._optionsMaps[ConnectionOptionSpecialType.password];
|
let passwordOption = this._optionsMaps[ConnectionOptionSpecialType.password];
|
||||||
let passwordBuilder = DialogHelper.appendRow(this._tableContainer, passwordOption.displayName, 'connection-label', 'connection-input', 'username-password-row');
|
let password = DialogHelper.appendRow(this._tableContainer, passwordOption.displayName, 'connection-label', 'connection-input', 'username-password-row');
|
||||||
this._passwordInputBox = new InputBox(passwordBuilder.getHTMLElement(), this._contextViewService, { ariaLabel: passwordOption.displayName });
|
this._passwordInputBox = new InputBox(password, this._contextViewService, { ariaLabel: passwordOption.displayName });
|
||||||
this._passwordInputBox.inputElement.type = 'password';
|
this._passwordInputBox.inputElement.type = 'password';
|
||||||
this._password = '';
|
this._password = '';
|
||||||
|
|
||||||
// Remember password
|
// Remember password
|
||||||
let rememberPasswordLabel = localize('rememberPassword', 'Remember password');
|
let rememberPasswordLabel = localize('rememberPassword', 'Remember password');
|
||||||
this._rememberPasswordCheckBox = this.appendCheckbox(this._tableContainer, rememberPasswordLabel, 'connection-checkbox', 'connection-input', 'username-password-row', false);
|
this._rememberPasswordCheckBox = this.appendCheckbox(this._tableContainer, rememberPasswordLabel, 'connection-input', 'username-password-row', false);
|
||||||
|
|
||||||
// Azure account picker
|
// Azure account picker
|
||||||
let accountLabel = localize('connection.azureAccountDropdownLabel', 'Account');
|
let accountLabel = localize('connection.azureAccountDropdownLabel', 'Account');
|
||||||
let accountDropdownBuilder = DialogHelper.appendRow(this._tableContainer, accountLabel, 'connection-label', 'connection-input', 'azure-account-row');
|
let accountDropdown = DialogHelper.appendRow(this._tableContainer, accountLabel, 'connection-label', 'connection-input', 'azure-account-row');
|
||||||
this._azureAccountDropdown = new SelectBox([], undefined, this._contextViewService, accountDropdownBuilder.getContainer(), { ariaLabel: accountLabel });
|
this._azureAccountDropdown = new SelectBox([], undefined, this._contextViewService, accountDropdown, { ariaLabel: accountLabel });
|
||||||
DialogHelper.appendInputSelectBox(accountDropdownBuilder, this._azureAccountDropdown);
|
DialogHelper.appendInputSelectBox(accountDropdown, this._azureAccountDropdown);
|
||||||
let refreshCredentialsBuilder = DialogHelper.appendRow(this._tableContainer, '', 'connection-label', 'connection-input', 'azure-account-row refresh-credentials-link');
|
let refreshCredentials = DialogHelper.appendRow(this._tableContainer, '', 'connection-label', 'connection-input', ['azure-account-row', 'refresh-credentials-link']);
|
||||||
this._refreshCredentialsLinkBuilder = refreshCredentialsBuilder.a({ href: '#' }).text(localize('connectionWidget.refreshAzureCredentials', 'Refresh account credentials'));
|
this._refreshCredentialsLink = DOM.append(refreshCredentials, DOM.$('a'));
|
||||||
|
this._refreshCredentialsLink.href = '#';
|
||||||
|
this._refreshCredentialsLink.innerText = localize('connectionWidget.refreshAzureCredentials', 'Refresh account credentials');
|
||||||
|
|
||||||
// Azure tenant picker
|
// Azure tenant picker
|
||||||
let tenantLabel = localize('connection.azureTenantDropdownLabel', 'Azure AD tenant');
|
let tenantLabel = localize('connection.azureTenantDropdownLabel', 'Azure AD tenant');
|
||||||
let tenantDropdownBuilder = DialogHelper.appendRow(this._tableContainer, tenantLabel, 'connection-label', 'connection-input', 'azure-account-row azure-tenant-row');
|
let tenantDropdown = DialogHelper.appendRow(this._tableContainer, tenantLabel, 'connection-label', 'connection-input', ['azure-account-row', 'azure-tenant-row']);
|
||||||
this._azureTenantDropdown = new SelectBox([], undefined, this._contextViewService, tenantDropdownBuilder.getContainer(), { ariaLabel: tenantLabel });
|
this._azureTenantDropdown = new SelectBox([], undefined, this._contextViewService, tenantDropdown, { ariaLabel: tenantLabel });
|
||||||
DialogHelper.appendInputSelectBox(tenantDropdownBuilder, this._azureTenantDropdown);
|
DialogHelper.appendInputSelectBox(tenantDropdown, this._azureTenantDropdown);
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
let databaseOption = this._optionsMaps[ConnectionOptionSpecialType.databaseName];
|
let databaseOption = this._optionsMaps[ConnectionOptionSpecialType.databaseName];
|
||||||
let databaseNameBuilder = 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(databaseNameBuilder.getHTMLElement(), this._contextViewService, {
|
this._databaseNameInputBox = new Dropdown(databaseName, this._contextViewService, {
|
||||||
values: [this._defaultDatabaseName, this._loadingDatabaseName],
|
values: [this._defaultDatabaseName, this._loadingDatabaseName],
|
||||||
strictSelection: false,
|
strictSelection: false,
|
||||||
placeholder: this._defaultDatabaseName,
|
placeholder: this._defaultDatabaseName,
|
||||||
@@ -236,13 +232,13 @@ export class ConnectionWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Server group
|
// Server group
|
||||||
let serverGroupBuilder = DialogHelper.appendRow(this._tableContainer, this._serverGroupDisplayString, 'connection-label', 'connection-input');
|
let serverGroup = DialogHelper.appendRow(this._tableContainer, this._serverGroupDisplayString, 'connection-label', 'connection-input');
|
||||||
DialogHelper.appendInputSelectBox(serverGroupBuilder, this._serverGroupSelectBox);
|
DialogHelper.appendInputSelectBox(serverGroup, this._serverGroupSelectBox);
|
||||||
|
|
||||||
// Connection name
|
// Connection name
|
||||||
let connectionNameOption = this._optionsMaps[ConnectionOptionSpecialType.connectionName];
|
let connectionNameOption = this._optionsMaps[ConnectionOptionSpecialType.connectionName];
|
||||||
let connectionNameBuilder = DialogHelper.appendRow(this._tableContainer, connectionNameOption.displayName, 'connection-label', 'connection-input');
|
let connectionNameBuilder = DialogHelper.appendRow(this._tableContainer, connectionNameOption.displayName, 'connection-label', 'connection-input');
|
||||||
this._connectionNameInputBox = new InputBox(connectionNameBuilder.getHTMLElement(), this._contextViewService, { ariaLabel: connectionNameOption.displayName });
|
this._connectionNameInputBox = new InputBox(connectionNameBuilder, this._contextViewService, { ariaLabel: connectionNameOption.displayName });
|
||||||
|
|
||||||
let AdvancedLabel = localize('advanced', 'Advanced...');
|
let AdvancedLabel = localize('advanced', 'Advanced...');
|
||||||
this._advancedButton = this.createAdvancedButton(this._tableContainer, AdvancedLabel);
|
this._advancedButton = this.createAdvancedButton(this._tableContainer, AdvancedLabel);
|
||||||
@@ -258,33 +254,26 @@ export class ConnectionWidget {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createAdvancedButton(container: Builder, title: string): Button {
|
private createAdvancedButton(container: HTMLElement, title: string): Button {
|
||||||
let button;
|
let rowContainer = DOM.append(container, DOM.$('tr'));
|
||||||
container.element('tr', {}, (rowContainer) => {
|
DOM.append(rowContainer, DOM.$('td'));
|
||||||
rowContainer.element('td');
|
let cellContainer = DOM.append(rowContainer, DOM.$('td'));
|
||||||
rowContainer.element('td', { align: 'right' }, (cellContainer) => {
|
cellContainer.setAttribute('align', 'right');
|
||||||
cellContainer.div({ class: 'advanced-button' }, (divContainer) => {
|
let divContainer = DOM.append(cellContainer, DOM.$('div.advanced-button'));
|
||||||
button = new Button(divContainer.getHTMLElement());
|
let button = new Button(divContainer);
|
||||||
button.label = title;
|
button.label = title;
|
||||||
button.onDidClick(() => {
|
button.onDidClick(() => {
|
||||||
//open advanced page
|
//open advanced page
|
||||||
this._callbacks.onAdvancedProperties();
|
this._callbacks.onAdvancedProperties();
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
private appendCheckbox(container: Builder, label: string, checkboxClass: string, cellContainerClass: string, rowContainerClass: string, isChecked: boolean): Checkbox {
|
private appendCheckbox(container: HTMLElement, label: string, cellContainerClass: string, rowContainerClass: string, isChecked: boolean): Checkbox {
|
||||||
let checkbox: Checkbox;
|
let rowContainer = DOM.append(container, DOM.$(`tr.${rowContainerClass}`));
|
||||||
container.element('tr', { class: rowContainerClass }, (rowContainer) => {
|
DOM.append(rowContainer, DOM.$('td'));
|
||||||
rowContainer.element('td');
|
let checkboxContainer = DOM.append(rowContainer, DOM.$(`td.${cellContainerClass}`));
|
||||||
rowContainer.element('td', { class: cellContainerClass }, (inputCellContainer) => {
|
return new Checkbox(checkboxContainer, { label, checked: isChecked, ariaLabel: label });
|
||||||
checkbox = new Checkbox(inputCellContainer.getHTMLElement(), { label, checked: isChecked, ariaLabel: label });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return checkbox;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private registerListeners(): void {
|
private registerListeners(): void {
|
||||||
@@ -322,8 +311,8 @@ export class ConnectionWidget {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._refreshCredentialsLinkBuilder) {
|
if (this._refreshCredentialsLink) {
|
||||||
this._toDispose.push(this._refreshCredentialsLinkBuilder.on(DOM.EventType.CLICK, async () => {
|
this._toDispose.push(DOM.addDisposableListener(this._refreshCredentialsLink, DOM.EventType.CLICK, async () => {
|
||||||
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||||
if (account) {
|
if (account) {
|
||||||
await this._accountManagementService.refreshAccount(account);
|
await this._accountManagementService.refreshAccount(account);
|
||||||
@@ -417,14 +406,12 @@ export class ConnectionWidget {
|
|||||||
if (currentAuthType === AuthenticationType.AzureMFA) {
|
if (currentAuthType === AuthenticationType.AzureMFA) {
|
||||||
this.fillInAzureAccountOptions();
|
this.fillInAzureAccountOptions();
|
||||||
this._azureAccountDropdown.enable();
|
this._azureAccountDropdown.enable();
|
||||||
let tableContainer = this._tableContainer.getContainer();
|
DOM.addClass(this._tableContainer, 'hide-username-password');
|
||||||
tableContainer.classList.add('hide-username-password');
|
DOM.removeClass(this._tableContainer, 'hide-azure-accounts');
|
||||||
tableContainer.classList.remove('hide-azure-accounts');
|
|
||||||
} else {
|
} else {
|
||||||
this._azureAccountDropdown.disable();
|
this._azureAccountDropdown.disable();
|
||||||
let tableContainer = this._tableContainer.getContainer();
|
DOM.removeClass(this._tableContainer, 'hide-username-password');
|
||||||
tableContainer.classList.remove('hide-username-password');
|
DOM.addClass(this._tableContainer, 'hide-azure-accounts');
|
||||||
tableContainer.classList.add('hide-azure-accounts');
|
|
||||||
this._azureAccountDropdown.hideMessage();
|
this._azureAccountDropdown.hideMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -446,9 +433,9 @@ export class ConnectionWidget {
|
|||||||
private async updateRefreshCredentialsLink(): Promise<void> {
|
private async updateRefreshCredentialsLink(): Promise<void> {
|
||||||
let chosenAccount = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
let chosenAccount = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||||
if (chosenAccount && chosenAccount.isStale) {
|
if (chosenAccount && chosenAccount.isStale) {
|
||||||
this._tableContainer.getContainer().classList.remove('hide-refresh-link');
|
DOM.removeClass(this._tableContainer, 'hide-refresh-link');
|
||||||
} else {
|
} else {
|
||||||
this._tableContainer.getContainer().classList.add('hide-refresh-link');
|
DOM.addClass(this._tableContainer, 'hide-refresh-link');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +469,7 @@ export class ConnectionWidget {
|
|||||||
// There are multiple tenants available so let the user select one
|
// There are multiple tenants available so let the user select one
|
||||||
let options = selectedAccount.properties.tenants.map(tenant => tenant.displayName);
|
let options = selectedAccount.properties.tenants.map(tenant => tenant.displayName);
|
||||||
this._azureTenantDropdown.setOptions(options);
|
this._azureTenantDropdown.setOptions(options);
|
||||||
this._tableContainer.getContainer().classList.remove(hideTenantsClassName);
|
DOM.removeClass(this._tableContainer, hideTenantsClassName);
|
||||||
this.onAzureTenantSelected(0);
|
this.onAzureTenantSelected(0);
|
||||||
} else {
|
} else {
|
||||||
if (selectedAccount && selectedAccount.properties.tenants && selectedAccount.properties.tenants.length === 1) {
|
if (selectedAccount && selectedAccount.properties.tenants && selectedAccount.properties.tenants.length === 1) {
|
||||||
@@ -490,7 +477,7 @@ export class ConnectionWidget {
|
|||||||
} else {
|
} else {
|
||||||
this._azureTenantId = undefined;
|
this._azureTenantId = undefined;
|
||||||
}
|
}
|
||||||
this._tableContainer.getContainer().classList.add(hideTenantsClassName);
|
DOM.addClass(this._tableContainer, hideTenantsClassName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,9 +576,8 @@ export class ConnectionWidget {
|
|||||||
if (this._authTypeSelectBox) {
|
if (this._authTypeSelectBox) {
|
||||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||||
} else {
|
} else {
|
||||||
let tableContainerElement = this._tableContainer.getContainer();
|
DOM.removeClass(this._tableContainer, 'hide-username-password');
|
||||||
tableContainerElement.classList.remove('hide-username-password');
|
DOM.addClass(this._tableContainer, 'hide-azure-accounts');
|
||||||
tableContainerElement.classList.add('hide-azure-accounts');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.authType === AuthenticationType.AzureMFA) {
|
if (this.authType === AuthenticationType.AzureMFA) {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { FileBrowserTreeView } from 'sql/workbench/services/fileBrowser/browser/
|
|||||||
import { FileBrowserViewModel } from 'sql/workbench/services/fileBrowser/common/fileBrowserViewModel';
|
import { FileBrowserViewModel } from 'sql/workbench/services/fileBrowser/common/fileBrowserViewModel';
|
||||||
|
|
||||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { Builder } from 'sql/base/browser/builder';
|
|
||||||
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
@@ -36,7 +35,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
|||||||
|
|
||||||
export class FileBrowserDialog extends Modal {
|
export class FileBrowserDialog extends Modal {
|
||||||
private _viewModel: FileBrowserViewModel;
|
private _viewModel: FileBrowserViewModel;
|
||||||
private _bodyBuilder: Builder;
|
private _body: HTMLElement;
|
||||||
private _filePathInputBox: InputBox;
|
private _filePathInputBox: InputBox;
|
||||||
private _fileFilterSelectBox: SelectBox;
|
private _fileFilterSelectBox: SelectBox;
|
||||||
private _okButton: Button;
|
private _okButton: Button;
|
||||||
@@ -44,7 +43,7 @@ export class FileBrowserDialog extends Modal {
|
|||||||
private _onOk = new Emitter<string>();
|
private _onOk = new Emitter<string>();
|
||||||
public onOk: Event<string> = this._onOk.event;
|
public onOk: Event<string> = this._onOk.event;
|
||||||
|
|
||||||
private _treeContainer: Builder;
|
private _treeContainer: HTMLElement;
|
||||||
private _fileBrowserTreeView: FileBrowserTreeView;
|
private _fileBrowserTreeView: FileBrowserTreeView;
|
||||||
private _selectedFilePath: string;
|
private _selectedFilePath: string;
|
||||||
private _isFolderSelected: boolean;
|
private _isFolderSelected: boolean;
|
||||||
@@ -68,9 +67,7 @@ export class FileBrowserDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected renderBody(container: HTMLElement) {
|
protected renderBody(container: HTMLElement) {
|
||||||
new Builder(container).div({ 'class': 'file-browser-dialog' }, (bodyBuilder) => {
|
this._body = DOM.append(container, DOM.$('.file-browser-dialog'));
|
||||||
this._bodyBuilder = bodyBuilder;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
@@ -86,24 +83,19 @@ export class FileBrowserDialog extends Modal {
|
|||||||
this._register(attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
this._register(attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._bodyBuilder.div({ class: 'tree-view' }, (treeContainer) => {
|
this._treeContainer = DOM.append(this._body, DOM.$('.tree-view'));
|
||||||
this._treeContainer = treeContainer;
|
|
||||||
|
let tableContainer: HTMLElement = DOM.append(DOM.append(this._body, DOM.$('.option-section')), DOM.$('table.file-table-content'));
|
||||||
|
let pathLabel = localize('filebrowser.filepath', 'Selected path');
|
||||||
|
let pathBuilder = DialogHelper.appendRow(tableContainer, pathLabel, 'file-input-label', 'file-input-box');
|
||||||
|
this._filePathInputBox = new InputBox(pathBuilder, this._contextViewService, {
|
||||||
|
ariaLabel: pathLabel
|
||||||
});
|
});
|
||||||
|
|
||||||
this._bodyBuilder.div({ class: 'option-section' }, (tableWrapper) => {
|
this._fileFilterSelectBox = new SelectBox(['*'], '*', this._contextViewService);
|
||||||
tableWrapper.element('table', { class: 'file-table-content' }, (tableContainer) => {
|
let filterLabel = localize('fileFilter', 'Files of type');
|
||||||
let pathLabel = localize('filebrowser.filepath', 'Selected path');
|
let filterBuilder = DialogHelper.appendRow(tableContainer, filterLabel, 'file-input-label', 'file-input-box');
|
||||||
let pathBuilder = DialogHelper.appendRow(tableContainer, pathLabel, 'file-input-label', 'file-input-box');
|
DialogHelper.appendInputSelectBox(filterBuilder, this._fileFilterSelectBox);
|
||||||
this._filePathInputBox = new InputBox(pathBuilder.getHTMLElement(), this._contextViewService, {
|
|
||||||
ariaLabel: pathLabel
|
|
||||||
});
|
|
||||||
|
|
||||||
this._fileFilterSelectBox = new SelectBox(['*'], '*', this._contextViewService);
|
|
||||||
let filterLabel = localize('fileFilter', 'Files of type');
|
|
||||||
let filterBuilder = DialogHelper.appendRow(tableContainer, filterLabel, 'file-input-label', 'file-input-box');
|
|
||||||
DialogHelper.appendInputSelectBox(filterBuilder, this._fileFilterSelectBox);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this._okButton = this.addFooterButton(localize('fileBrowser.ok', 'OK'), () => this.ok());
|
this._okButton = this.addFooterButton(localize('fileBrowser.ok', 'OK'), () => this.ok());
|
||||||
this._okButton.enabled = false;
|
this._okButton.enabled = false;
|
||||||
@@ -209,9 +201,9 @@ export class FileBrowserDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): void {
|
private updateFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): void {
|
||||||
this._fileBrowserTreeView.renderBody(this._treeContainer.getHTMLElement(), rootNode, selectedNode, expandedNodes);
|
this._fileBrowserTreeView.renderBody(this._treeContainer, rootNode, selectedNode, expandedNodes);
|
||||||
this._fileBrowserTreeView.setVisible(true);
|
this._fileBrowserTreeView.setVisible(true);
|
||||||
this._fileBrowserTreeView.layout(DOM.getTotalHeight(this._treeContainer.getHTMLElement()));
|
this._fileBrowserTreeView.layout(DOM.getTotalHeight(this._treeContainer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private onFilterSelectChanged(filterIndex) {
|
private onFilterSelectChanged(filterIndex) {
|
||||||
@@ -242,7 +234,7 @@ export class FileBrowserDialog extends Modal {
|
|||||||
// Update theming that is specific to file browser
|
// Update theming that is specific to file browser
|
||||||
private updateTheme(): void {
|
private updateTheme(): void {
|
||||||
if (this._treeContainer) {
|
if (this._treeContainer) {
|
||||||
this._treeContainer.style('background-color', this.headerAndFooterBackground);
|
this._treeContainer.style.backgroundColor = this.headerAndFooterBackground;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
import * as OptionsDialogHelper from 'sql/workbench/browser/modal/optionsDialogHelper';
|
import * as OptionsDialogHelper from 'sql/workbench/browser/modal/optionsDialogHelper';
|
||||||
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
|
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { Builder, $ } from 'sql/base/browser/builder';
|
|
||||||
import * as TypeMoq from 'typemoq';
|
import * as TypeMoq from 'typemoq';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||||
|
import { $ } from 'vs/base/browser/dom';
|
||||||
|
|
||||||
suite('Advanced options helper tests', () => {
|
suite('Advanced options helper tests', () => {
|
||||||
var possibleInputs: string[];
|
var possibleInputs: string[];
|
||||||
@@ -98,9 +98,7 @@ suite('Advanced options helper tests', () => {
|
|||||||
isArray: undefined
|
isArray: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inputBox = TypeMoq.Mock.ofType(InputBox, TypeMoq.MockBehavior.Loose, $('div'), null, null);
|
||||||
let builder: Builder = $().div();
|
|
||||||
inputBox = TypeMoq.Mock.ofType(InputBox, TypeMoq.MockBehavior.Loose, builder.getHTMLElement(), null, null);
|
|
||||||
inputBox.callBase = true;
|
inputBox.callBase = true;
|
||||||
inputBox.setup(x => x.validate()).returns(() => isValid);
|
inputBox.setup(x => x.validate()).returns(() => isValid);
|
||||||
inputBox.setup(x => x.value).returns(() => inputValue);
|
inputBox.setup(x => x.value).returns(() => inputValue);
|
||||||
@@ -412,4 +410,4 @@ suite('Advanced options helper tests', () => {
|
|||||||
assert.equal(optionsMap['General'].length, 1);
|
assert.equal(optionsMap['General'].length, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { OptionsDialog } from 'sql/workbench/browser/modal/optionsDialog';
|
import { OptionsDialog } from 'sql/workbench/browser/modal/optionsDialog';
|
||||||
import { AdvancedPropertiesController } from 'sql/parts/connection/connectionDialog/advancedPropertiesController';
|
import { AdvancedPropertiesController } from 'sql/parts/connection/connectionDialog/advancedPropertiesController';
|
||||||
import { Builder, $ } from 'sql/base/browser/builder';
|
|
||||||
import { ContextKeyServiceStub } from 'sqltest/stubs/contextKeyServiceStub';
|
import { ContextKeyServiceStub } from 'sqltest/stubs/contextKeyServiceStub';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as TypeMoq from 'typemoq';
|
import * as TypeMoq from 'typemoq';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||||
|
import { $ } from 'vs/base/browser/dom';
|
||||||
|
|
||||||
suite('Advanced properties dialog tests', () => {
|
suite('Advanced properties dialog tests', () => {
|
||||||
var advancedController: AdvancedPropertiesController;
|
var advancedController: AdvancedPropertiesController;
|
||||||
@@ -86,7 +86,6 @@ suite('Advanced properties dialog tests', () => {
|
|||||||
test('advanced dialog should open when showDialog in advancedController get called', () => {
|
test('advanced dialog should open when showDialog in advancedController get called', () => {
|
||||||
var isAdvancedDialogCalled = false;
|
var isAdvancedDialogCalled = false;
|
||||||
let options: { [name: string]: any } = {};
|
let options: { [name: string]: any } = {};
|
||||||
let builder: Builder = $().div();
|
|
||||||
let advanceDialog = TypeMoq.Mock.ofType(OptionsDialog, TypeMoq.MockBehavior.Strict,
|
let advanceDialog = TypeMoq.Mock.ofType(OptionsDialog, TypeMoq.MockBehavior.Strict,
|
||||||
'', // title
|
'', // title
|
||||||
'', // name
|
'', // name
|
||||||
@@ -102,7 +101,7 @@ suite('Advanced properties dialog tests', () => {
|
|||||||
isAdvancedDialogCalled = true;
|
isAdvancedDialogCalled = true;
|
||||||
});
|
});
|
||||||
advancedController.advancedDialog = advanceDialog.object;
|
advancedController.advancedDialog = advanceDialog.object;
|
||||||
advancedController.showDialog(providerOptions, builder.getHTMLElement(), options);
|
advancedController.showDialog(providerOptions, $('div'), options);
|
||||||
assert.equal(isAdvancedDialogCalled, true);
|
assert.equal(isAdvancedDialogCalled, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
|
|||||||
import { NodeType } from 'sql/parts/objectExplorer/common/nodeType';
|
import { NodeType } from 'sql/parts/objectExplorer/common/nodeType';
|
||||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||||
import { ServerTreeDataSource } from 'sql/parts/objectExplorer/viewlet/serverTreeDataSource';
|
import { ServerTreeDataSource } from 'sql/parts/objectExplorer/viewlet/serverTreeDataSource';
|
||||||
import { Builder, $ } from 'sql/base/browser/builder';
|
|
||||||
import { Emitter } from 'vs/base/common/event';
|
import { Emitter } from 'vs/base/common/event';
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
import { ObjectExplorerActionsContext, ManageConnectionAction } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
|
import { ObjectExplorerActionsContext, ManageConnectionAction } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
|
||||||
import { IConnectionResult, IConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
import { IConnectionResult, IConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
||||||
import { TreeSelectionHandler } from 'sql/parts/objectExplorer/viewlet/treeSelectionHandler';
|
import { TreeSelectionHandler } from 'sql/parts/objectExplorer/viewlet/treeSelectionHandler';
|
||||||
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
|
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
|
||||||
|
import { $ } from 'vs/base/browser/dom';
|
||||||
|
|
||||||
suite('SQL Connection Tree Action tests', () => {
|
suite('SQL Connection Tree Action tests', () => {
|
||||||
let errorMessageService: TypeMoq.Mock<ErrorMessageServiceStub>;
|
let errorMessageService: TypeMoq.Mock<ErrorMessageServiceStub>;
|
||||||
@@ -400,9 +400,8 @@ suite('SQL Connection Tree Action tests', () => {
|
|||||||
objectExplorerService.callBase = true;
|
objectExplorerService.callBase = true;
|
||||||
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
|
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
|
||||||
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
|
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
|
||||||
let builder: Builder = $().div();
|
|
||||||
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
|
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
|
||||||
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, builder.getHTMLElement(), { dataSource });
|
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, $('div'), { dataSource });
|
||||||
tree.callBase = true;
|
tree.callBase = true;
|
||||||
|
|
||||||
tree.setup(x => x.refresh(TypeMoq.It.isAny())).returns(() => Promise.resolve(null));
|
tree.setup(x => x.refresh(TypeMoq.It.isAny())).returns(() => Promise.resolve(null));
|
||||||
@@ -489,9 +488,8 @@ suite('SQL Connection Tree Action tests', () => {
|
|||||||
objectExplorerService.callBase = true;
|
objectExplorerService.callBase = true;
|
||||||
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
|
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
|
||||||
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
|
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
|
||||||
let builder: Builder = $().div();
|
|
||||||
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
|
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
|
||||||
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, builder.getHTMLElement(), { dataSource });
|
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, $('div'), { dataSource });
|
||||||
tree.callBase = true;
|
tree.callBase = true;
|
||||||
|
|
||||||
tree.setup(x => x.refresh(TypeMoq.It.isAny())).returns(() => Promise.resolve(null));
|
tree.setup(x => x.refresh(TypeMoq.It.isAny())).returns(() => Promise.resolve(null));
|
||||||
@@ -513,4 +511,4 @@ suite('SQL Connection Tree Action tests', () => {
|
|||||||
}).then(() => done(), (err) => done(err));
|
}).then(() => done(), (err) => done(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { IEditorDescriptor } from 'vs/workbench/browser/editor';
|
|||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import * as DOM from 'vs/base/browser/dom';
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
import { Memento } from 'vs/workbench/common/memento';
|
import { Memento } from 'vs/workbench/common/memento';
|
||||||
import { Builder } from 'sql/base/browser/builder';
|
|
||||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||||
|
|
||||||
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||||
@@ -28,24 +27,17 @@ import * as TypeMoq from 'typemoq';
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
|
||||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
|
||||||
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
|
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
|
||||||
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||||
|
|
||||||
suite('SQL QueryEditor Tests', () => {
|
suite('SQL QueryEditor Tests', () => {
|
||||||
let queryModelService: QueryModelService;
|
|
||||||
let instantiationService: TypeMoq.Mock<InstantiationService>;
|
let instantiationService: TypeMoq.Mock<InstantiationService>;
|
||||||
let themeService: TestThemeService = new TestThemeService();
|
let themeService: TestThemeService = new TestThemeService();
|
||||||
let notificationService: TypeMoq.Mock<INotificationService>;
|
|
||||||
let editorDescriptorService: TypeMoq.Mock<EditorDescriptorService>;
|
let editorDescriptorService: TypeMoq.Mock<EditorDescriptorService>;
|
||||||
let connectionManagementService: TypeMoq.Mock<ConnectionManagementService>;
|
let connectionManagementService: TypeMoq.Mock<ConnectionManagementService>;
|
||||||
let configurationService: TypeMoq.Mock<ConfigurationService>;
|
let configurationService: TypeMoq.Mock<ConfigurationService>;
|
||||||
let memento: TypeMoq.Mock<Memento>;
|
let memento: TypeMoq.Mock<Memento>;
|
||||||
|
|
||||||
let queryInput: QueryInput;
|
|
||||||
let queryInput2: QueryInput;
|
|
||||||
let parentBuilder: Builder;
|
|
||||||
let mockEditor: any;
|
let mockEditor: any;
|
||||||
|
|
||||||
let getQueryEditor = function (): QueryEditor {
|
let getQueryEditor = function (): QueryEditor {
|
||||||
@@ -64,10 +56,6 @@ suite('SQL QueryEditor Tests', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setup(() => {
|
setup(() => {
|
||||||
// Setup DOM elements
|
|
||||||
let element = DOM.$('queryEditorParent');
|
|
||||||
parentBuilder = new Builder(element);
|
|
||||||
|
|
||||||
// Create object to mock the Editor classes
|
// Create object to mock the Editor classes
|
||||||
// QueryResultsEditor fails at runtime due to the way we are importing Angualar,
|
// QueryResultsEditor fails at runtime due to the way we are importing Angualar,
|
||||||
// so a {} mock is used here. This mock simply needs to have empty method stubs
|
// so a {} mock is used here. This mock simply needs to have empty method stubs
|
||||||
@@ -119,23 +107,6 @@ suite('SQL QueryEditor Tests', () => {
|
|||||||
return { enablePreviewFeatures: true };
|
return { enablePreviewFeatures: true };
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a QueryInput
|
|
||||||
let filePath = 'file://someFile.sql';
|
|
||||||
let uri: URI = URI.parse(filePath);
|
|
||||||
let fileInput = new UntitledEditorInput(uri, false, '', '', '', instantiationService.object, undefined, undefined);
|
|
||||||
let queryResultsInput: QueryResultsInput = new QueryResultsInput(uri.fsPath, configurationService.object);
|
|
||||||
queryInput = new QueryInput('first', fileInput, queryResultsInput, undefined, undefined, undefined, undefined, undefined);
|
|
||||||
|
|
||||||
// Create a QueryInput to compare to the previous one
|
|
||||||
let filePath2 = 'file://someFile2.sql';
|
|
||||||
let uri2: URI = URI.parse(filePath2);
|
|
||||||
let fileInput2 = new UntitledEditorInput(uri2, false, '', '', '', instantiationService.object, undefined, undefined);
|
|
||||||
let queryResultsInput2: QueryResultsInput = new QueryResultsInput(uri2.fsPath, configurationService.object);
|
|
||||||
queryInput2 = new QueryInput('second', fileInput2, queryResultsInput2, undefined, undefined, undefined, undefined, undefined);
|
|
||||||
|
|
||||||
// Mock IMessageService
|
|
||||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
|
||||||
|
|
||||||
// Mock ConnectionManagementService
|
// Mock ConnectionManagementService
|
||||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny())).returns(() => void 0);
|
memento.setup(x => x.getMemento(TypeMoq.It.isAny())).returns(() => void 0);
|
||||||
@@ -144,15 +115,12 @@ suite('SQL QueryEditor Tests', () => {
|
|||||||
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false);
|
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false);
|
||||||
connectionManagementService.setup(x => x.disconnectEditor(TypeMoq.It.isAny())).returns(() => void 0);
|
connectionManagementService.setup(x => x.disconnectEditor(TypeMoq.It.isAny())).returns(() => void 0);
|
||||||
connectionManagementService.setup(x => x.ensureDefaultLanguageFlavor(TypeMoq.It.isAnyString())).returns(() => void 0);
|
connectionManagementService.setup(x => x.ensureDefaultLanguageFlavor(TypeMoq.It.isAnyString())).returns(() => void 0);
|
||||||
|
|
||||||
// Create a QueryModelService
|
|
||||||
queryModelService = new QueryModelService(instantiationService.object, notificationService.object);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('createEditor creates only the taskbar', (done) => {
|
test('createEditor creates only the taskbar', (done) => {
|
||||||
// If I call createEditor
|
// If I call createEditor
|
||||||
let editor: QueryEditor = getQueryEditor();
|
let editor: QueryEditor = getQueryEditor();
|
||||||
editor.createEditor(parentBuilder.getHTMLElement());
|
editor.createEditor(DOM.$('queryEditorParent'));
|
||||||
|
|
||||||
// The taskbar should be created
|
// The taskbar should be created
|
||||||
assert.equal(!!editor.taskbar, true);
|
assert.equal(!!editor.taskbar, true);
|
||||||
|
|||||||
3
src/typings/jQuery.d.ts
vendored
3
src/typings/jQuery.d.ts
vendored
@@ -15,7 +15,6 @@ declare module 'jquery/dist/jquery.slim' {
|
|||||||
declare function factory(window: Window, noGlobal?: boolean): JQueryStatic;
|
declare function factory(window: Window, noGlobal?: boolean): JQueryStatic;
|
||||||
|
|
||||||
declare const jQuery: JQueryStatic;
|
declare const jQuery: JQueryStatic;
|
||||||
declare const $: JQueryStatic;
|
|
||||||
|
|
||||||
// Used by JQuery.Event
|
// Used by JQuery.Event
|
||||||
type _Event = Event;
|
type _Event = Event;
|
||||||
@@ -4612,4 +4611,4 @@ interface JQueryEasingFunctions {
|
|||||||
swing: JQueryEasingFunction;
|
swing: JQueryEasingFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user