1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Fixed empty Extra Variable JSON parsing issue

if the user saved a job template with empty extra variables and the Parse as option as JSON, then the UI crapped out. I added a check to make sure the default string is '{}' if the user submits an empty field.
This commit is contained in:
Jared Tabor 2014-12-04 11:59:07 -05:00
parent 3164c6d356
commit c05d746d73

View File

@ -87,6 +87,10 @@ angular.module('VariablesHelper', ['Utilities'])
// lines, i, newVars = [];
if (parseType === 'json') {
try {
// perform a check to see if the user cleared the field completly
if(variables === "" ){
variables = "{}";
}
//parse a JSON string
if (reviver) {
json_data = JSON.parse(variables, reviver);
@ -103,7 +107,7 @@ angular.module('VariablesHelper', ['Utilities'])
}
} else {
try {
if(variables=== ""){
if(variables === ""){
variables = '---';
}
json_data = jsyaml.load(variables);