From 124492e073fda6cb5148167a7ae7ea1e46f834c3 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 9 Apr 2015 13:59:21 -0400 Subject: [PATCH] fixed host prepopulation with no groups/no hosts from errorsing to console --- awx/ui/static/js/controllers/Inventories.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index eb6ee30072..31ace3d3a5 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -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');