From 4a70056d3ce0e307b53e5efa001b2da253b24273 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Mon, 8 Apr 2019 11:39:54 +0200 Subject: [PATCH] datasource: fix disable query when using mixed datasource (#16409) This fixes an error that was thrown when one or several queries was disabled using the mixed datasource. Fixes #12977 --- public/app/plugins/datasource/mixed/datasource.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/mixed/datasource.ts b/public/app/plugins/datasource/mixed/datasource.ts index 6018329093e4..764aab454aff 100644 --- a/public/app/plugins/datasource/mixed/datasource.ts +++ b/public/app/plugins/datasource/mixed/datasource.ts @@ -13,9 +13,17 @@ class MixedDatasource { return this.$q([]); } + const filtered = _.filter(targets, t => { + return !t.hide; + }); + + if (filtered.length === 0) { + return { data: [] }; + } + return this.datasourceSrv.get(dsName).then(ds => { const opt = angular.copy(options); - opt.targets = targets; + opt.targets = filtered; return ds.query(opt); }); });