mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix formating of results from instant queries in Explore (#27767)
This commit is contained in:
@@ -1868,7 +1868,7 @@ describe('prepareTargets', () => {
|
||||
});
|
||||
|
||||
describe('when query type Instant is selected', () => {
|
||||
it('then it should just add targets', () => {
|
||||
it('then it should target and modify its format to table', () => {
|
||||
const target: PromQuery = {
|
||||
refId: 'A',
|
||||
expr: 'up',
|
||||
@@ -1894,7 +1894,7 @@ describe('prepareTargets', () => {
|
||||
start,
|
||||
step: 1,
|
||||
});
|
||||
expect(activeTargets[0]).toEqual(target);
|
||||
expect(activeTargets[0]).toEqual({ ...target, format: 'table' });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -237,6 +237,12 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
|
||||
this.createQuery(instantTarget, options, start, end),
|
||||
this.createQuery(rangeTarget, options, start, end)
|
||||
);
|
||||
} else if (target.instant && options.app === CoreApp.Explore) {
|
||||
// If running only instant query in Explore, format as table
|
||||
const instantTarget: any = cloneDeep(target);
|
||||
instantTarget.format = 'table';
|
||||
queries.push(this.createQuery(instantTarget, options, start, end));
|
||||
activeTargets.push(instantTarget);
|
||||
} else {
|
||||
queries.push(this.createQuery(target, options, start, end));
|
||||
activeTargets.push(target);
|
||||
|
||||
Reference in New Issue
Block a user