diff --git a/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js b/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js
index 169a9d6b7a..c1567200d2 100644
--- a/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js
+++ b/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js
@@ -13,7 +13,7 @@ export default {
controller: function($scope, $q, GroupsService, $state){
$scope.associateGroups = function(selectedItems){
var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (id) => GroupsService.associateHost({id: parseInt($state.params.host_id)}, id)) )
+ return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateHost({id: parseInt($state.params.host_id)}, selectedItem.id)) )
.then( () =>{
deferred.resolve();
}, (error) => {
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js
index 6125e02da7..294dcf031c 100644
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js
+++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js
@@ -13,7 +13,7 @@ export default {
controller: function($scope, $q, GroupsService, $state){
$scope.associateGroups = function(selectedItems){
var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (id) => GroupsService.associateGroup({id: id}, $state.params.group_id)) )
+ return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateGroup({id: selectedItem.id}, $state.params.group_id)) )
.then( () =>{
deferred.resolve();
}, (error) => {
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js
index df09d30d80..959055ad02 100644
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js
+++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js
@@ -13,7 +13,7 @@ export default {
controller: function($scope, $q, GroupsService, $state){
$scope.associateHosts = function(selectedItems){
var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (id) => GroupsService.associateHost({id: id}, $state.params.group_id)) )
+ return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateHost({id: selectedItem.id}, $state.params.group_id)) )
.then( () =>{
deferred.resolve();
}, (error) => {
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js
index 2b9a865b18..d17a181687 100644
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js
+++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js
@@ -13,7 +13,7 @@ export default {
controller: function($scope, $q, GroupsService, $state){
$scope.associateGroups = function(selectedItems){
var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (id) => GroupsService.associateHost({id: parseInt($state.params.host_id)}, id)) )
+ return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateHost({id: parseInt($state.params.host_id)}, selectedItem.id)) )
.then( () =>{
deferred.resolve();
}, (error) => {
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 ec06428d96..f6f4fc4bed 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
@@ -35,6 +35,10 @@
list.multiSelect = true;
list.fields.name.ngClick = 'linkoutGroup(associate_group.id)';
list.trackBy = 'associate_group.id';
+ list.multiSelectPreview = {
+ selectedRows: 'selectedItems',
+ availableRows: 'associate_groups'
+ };
delete list.actions;
delete list.fieldActions;
delete list.fields.failed_hosts;
@@ -58,9 +62,11 @@
$scope.$watchCollection('associate_groups', function () {
if($scope.selectedItems) {
$scope.associate_groups.forEach(function(row, i) {
- if (_.includes($scope.selectedItems, row.id)) {
- $scope.associate_groups[i].isSelected = true;
- }
+ $scope.selectedItems.forEach(function(selectedItem) {
+ if(selectedItem.id === row.id) {
+ $scope.associate_groups[i].isSelected = true;
+ }
+ });
});
}
});
@@ -72,14 +78,14 @@
let item = value.value;
if (value.isSelected) {
- $scope.selectedItems.push(item.id);
+ $scope.selectedItems.push(item);
}
else {
// _.remove() Returns the new array of removed elements.
// This will pull all the values out of the array that don't
// match the deselected item effectively removing it
$scope.selectedItems = _.remove($scope.selectedItems, function(selectedItem) {
- return selectedItem !== item.id;
+ return selectedItem.id !== item.id;
});
}
});
diff --git a/awx/ui/client/src/shared/instance-groups-multiselect/instance-groups-modal/instance-groups-modal.directive.js b/awx/ui/client/src/shared/instance-groups-multiselect/instance-groups-modal/instance-groups-modal.directive.js
index 9f3ef11658..271ed97901 100644
--- a/awx/ui/client/src/shared/instance-groups-multiselect/instance-groups-modal/instance-groups-modal.directive.js
+++ b/awx/ui/client/src/shared/instance-groups-multiselect/instance-groups-modal/instance-groups-modal.directive.js
@@ -46,7 +46,10 @@ export default ['templateUrl', function(templateUrl) {
instanceGroupList.listTitle = false;
instanceGroupList.well = false;
instanceGroupList.multiSelect = true;
- instanceGroupList.multiSelectExtended = true;
+ instanceGroupList.multiSelectPreview = {
+ selectedRows: 'igTags',
+ availableRows: 'instance_groups'
+ };
delete instanceGroupList.fields.percent_capacity_remaining;
delete instanceGroupList.fields.jobs_running;
@@ -104,4 +107,4 @@ export default ['templateUrl', function(templateUrl) {
};
}]
};
-}];
\ No newline at end of file
+}];
diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js
index a735c16ff7..e4ac25273e 100644
--- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js
+++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js
@@ -163,6 +163,10 @@ export default ['$compile', 'Attr', 'Icon',
html += "\n";
}
+ if (list.multiSelectPreview) {
+ html += "