Fix multiple groups hosts search.
This commit is contained in:
@@ -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,23 +522,7 @@ 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 this.performHostGroupSuggestQuery().then(function (result) {
|
||||
return _.map(result, function (hostgroup) {
|
||||
return {
|
||||
text: hostgroup.name,
|
||||
@@ -544,7 +530,6 @@ function (angular, _, kbn) {
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user