mirror of
https://github.com/grafana/grafana.git
synced 2025-01-06 22:23:19 -06:00
8d339a279b
* Eslint: no-duplicate-imports rule (bump grafana-eslint-config) * Chore: Fix duplicate imports (#31041) * Rebased this branch into eslint-no-duplicate-imports * updated some changes * merged uncaught duplicate imports * fixes frontend test- I hope * fixes e2e test- I hope Co-authored-by: Uchechukwu Obasi <obasiuche62@gmail.com>
28 lines
689 B
TypeScript
28 lines
689 B
TypeScript
import { DataQueryRequest, DataQuery, CoreApp, 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',
|
|
app: CoreApp.Dashboard,
|
|
range: range,
|
|
targets: [],
|
|
scopedVars: {},
|
|
timezone: 'browser',
|
|
panelId: 1,
|
|
dashboardId: 1,
|
|
interval: '60s',
|
|
intervalMs: 60000,
|
|
maxDataPoints: 500,
|
|
startTime: 0,
|
|
};
|
|
|
|
Object.assign(defaults, options);
|
|
|
|
return defaults;
|
|
}
|