mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelQueryState: check for existing running query (#16894)
Fixes #16880
This commit is contained in:
parent
ec500ed416
commit
513c79d392
@ -34,14 +34,22 @@ describe('PanelQueryState', () => {
|
||||
expect(empty.series.length).toBe(0);
|
||||
expect(hasRun).toBeFalsy();
|
||||
|
||||
empty = await state.execute(
|
||||
ds,
|
||||
getQueryOptions({ targets: [{ hide: true, refId: 'X' }, { hide: true, refId: 'Y' }, { hide: true, refId: 'Z' }] })
|
||||
);
|
||||
const query = getQueryOptions({
|
||||
targets: [{ hide: true, refId: 'X' }, { hide: true, refId: 'Y' }, { hide: true, refId: 'Z' }],
|
||||
});
|
||||
|
||||
empty = await state.execute(ds, query);
|
||||
// should not run any hidden queries'
|
||||
expect(state.getActiveRunner()).toBeFalsy();
|
||||
expect(empty.series.length).toBe(0);
|
||||
expect(hasRun).toBeFalsy();
|
||||
|
||||
// Check for the same query
|
||||
expect(state.isSameQuery(ds, query)).toBeTruthy();
|
||||
|
||||
// Check for differnet queries
|
||||
expect(state.isSameQuery(new MockDataSourceApi('test'), query)).toBeFalsy();
|
||||
expect(state.isSameQuery(ds, getQueryOptions({ targets: [{ refId: 'differnet' }] }))).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -95,6 +95,7 @@ export class PanelQueryState {
|
||||
|
||||
execute(ds: DataSourceApi, req: DataQueryRequest): Promise<PanelData> {
|
||||
this.request = req;
|
||||
this.datasource = ds;
|
||||
|
||||
// Return early if there are no queries to run
|
||||
if (!req.targets.length) {
|
||||
|
Loading…
Reference in New Issue
Block a user