mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
45b7de1910
Closes #19598 Fixes bug introduced recently where the new PromQueryEditor did not preserve the PromContext.Explore set on the query model by PromQueryField which caused the table to be empty for Prometheus in explore.
29 lines
721 B
TypeScript
29 lines
721 B
TypeScript
import { DataQueryRequest, DataQuery, CoreApp } 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',
|
|
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;
|
|
}
|