mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AzureMonitor: Fix filter query for empty queryType (#60252)
This commit is contained in:
committed by
GitHub
parent
6d8bf5ac01
commit
b4e76e75b1
@@ -34,4 +34,17 @@ describe('Azure Monitor Datasource', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('should not filter a valid query', () => {
|
||||
const ds = new Datasource(createMockInstanceSetttings());
|
||||
const query = createMockQuery();
|
||||
expect(ds.filterQuery(query)).toBe(true);
|
||||
});
|
||||
|
||||
it('should filter out a query with no query type', () => {
|
||||
const ds = new Datasource(createMockInstanceSetttings());
|
||||
const query = createMockQuery();
|
||||
delete query.queryType;
|
||||
expect(ds.filterQuery(query)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ export default class Datasource extends DataSourceWithBackend<AzureMonitorQuery,
|
||||
|
||||
filterQuery(item: AzureMonitorQuery): boolean {
|
||||
if (!item.queryType) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
const ds = this.pseudoDatasource[item.queryType];
|
||||
return ds?.filterQuery?.(item) ?? true;
|
||||
|
||||
Reference in New Issue
Block a user