MixedDatasource: don't filter hidden queries before sending to datasources (#18814)

This commit is contained in:
Ryan McKinley 2019-08-30 11:59:23 -07:00 committed by GitHub
parent 1a4be4af8c
commit 13f55bc5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -17,17 +17,23 @@ class MixedDatasource extends DataSourceApi<DataQuery> {
return Promise.resolve([]);
}
const filtered = _.filter(targets, (t: DataQuery) => {
return !t.hide;
});
if (filtered.length === 0) {
if (targets.length === 0) {
return { data: [] };
}
return this.datasourceSrv.get(dsName).then(ds => {
// Remove any unused hidden queries
if (!ds.meta.hiddenQueries) {
targets = _.filter(targets, (t: DataQuery) => {
return !t.hide;
});
if (targets.length === 0) {
return { data: [] };
}
}
const opt = _.cloneDeep(options);
opt.targets = filtered;
opt.targets = targets;
return ds.query(opt);
});
});

View File

@ -6,6 +6,7 @@
"builtIn": true,
"mixed": true,
"metrics": true,
"hiddenQueries": true,
"queryOptions": {
"minInterval": true