Merge fix the selectbox issue for chart

This commit is contained in:
Alan Ren
2019-04-16 13:32:52 -07:00
committed by Karl Burtram
parent b2952d2ddf
commit d62068025c

View File

@@ -20,7 +20,7 @@ import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/interfaces'; import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/interfaces';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom'; import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { Builder } from 'sql/base/browser/builder'; import { Builder } from 'sql/base/browser/builder';
@@ -211,8 +211,13 @@ export class ChartView extends Disposable implements IPanelView {
} }
private buildOptions() { private buildOptions() {
dispose(this.optionDisposables); // The first element in the disposables list is for the chart type: the master dropdown that controls other option controls.
this.optionDisposables = []; // whiling rebuilding the options we should not dispose it, otherwise it would react to the theme change event
if (this.optionDisposables.length > 1) {
dispose(this.optionDisposables.slice(1));
this.optionDisposables.splice(1);
}
this.optionMap = { this.optionMap = {
'type': this.optionMap['type'] 'type': this.optionMap['type']
}; };
@@ -284,7 +289,7 @@ export class ChartView extends Disposable implements IPanelView {
}; };
break; break;
case ControlType.combo: case ControlType.combo:
let dropdown = new SelectBox(option.displayableOptions || option.options, 0, this._contextViewService); let dropdown = new SelectBox(option.displayableOptions || option.options, undefined, this._contextViewService);
dropdown.select(option.options.indexOf(value)); dropdown.select(option.options.indexOf(value));
dropdown.render(optionContainer); dropdown.render(optionContainer);
dropdown.onDidSelect(e => { dropdown.onDidSelect(e => {