diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 3faf918..8dbd269 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -287,6 +287,7 @@ function (angular, _, kbn) { search: { name: group }, + searchByAny: true, searchWildcardsEnabled: true } return this.performZabbixAPIRequest('hostgroup.get', params); @@ -300,8 +301,8 @@ function (angular, _, kbn) { host: hostname, name: hostname }, - searchWildcardsEnabled: true, - searchByAny: true + searchByAny: true, + searchWildcardsEnabled: true } return this.performZabbixAPIRequest('host.get', params); }; @@ -313,6 +314,7 @@ function (angular, _, kbn) { search: { name: application }, + searchByAny: true, searchWildcardsEnabled: true, } return this.performZabbixAPIRequest('application.get', params); @@ -520,30 +522,13 @@ function (angular, _, kbn) { ZabbixAPIDatasource.prototype.groupFindQuery = function(template) { - var self = this; - return this.findZabbixGroup(template.group).then(function (results) { - results = _.flatten(results); - var groupids = _.map(_.filter(results, function (object) { - return object.groupid; - }), 'groupid'); - - var params = { - output: ['name', 'host'], - sortfield: 'name' - } - if (groupids.length) { - params.groupids = groupids; - } - - return self.performZabbixAPIRequest('hostgroup.get', params) - .then(function (result) { - return _.map(result, function (hostgroup) { - return { - text: hostgroup.name, - expandable: false - }; - }); - }); + return this.performHostGroupSuggestQuery().then(function (result) { + return _.map(result, function (hostgroup) { + return { + text: hostgroup.name, + expandable: false + }; + }); }); }; diff --git a/zabbix/queryCtrl.js b/zabbix/queryCtrl.js index f1c37fd..ab81600 100644 --- a/zabbix/queryCtrl.js +++ b/zabbix/queryCtrl.js @@ -152,7 +152,7 @@ function (angular, _) { if ($scope.target.hostGroup) { $scope.target.hostGroup = $scope.metric.hostGroupList.filter(function (item, index, array) { // Find selected host in metric.hostList - return (item.name == $scope.target.hostGroup.name); + return item.name == $scope.target.hostGroup.name; }).pop(); } }); @@ -172,7 +172,7 @@ function (angular, _) { if ($scope.target.host) { $scope.target.host = $scope.metric.hostList.filter(function (item, index, array) { // Find selected host in metric.hostList - return (item.name == $scope.target.host.name); + return item.name == $scope.target.host.name; }).pop(); } }); @@ -192,7 +192,7 @@ function (angular, _) { if ($scope.target.application) { $scope.target.application = $scope.metric.applicationList.filter(function (item, index, array) { // Find selected application in metric.hostList - return (item.name == $scope.target.application.name); + return item.name == $scope.target.application.name; }).pop(); } }); @@ -220,7 +220,7 @@ function (angular, _) { if ($scope.target.item) { $scope.target.item = $scope.metric.itemList.filter(function (item, index, array) { // Find selected item in metric.hostList - return (item.name == $scope.target.item.name); + return item.name == $scope.target.item.name; }).pop(); } });