From f3695be11d36a0500709f19015fc2d7f9fc504a6 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Tue, 18 Jul 2017 15:31:05 -0400 Subject: [PATCH] Fixed group/host association across pages --- .../associate-groups/associate-groups.controller.js | 8 +++----- .../shared/associate-hosts/associate-hosts.controller.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js index edb09778bd..7cb16ca60c 100644 --- a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js +++ b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js @@ -63,11 +63,9 @@ $scope.$watchCollection('associate_groups', function () { if($scope.selectedItems) { $scope.associate_groups.forEach(function(row, i) { - $scope.selectedItems.forEach(function(selectedItem) { - if(selectedItem.id === row.id) { - $scope.associate_groups[i].isSelected = true; - } - }); + if ($scope.selectedItems.filter(function(e) { return e.id === row.id; }).length > 0) { + $scope.associate_groups[i].isSelected = true; + } }); } }); diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js b/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js index 414f8262f3..41f7901707 100644 --- a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js +++ b/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js @@ -60,7 +60,7 @@ $scope.$watchCollection('associate_hosts', function () { if($scope.selectedItems) { $scope.associate_hosts.forEach(function(row, i) { - if (_.includes($scope.selectedItems, row.id)) { + if ($scope.selectedItems.filter(function(e) { return e.id === row.id; }).length > 0) { $scope.associate_hosts[i].isSelected = true; } });