From 866fe7e265cea7d26c7fd9a590d498d8ef472ec1 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 7 Feb 2017 16:15:03 -0500 Subject: [PATCH] only loop over project OPTIONS response if the response is valid see: #5194 --- awx/ui/client/src/controllers/Projects.js | 32 ++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 5bfbb39273..4b4ef05c19 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -51,24 +51,26 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams, // iterate over the list and add fields like type label, after the // OPTIONS request returns, or the list is sorted/paginated/searched function optionsRequestDataProcessing(){ - $scope[list.name].forEach(function(item, item_idx) { - var itm = $scope[list.name][item_idx]; + if ($scope[list.name] !== undefined) { + $scope[list.name].forEach(function(item, item_idx) { + var itm = $scope[list.name][item_idx]; - // Set the item type label - if (list.fields.scm_type && $scope.options && - $scope.options.hasOwnProperty('scm_type')) { - $scope.options.scm_type.choices.every(function(choice) { - if (choice[0] === item.scm_type) { - itm.type_label = choice[1]; - return false; - } - return true; - }); - } + // Set the item type label + if (list.fields.scm_type && $scope.options && + $scope.options.hasOwnProperty('scm_type')) { + $scope.options.scm_type.choices.every(function(choice) { + if (choice[0] === item.scm_type) { + itm.type_label = choice[1]; + return false; + } + return true; + }); + } - buildTooltips(itm); + buildTooltips(itm); - }); + }); + } } function buildTooltips(project) {