grafana/public/app/features/explore/state/helpers.ts
Piotr Jamróz bf977ac245
Explore: Fix time interpolation (#46737)
* Ensure TemplateService is updated with new time range on each time range change.

* Fix linting errors

* Fix explorePane.test.ts

* Reuse createDefaultInitialState

* Remove unused imports

* Add a test for left/right split

* Silence console.error in tests

* Silence console.error in tests
2022-03-29 15:10:40 +02:00

47 lines
987 B
TypeScript

import { DefaultTimeZone, toUtc } from '@grafana/data';
import { ExploreId } from '../../../types';
export const createDefaultInitialState = () => {
const t = toUtc();
const testRange = {
from: t,
to: t,
raw: {
from: t,
to: t,
},
};
const defaultInitialState = {
user: {
orgId: '1',
timeZone: DefaultTimeZone,
},
explore: {
[ExploreId.left]: {
datasourceInstance: {
query: jest.fn(),
getRef: jest.fn(),
getLogsVolumeDataProvider: jest.fn(),
meta: {
id: 'something',
},
},
initialized: true,
containerWidth: 1920,
eventBridge: { emit: () => {} } as any,
queries: [{ expr: 'test' }] as any[],
range: testRange,
history: [],
refreshInterval: {
label: 'Off',
value: 0,
},
cache: [],
},
},
};
return { testRange, defaultInitialState };
};