Explore: Parses and updates TimeSrv in one place in Explore (#17677)

* Wip: Adds timeEpic

* Refactor: Introduces absoluteRange in Explore state

* Refactor: Removes changeTime action

* Tests: Adds tests for timeEpic

* Refactor: Spells AbsoluteRange correctly
This commit is contained in:
Hugo Häggmark
2019-06-25 14:44:19 +02:00
committed by kay delaney
parent 6be1606bd8
commit 2c5400c61e
18 changed files with 366 additions and 112 deletions

View File

@@ -3,6 +3,7 @@ import { DataSourceApi } from '@grafana/ui/src/types/datasource';
import { ExploreId, ExploreItemState, ExploreState } from 'app/types/explore';
import { makeExploreItemState } from 'app/features/explore/state/reducers';
import { StoreState } from 'app/types';
import { TimeRange, dateTime } from '@grafana/ui';
export const mockExploreState = (options: any = {}) => {
const isLive = options.isLive || false;
@@ -31,6 +32,14 @@ export const mockExploreState = (options: any = {}) => {
},
interval: datasourceInterval,
};
const range: TimeRange = options.range || {
from: dateTime('2019-01-01 10:00:00.000Z'),
to: dateTime('2019-01-01 16:00:00.000Z'),
raw: {
from: 'now-6h',
to: 'now',
},
};
const urlReplaced = options.urlReplaced || false;
const left: ExploreItemState = options.left || {
...makeExploreItemState(),
@@ -45,6 +54,7 @@ export const mockExploreState = (options: any = {}) => {
scanner,
scanning,
urlReplaced,
range,
};
const right: ExploreItemState = options.right || {
...makeExploreItemState(),
@@ -59,6 +69,7 @@ export const mockExploreState = (options: any = {}) => {
scanner,
scanning,
urlReplaced,
range,
};
const split: boolean = options.split || false;
const explore: ExploreState = {
@@ -82,5 +93,6 @@ export const mockExploreState = (options: any = {}) => {
refreshInterval,
state,
scanner,
range,
};
};