Rework timeSeries in chart viewer (#2987)

* rework timeSeries in chart viewer

* rework important to fix tests
This commit is contained in:
Anthony Dresser
2018-10-24 14:58:24 -07:00
committed by Karl Burtram
parent 724c49f5c4
commit 7dfcd89a04
10 changed files with 202 additions and 94 deletions

View File

@@ -275,7 +275,7 @@ export class ChartView implements IPanelView {
dropdown.render(optionContainer);
dropdown.onDidSelect(e => {
if (this.options[option.configEntry] !== option.options[e.index]) {
this.options[option.configEntry] = option.options[e.index] === 'timeSeries' ? 'line' : option.options[e.index];
this.options[option.configEntry] = option.options[e.index];
if (this.insight) {
this.insight.options = this.options;
}
@@ -324,6 +324,24 @@ export class ChartView implements IPanelView {
};
this.optionDisposables.push(attachInputBoxStyler(numberInput, this._themeService));
break;
case ControlType.dateInput:
let dateInput = new InputBox(optionContainer, this._contextViewService, { type: 'date' });
dateInput.value = value || '';
dateInput.onDidChange(e => {
if (this.options[option.configEntry] !== e) {
this.options[option.configEntry] = e;
if (this.insight) {
this.insight.options = this.options;
}
}
});
setFunc = (val: string) => {
if (!isUndefinedOrNull(val)) {
dateInput.value = val;
}
};
this.optionDisposables.push(attachInputBoxStyler(dateInput, this._themeService));
break;
}
this.optionMap[option.configEntry] = { element: optionContainer, set: setFunc };
container.appendChild(optionContainer);