diff --git a/ansibleworks/ui/static/js/controllers/JobTemplates.js b/ansibleworks/ui/static/js/controllers/JobTemplates.js index 9505cab3af..2ad7dca81f 100644 --- a/ansibleworks/ui/static/js/controllers/JobTemplates.js +++ b/ansibleworks/ui/static/js/controllers/JobTemplates.js @@ -233,33 +233,26 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP // Save scope.formSave = function() { - try { - // Make sure we have valid JSON - var myjson = JSON.parse(scope.extra_vars); - Rest.setUrl(defaultUrl); - var data = {} - for (var fld in form.fields) { - if (form.fields[fld].type == 'select' && fld != 'playbook') { - data[fld] = scope[fld].value; - } - else { - data[fld] = scope[fld]; - } - } - Rest.post(data) - .success( function(data, status, headers, config) { - var base = $location.path().replace(/^\//,'').split('/')[0]; - (base == 'job_templates') ? ReturnToCaller() : ReturnToCaller(1); - }) - .error( function(data, status, headers, config) { - ProcessErrors(scope, data, status, form, - { hdr: 'Error!', msg: 'Failed to add new project. POST returned status: ' + status }); - }); - } - catch(err) { - Alert("Error", "Error parsing extra variables. Expecting valid JSON. Parser returned " + err); - } - }; + Rest.setUrl(defaultUrl); + var data = {} + for (var fld in form.fields) { + if (form.fields[fld].type == 'select' && fld != 'playbook') { + data[fld] = scope[fld].value; + } + else { + data[fld] = scope[fld]; + } + } + Rest.post(data) + .success( function(data, status, headers, config) { + var base = $location.path().replace(/^\//,'').split('/')[0]; + (base == 'job_templates') ? ReturnToCaller() : ReturnToCaller(1); + }) + .error( function(data, status, headers, config) { + ProcessErrors(scope, data, status, form, + { hdr: 'Error!', msg: 'Failed to add new project. POST returned status: ' + status }); + }); + }; // Reset scope.formReset = function() { @@ -419,33 +412,26 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route // Save changes to the parent scope.formSave = function() { - try { - // Make sure we have valid JSON - var myjson = JSON.parse(scope.extra_vars); - Rest.setUrl(defaultUrl + $routeParams.id + '/'); - var data = {} - for (var fld in form.fields) { - if (form.fields[fld].type == 'select' && fld != 'playbook') { - data[fld] = scope[fld].value; - } - else { - data[fld] = scope[fld]; - } - } - Rest.put(data) - .success( function(data, status, headers, config) { - var base = $location.path().replace(/^\//,'').split('/')[0]; - (base == 'job_templates') ? ReturnToCaller() : ReturnToCaller(1); - }) - .error( function(data, status, headers, config) { - ProcessErrors(scope, data, status, form, - { hdr: 'Error!', msg: 'Failed to update team: ' + $routeParams.id + '. PUT status: ' + status }); - }); - } - catch(err) { - Alert("Error", "Error parsing extra variables. Expecting valid JSON. Parser returned " + err); - } - }; + var data = {} + for (var fld in form.fields) { + if (form.fields[fld].type == 'select' && fld != 'playbook') { + data[fld] = scope[fld].value; + } + else { + data[fld] = scope[fld]; + } + } + Rest.setUrl(defaultUrl + $routeParams.id + '/'); + Rest.put(data) + .success( function(data, status, headers, config) { + var base = $location.path().replace(/^\//,'').split('/')[0]; + (base == 'job_templates') ? ReturnToCaller() : ReturnToCaller(1); + }) + .error( function(data, status, headers, config) { + ProcessErrors(scope, data, status, form, + { hdr: 'Error!', msg: 'Failed to update team: ' + $routeParams.id + '. PUT status: ' + status }); + }); + }; // Cancel scope.formReset = function() { diff --git a/ansibleworks/ui/static/js/forms/JobTemplates.js b/ansibleworks/ui/static/js/forms/JobTemplates.js index a921fc8a2d..4801d136c3 100644 --- a/ansibleworks/ui/static/js/forms/JobTemplates.js +++ b/ansibleworks/ui/static/js/forms/JobTemplates.js @@ -136,11 +136,9 @@ angular.module('JobTemplateFormDefinition', []) editRequired: false, "default": "\{\}", column: 2, - awPopOver: "
Enter variables as JSON. Both the key and value must be wrapped in double quotes. " + - "Separate variables with commas, and wrap the entire string with { }. " + - " For example:
{
"ntp_server": "ntp.example.com",
" +
- '"proxy": "proxy.example.com"
}
See additional JSON examples at www.json.org
', + awPopOver: "Pass extra command line variables to the playbook. This is the -e or --extra-vars command line parameter " + + "for ansible-playbook. Provide key=value pairs or JSON.
Click here to view documentation and examples.
", dataTitle: 'Extra Variables', dataPlacement: 'left' } diff --git a/ansibleworks/ui/static/js/forms/Jobs.js b/ansibleworks/ui/static/js/forms/Jobs.js index 47ab15f544..26d23bfe02 100644 --- a/ansibleworks/ui/static/js/forms/Jobs.js +++ b/ansibleworks/ui/static/js/forms/Jobs.js @@ -129,6 +129,9 @@ angular.module('JobFormDefinition', []) "class": 'span12', addRequired: false, editRequired: false, + awPopOver: "Pass extra command line variables to the playbook. This is the -e or --extra-vars command line parameter " + + "for ansible-playbook. Provide key=value pairs or JSON.
", column: 2 } },