From 234f7b409c0ce188cb2cdf06e0e7c7ba1f191387 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 3 Jan 2017 13:31:04 -0500 Subject: [PATCH 1/2] fixes #4548 make sure group is initialized to empty object if undefined to fix console error --- .../manage/groups/groups-list.controller.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js index 7385e2f09b..6cd7d45cc4 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js @@ -46,6 +46,10 @@ } function buildStatusIndicators(group){ + if (group === undefined) { + group = {}; + } + let group_status, hosts_status; group_status = GetSyncStatusMsg({ @@ -142,10 +146,14 @@ $scope.$on(`ws-jobs`, function(e, data){ var group = Find({ list: $scope.groups, key: 'id', val: data.group_id }); + + if (group === undefined) { + group = {}; + } + if(data.status === 'failed' || data.status === 'successful'){ $state.reload(); - } - else{ + } else { var status = GetSyncStatusMsg({ status: data.status, has_inventory_sources: group.has_inventory_sources, From c36a246b5df03506f7947ed911c8b24699a2402e Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 3 Jan 2017 13:44:00 -0500 Subject: [PATCH 2/2] add null as well as undefined check --- .../src/inventories/manage/groups/groups-list.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js index 6cd7d45cc4..bdfdb5dae0 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js @@ -46,7 +46,7 @@ } function buildStatusIndicators(group){ - if (group === undefined) { + if (group === undefined || group === null) { group = {}; } @@ -147,7 +147,7 @@ $scope.$on(`ws-jobs`, function(e, data){ var group = Find({ list: $scope.groups, key: 'id', val: data.group_id }); - if (group === undefined) { + if (group === undefined || group === null) { group = {}; }