mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Public test * Update * Update * revert * Added some public accessability modifiers * Force public acessability only for scenes/* folder * Fixes
30 lines
810 B
TypeScript
30 lines
810 B
TypeScript
import { TimeRange, UrlQueryMap } from '@grafana/data';
|
|
|
|
import { SceneObjectBase } from './SceneObjectBase';
|
|
import { SceneObjectWithUrlSync, SceneTimeRangeState } from './types';
|
|
|
|
export class SceneTimeRange extends SceneObjectBase<SceneTimeRangeState> implements SceneObjectWithUrlSync {
|
|
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
|
|
}
|
|
}
|