mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* VizPanel: Make it more real * Updates * Progress on query runner and max data points from width * Updated * Update * Tests * Fixed issue with migration * Moving VizPanel * Fixed migration issue due to pluginVersion not being set * Update public/app/features/scenes/querying/SceneQueryRunner.test.ts Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com> * Some minor review fixes * Added expect Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
38 lines
1013 B
TypeScript
38 lines
1013 B
TypeScript
import { getDefaultTimeRange, getTimeZone, TimeRange, UrlQueryMap } from '@grafana/data';
|
|
|
|
import { SceneObjectBase } from './SceneObjectBase';
|
|
import { SceneObjectWithUrlSync, SceneTimeRangeState } from './types';
|
|
|
|
export class SceneTimeRange extends SceneObjectBase<SceneTimeRangeState> implements SceneObjectWithUrlSync {
|
|
public constructor(state: Partial<SceneTimeRangeState> = {}) {
|
|
super({
|
|
...getDefaultTimeRange(),
|
|
timeZone: getTimeZone(),
|
|
...state,
|
|
});
|
|
}
|
|
|
|
public onTimeRangeChange = (timeRange: TimeRange) => {
|
|
this.setState(timeRange);
|
|
};
|
|
|
|
public onRefresh = () => {
|
|
// TODO re-eval time range
|
|
this.setState({ ...this.state });
|
|
};
|
|
|
|
public onIntervalChanged = (_: string) => {};
|
|
|
|
/** These url sync functions are only placeholders for something more sophisticated */
|
|
public getUrlState() {
|
|
return {
|
|
from: this.state.raw.from,
|
|
to: this.state.raw.to,
|
|
} as any;
|
|
}
|
|
|
|
public updateFromUrl(values: UrlQueryMap) {
|
|
// TODO
|
|
}
|
|
}
|