Fix multiple groups hosts search.
This commit is contained in:
@@ -287,6 +287,7 @@ function (angular, _, kbn) {
|
|||||||
search: {
|
search: {
|
||||||
name: group
|
name: group
|
||||||
},
|
},
|
||||||
|
searchByAny: true,
|
||||||
searchWildcardsEnabled: true
|
searchWildcardsEnabled: true
|
||||||
}
|
}
|
||||||
return this.performZabbixAPIRequest('hostgroup.get', params);
|
return this.performZabbixAPIRequest('hostgroup.get', params);
|
||||||
@@ -300,8 +301,8 @@ function (angular, _, kbn) {
|
|||||||
host: hostname,
|
host: hostname,
|
||||||
name: hostname
|
name: hostname
|
||||||
},
|
},
|
||||||
searchWildcardsEnabled: true,
|
searchByAny: true,
|
||||||
searchByAny: true
|
searchWildcardsEnabled: true
|
||||||
}
|
}
|
||||||
return this.performZabbixAPIRequest('host.get', params);
|
return this.performZabbixAPIRequest('host.get', params);
|
||||||
};
|
};
|
||||||
@@ -313,6 +314,7 @@ function (angular, _, kbn) {
|
|||||||
search: {
|
search: {
|
||||||
name: application
|
name: application
|
||||||
},
|
},
|
||||||
|
searchByAny: true,
|
||||||
searchWildcardsEnabled: true,
|
searchWildcardsEnabled: true,
|
||||||
}
|
}
|
||||||
return this.performZabbixAPIRequest('application.get', params);
|
return this.performZabbixAPIRequest('application.get', params);
|
||||||
@@ -520,30 +522,13 @@ function (angular, _, kbn) {
|
|||||||
|
|
||||||
|
|
||||||
ZabbixAPIDatasource.prototype.groupFindQuery = function(template) {
|
ZabbixAPIDatasource.prototype.groupFindQuery = function(template) {
|
||||||
var self = this;
|
return this.performHostGroupSuggestQuery().then(function (result) {
|
||||||
return this.findZabbixGroup(template.group).then(function (results) {
|
return _.map(result, function (hostgroup) {
|
||||||
results = _.flatten(results);
|
return {
|
||||||
var groupids = _.map(_.filter(results, function (object) {
|
text: hostgroup.name,
|
||||||
return object.groupid;
|
expandable: false
|
||||||
}), '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
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ function (angular, _) {
|
|||||||
if ($scope.target.hostGroup) {
|
if ($scope.target.hostGroup) {
|
||||||
$scope.target.hostGroup = $scope.metric.hostGroupList.filter(function (item, index, array) {
|
$scope.target.hostGroup = $scope.metric.hostGroupList.filter(function (item, index, array) {
|
||||||
// Find selected host in metric.hostList
|
// Find selected host in metric.hostList
|
||||||
return (item.name == $scope.target.hostGroup.name);
|
return item.name == $scope.target.hostGroup.name;
|
||||||
}).pop();
|
}).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -172,7 +172,7 @@ function (angular, _) {
|
|||||||
if ($scope.target.host) {
|
if ($scope.target.host) {
|
||||||
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
|
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
|
||||||
// Find selected host in metric.hostList
|
// Find selected host in metric.hostList
|
||||||
return (item.name == $scope.target.host.name);
|
return item.name == $scope.target.host.name;
|
||||||
}).pop();
|
}).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -192,7 +192,7 @@ function (angular, _) {
|
|||||||
if ($scope.target.application) {
|
if ($scope.target.application) {
|
||||||
$scope.target.application = $scope.metric.applicationList.filter(function (item, index, array) {
|
$scope.target.application = $scope.metric.applicationList.filter(function (item, index, array) {
|
||||||
// Find selected application in metric.hostList
|
// Find selected application in metric.hostList
|
||||||
return (item.name == $scope.target.application.name);
|
return item.name == $scope.target.application.name;
|
||||||
}).pop();
|
}).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -220,7 +220,7 @@ function (angular, _) {
|
|||||||
if ($scope.target.item) {
|
if ($scope.target.item) {
|
||||||
$scope.target.item = $scope.metric.itemList.filter(function (item, index, array) {
|
$scope.target.item = $scope.metric.itemList.filter(function (item, index, array) {
|
||||||
// Find selected item in metric.hostList
|
// Find selected item in metric.hostList
|
||||||
return (item.name == $scope.target.item.name);
|
return item.name == $scope.target.item.name;
|
||||||
}).pop();
|
}).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user