fixed host prepopulation with no groups/no hosts from errorsing to console

This commit is contained in:
John Mitchell 2015-04-09 13:59:21 -04:00
parent 37f7c4d1a3
commit 124492e073

View File

@ -910,8 +910,16 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
$scope.populateAdhocForm = function() {
var host_patterns = "all";
if ($scope.hostsSelected || $scope.groupsSelected) {
var allSelectedItems = $scope.groupsSelectedItems.concat($scope.hostsSelectedItems);
host_patterns = _.pluck(allSelectedItems, "name").join(":");
var allSelectedItems = [];
if ($scope.groupsSelectedItems) {
allSelectedItems = allSelectedItems.concat($scope.groupsSelectedItems);
}
if ($scope.hostsSelectedItems) {
allSelectedItems = allSelectedItems.concat($scope.hostsSelectedItems);
}
if (allSelectedItems) {
host_patterns = _.pluck(allSelectedItems, "name").join(":");
}
}
$rootScope.hostPatterns = host_patterns;
$location.path('/inventories/' + $scope.inventory.id + '/adhoc');