diff --git a/awx/ui/static/js/forms/Source.js b/awx/ui/static/js/forms/Source.js
index 0e35a89e55..6973716021 100644
--- a/awx/ui/static/js/forms/Source.js
+++ b/awx/ui/static/js/forms/Source.js
@@ -75,7 +75,7 @@ angular.module('SourceFormDefinition', [])
dataContainer: 'body'
},
group_by: {
- label: 'Group By',
+ label: 'Only Group By',
type: 'text',
ngShow: "source && source.value == 'ec2'",
addRequired: false,
@@ -83,40 +83,54 @@ angular.module('SourceFormDefinition', [])
awMultiselect: 'group_by_choices',
dataTitle: 'Group By',
dataPlacement: 'right',
- awPopOver: "
FIXME: Create these automatic groups by default.
",
+ awPopOver: "FIXME: Create these automatic groups by default. give examples
",
dataContainer: 'body'
},
- group_tag_filters: {
- label: 'Tag Filters',
- type: 'text',
- ngShow: "source && source.value == 'ec2' && group_by.value.indexOf('tag_keys') >= 0", // FIXME: Not sure what's needed to make the last expression work.
- addRequired: false,
- editRequired: false,
- dataTitle: 'Tag Filters',
- dataPlacement: 'right',
- awPopOver: "FIXME: When grouping by tags, specify which tag keys become groups.
",
- dataContainer: 'body'
- },
- custom_script: {
+ // group_tag_filters: {
+ // label: 'Tag Filters',
+ // type: 'text',
+ // ngShow: "source && source.value == 'ec2' && group_by.value.indexOf('tag_keys') >= 0", // FIXME: Not sure what's needed to make the last expression work.
+ // addRequired: false,
+ // editRequired: false,
+ // dataTitle: 'Tag Filters',
+ // dataPlacement: 'right',
+ // awPopOver: "FIXME: When grouping by tags, specify which tag keys become groups.
",
+ // dataContainer: 'body'
+ // },
+ source_script: {
label : "Custom Inventory Scripts",
type: 'lookup',
ngShow: "source && source.value !== '' && source.value === 'custom'",
- sourceModel: 'custom_script',
+ sourceModel: 'source_script',
sourceField: 'name',
- ngClick: 'lookUpCustomScript()',
+ ngClick: 'lookUpCustom_inventory()',
addRequired: false,
editRequired: false
},
- source_vars: {
- label: 'Source Variables',
- ngShow: "source && (source.value == 'file' || source.value == 'ec2' || source.value == 'custom')",
+ extra_vars: {
+ label: 'Environment Variables', //"{{vars_label}}" ,
+ ngShow: "source && (source.value=='custom')",
type: 'textarea',
addRequired: false,
editRequird: false,
rows: 6,
'default': '---',
parseTypeName: 'envParseType',
- dataTitle: 'Source Variables',
+ dataTitle: "Environment Variables", //'Source Variables
',
+ dataPlacement: 'right',
+ awPopOver: "
These are environment variables
",
+ dataContainer: 'body'
+ },
+ source_vars: {
+ label: 'Source Variables', //"{{vars_label}}" ,
+ ngShow: "source && (source.value == 'file' || source.value == 'ec2')",
+ type: 'textarea',
+ addRequired: false,
+ editRequird: false,
+ rows: 6,
+ 'default': '---',
+ parseTypeName: 'envParseType',
+ dataTitle: "Source Variables",
dataPlacement: 'right',
awPopOver: "Override variables found in ec2.ini and used by the inventory update script. For a detailed description of these variables " +
"" +
diff --git a/awx/ui/static/js/helpers/CustomInventory.js b/awx/ui/static/js/helpers/CustomInventory.js
index 64e61952d7..93cd236e2b 100644
--- a/awx/ui/static/js/helpers/CustomInventory.js
+++ b/awx/ui/static/js/helpers/CustomInventory.js
@@ -63,7 +63,7 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc
SearchInit({
scope: scope,
- set: 'custum_inventories',
+ set: 'custom_inventories',
list: list,
url: defaultUrl
});
@@ -187,12 +187,10 @@ function($compile, SchedulerInit, Rest, Wait, CustomInventoryList, CustomInvento
view = GenerateList,
list = CustomInventoryList,
url = GetBasePath('inventory_scripts');
- // base = $location.path().replace(/^\//, '').split('/')[0];
generator.inject(form, { id:'custom-script-dialog', mode: 'add' , scope:scope, related: false, breadCrumbs: false});
generator.reset();
-
// Save
scope.formSave = function () {
generator.clearApiErrors();
@@ -211,7 +209,7 @@ function($compile, SchedulerInit, Rest, Wait, CustomInventoryList, CustomInvento
SearchInit({
scope: scope,
- set: 'custum_inventories',
+ set: 'custom_inventories',
list: list,
url: url
});
@@ -252,7 +250,6 @@ function($compile, CustomInventoryList, Rest, Wait, GenerateList, CustomInventor
list = CustomInventoryList,
master = {},
url = GetBasePath('inventory_scripts');
- // base = $location.path().replace(/^\//, '').split('/')[0];
generator.inject(form, {
id:'custom-script-dialog',
diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js
index 58051cde40..091b12e00c 100644
--- a/awx/ui/static/js/helpers/Groups.js
+++ b/awx/ui/static/js/helpers/Groups.js
@@ -207,13 +207,13 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
}
])
-.factory('SourceChange', ['GetBasePath', 'CredentialList', 'LookUpInit', 'Empty', 'Wait', 'ParseTypeChange',
- function (GetBasePath, CredentialList, LookUpInit, Empty, Wait, ParseTypeChange) {
+.factory('SourceChange', ['GetBasePath', 'CredentialList', 'LookUpInit', 'Empty', 'Wait', 'ParseTypeChange', 'CustomInventoryList' ,
+ function (GetBasePath, CredentialList, LookUpInit, Empty, Wait, ParseTypeChange, CustomInventoryList) {
return function (params) {
var scope = params.scope,
form = params.form,
- kind, url, callback;
+ kind, url, callback, invUrl;
if (!Empty(scope.source)) {
if (scope.source.value === 'file') {
@@ -234,7 +234,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
$('#source_form').removeClass('squeeze');
} else if (scope.source.value === 'ec2') {
scope.source_region_choices = scope.ec2_regions;
- //$('#s2id_group_source_regions').select2('data', []);
$('#s2id_source_source_regions').select2('data', [{
id: 'all',
text: 'All'
@@ -273,6 +272,21 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
}]);
$('#source_form').addClass('squeeze');
}
+ if(scope.source.value==="custom"){
+ invUrl = GetBasePath('inventory_scripts');
+ LookUpInit({
+ url: invUrl,
+ scope: scope,
+ form: form,
+ // current_item: null,
+ list: CustomInventoryList,
+ field: 'source_script',
+ input_type: 'radio'
+ });
+ scope.extra_vars = (Empty(scope.source_vars)) ? "---" : scope.source_vars;
+ ParseTypeChange({ scope: scope, variable: 'extra_vars', parse_variable: form.fields.extra_vars.parseTypeName,
+ field_id: 'source_extra_vars', onReady: callback });
+ }
if (scope.source.value === 'rax' || scope.source.value === 'ec2'|| scope.source.value==='gce' || scope.source.value === 'azure' || scope.source.value === 'vmware') {
kind = (scope.source.value === 'rax') ? 'rax' : (scope.source.value==='gce') ? 'gce' : (scope.source.value==='azure') ? 'azure' : (scope.source.value === 'vmware') ? 'vmware' : 'aws' ;
url = GetBasePath('credentials') + '?cloud=true&kind=' + kind;
@@ -850,6 +864,8 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
Wait('start');
ParseTypeChange({ scope: sources_scope, variable: 'source_vars', parse_variable: SourceForm.fields.source_vars.parseTypeName,
field_id: 'source_source_vars', onReady: waitStop });
+ ParseTypeChange({ scope: sources_scope, variable: 'extra_vars', parse_variable: SourceForm.fields.extra_vars.parseTypeName,
+ field_id: 'source_extra_vars', onReady: waitStop });
}
}
else if ($(e.target).text() === 'Schedule') {
@@ -946,7 +962,12 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
// Parse source_vars, converting to YAML.
sources_scope.source_vars = ParseVariableString(data.source_vars);
master.source_vars = sources_scope.variables;
- } else if (data[fld] !== undefined) {
+ }
+ // else if(fld === "source_script"){
+ // sources_scope[fld] = data
+ // }
+
+ else if (data[fld] !== undefined) {
sources_scope[fld] = data[fld];
master[fld] = sources_scope[fld];
}
@@ -1144,6 +1165,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
credential: sources_scope.credential,
overwrite: sources_scope.overwrite,
overwrite_vars: sources_scope.overwrite_vars,
+ source_script: sources_scope.source_script,
update_on_launch: sources_scope.update_on_launch,
update_cache_timeout: (sources_scope.update_cache_timeout || 0)
};
@@ -1156,11 +1178,19 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
}
data.source_regions = r.join();
- if (sources_scope.source && (sources_scope.source.value === 'ec2' || sources_scope.source.value === 'custom')) {
+ if (sources_scope.source && (sources_scope.source.value === 'ec2')) {
// for ec2, validate variable data
data.source_vars = ToJSON(sources_scope.envParseType, sources_scope.source_vars, true);
}
+ if (sources_scope.source && (sources_scope.source.value === 'custom')) {
+ data.source_vars = ToJSON(sources_scope.envParseType, sources_scope.extra_vars, true);
+ }
+
+ if(sources_scope.source.value === 'custom'){
+ delete(data.credential);
+ }
+
if (!parseError) {
Rest.setUrl(sources_scope.source_url);
Rest.put(data)
diff --git a/awx/ui/static/js/lists/CustomInventory.js b/awx/ui/static/js/lists/CustomInventory.js
index 037ae99dfc..b1be6c4ea2 100644
--- a/awx/ui/static/js/lists/CustomInventory.js
+++ b/awx/ui/static/js/lists/CustomInventory.js
@@ -12,7 +12,7 @@
angular.module('CustomInventoryListDefinition', [])
.value('CustomInventoryList', {
- name: 'custum_inventories',
+ name: 'custom_inventories',
iterator: 'custom_inventory',
selectTitle: 'Add custom inventory',
editTitle: 'Custom Inventories',
diff --git a/awx/ui/static/partials/configure_tower.html b/awx/ui/static/partials/configure_tower.html
index 7b4ca42c0c..ea36a9b539 100644
--- a/awx/ui/static/partials/configure_tower.html
+++ b/awx/ui/static/partials/configure_tower.html
@@ -1,4 +1,5 @@
-