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

pull/18821/head
Ryan McKinley 6 years ago committed by GitHub
parent 1a4be4af8c
commit 13f55bc5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      public/app/plugins/datasource/mixed/datasource.ts
  2. 1
      public/app/plugins/datasource/mixed/plugin.json

@ -17,17 +17,23 @@ class MixedDatasource extends DataSourceApi<DataQuery> {
return Promise.resolve([]); return Promise.resolve([]);
} }
const filtered = _.filter(targets, (t: DataQuery) => { if (targets.length === 0) {
return !t.hide;
});
if (filtered.length === 0) {
return { data: [] }; return { data: [] };
} }
return this.datasourceSrv.get(dsName).then(ds => { 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); const opt = _.cloneDeep(options);
opt.targets = filtered; opt.targets = targets;
return ds.query(opt); return ds.query(opt);
}); });
}); });

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

Loading…
Cancel
Save