Fix multiple groups hosts search.

This commit is contained in:
Alexander Zobnin
2015-05-29 20:12:50 +03:00
parent 936c19310e
commit bf6c573883
2 changed files with 15 additions and 30 deletions

View File

@@ -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
};
});
});
};