mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Primarily- moving majority of the types and utils from @grafana/ui to @grafana/data * Move types from grafana-ui to grafana-data * Move valueFormats to grafana-data * Move utils from grafana-ui to grafana-data * Update imports in grafana-ui * revert data's tsconfig change * Update imports in grafana-runtime * Fix import paths in grafana-ui * Move rxjs to devDeps * Core import updates batch 1 * Import updates batch 2 * Imports fix batch 3 * Imports fixes batch i don't know * Fix imorts in grafana-toolkit * Fix imports after master merge
28 lines
684 B
TypeScript
28 lines
684 B
TypeScript
import { DataQueryRequest, DataQuery } from '@grafana/data';
|
|
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;
|
|
}
|