mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 10:09:36 +08:00
Refactor: improvements to PanelQueryRunner (#16678)
merged DataQueryOptions + DataRequestInfo info: DataQueryRequest
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
import { DataQueryOptions, DataQuery } from '@grafana/ui';
|
||||
import { DataQueryRequest, DataQuery } from '@grafana/ui';
|
||||
import moment from 'moment';
|
||||
|
||||
export function getQueryOptions<TQuery extends DataQuery>(
|
||||
options: Partial<DataQueryOptions<TQuery>>
|
||||
): DataQueryOptions<TQuery> {
|
||||
options: Partial<DataQueryRequest<TQuery>>
|
||||
): DataQueryRequest<TQuery> {
|
||||
const raw = { from: 'now', to: 'now-1h' };
|
||||
const range = { from: moment(), to: moment(), raw: raw };
|
||||
|
||||
const defaults: DataQueryOptions<TQuery> = {
|
||||
const defaults: DataQueryRequest<TQuery> = {
|
||||
requestId: 'TEST',
|
||||
range: range,
|
||||
rangeRaw: raw,
|
||||
targets: [],
|
||||
scopedVars: {},
|
||||
timezone: 'browser',
|
||||
@ -18,6 +18,7 @@ export function getQueryOptions<TQuery extends DataQuery>(
|
||||
interval: '60s',
|
||||
intervalMs: 60000,
|
||||
maxDataPoints: 500,
|
||||
startTime: 0,
|
||||
};
|
||||
|
||||
Object.assign(defaults, options);
|
||||
|
Reference in New Issue
Block a user