From fdbb885b08f9203d19b65c65791b89eeba8618d9 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 22 Apr 2015 14:07:13 -0400 Subject: [PATCH] fixing issue with select2 data collection there was an error with not collecting select2 data if there were no source_regions chosen for the source selected. --- awx/ui/static/js/helpers/Groups.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 5e096a04f7..f186942701 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -1253,12 +1253,14 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name }; // Create a string out of selected list of regions - regions = $('#source_source_regions').select2("data"); - r = []; - for (i = 0; i < regions.length; i++) { - r.push(regions[i].id); + if(sources_scope.source_regions){ + regions = $('#source_source_regions').select2("data"); + r = []; + for (i = 0; i < regions.length; i++) { + r.push(regions[i].id); + } + data.source_regions = r.join(); } - data.source_regions = r.join(); if (sources_scope.source && (sources_scope.source.value === 'ec2')) { data.instance_filters = sources_scope.instance_filters; @@ -1380,7 +1382,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name group_created = true; group_id = data.id; sources_scope.source_url = data.related.inventory_source; - if (properties_scope.variables) { + if (properties_scope.variables && properties_scope.variables !== "---") { modal_scope.$emit('updateVariables', json_data, data.related.variable_data); } else {