From 3f00e4c8eba5aef678df17f3e535f0afa17d8283 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 25 Jun 2015 22:26:26 +0300 Subject: [PATCH] Fixed #34 - Aliases don't work properly in templated dashboard. --- zabbix/datasource.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/zabbix/datasource.js b/zabbix/datasource.js index af6c952..5e79d6a 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -120,7 +120,7 @@ function (angular, _, kbn) { return []; } else { items = _.flatten(items); - var alias = itemnames === 'All' ? undefined : templateSrv.replace(target.alias); + var alias = target.item.name === 'All' ? undefined : templateSrv.replace(target.alias); if ((from < useTrendsFrom) && self.trends) { return self.getTrends(items, from, to) @@ -467,9 +467,16 @@ function (angular, _, kbn) { searchByAny: true }; if (group != '*') { - params.filter = { - name: group - }; + if (_.isArray(group)) { + params.filter = { + name: group + }; + } else { + params.search = { + name: group + }; + params.searchWildcardsEnabled = true; + } } return this.performZabbixAPIRequest('hostgroup.get', params); }; @@ -575,7 +582,7 @@ function (angular, _, kbn) { } // Get groups else if (parts.length === 1) { - return this.performHostGroupSuggestQuery().then(function (result) { + return this.findZabbixGroup(template.group).then(function (result) { return _.map(result, function (hostgroup) { return { text: hostgroup.name,