grafana/public/test/helpers/getQueryOptions.ts
Ryan McKinley 3f15170914 Refactor: move some files to @grafana/data (#17952)
* moving to data WIP

* more refactoring

* add missing test

* mock full path

* remove sinon from grafana-ui
2019-07-06 08:05:53 +02:00

28 lines
682 B
TypeScript

import { DataQueryRequest, DataQuery } from '@grafana/ui';
import { dateTime } from '@grafana/data';
export function getQueryOptions<TQuery extends DataQuery>(
options: Partial<DataQueryRequest<TQuery>>
): DataQueryRequest<TQuery> {
const raw = { from: 'now', to: 'now-1h' };
const range = { from: dateTime(), to: dateTime(), raw: raw };
const defaults: DataQueryRequest<TQuery> = {
requestId: 'TEST',
range: range,
targets: [],
scopedVars: {},
timezone: 'browser',
panelId: 1,
dashboardId: 1,
interval: '60s',
intervalMs: 60000,
maxDataPoints: 500,
startTime: 0,
};
Object.assign(defaults, options);
return defaults;
}