mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
committed by
kay delaney
parent
6be1606bd8
commit
2c5400c61e
@@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user