mirror of
https://github.com/ansible/awx.git
synced 2026-04-05 01:59:25 -02:30
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:
@@ -87,6 +87,10 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
// lines, i, newVars = [];
|
// lines, i, newVars = [];
|
||||||
if (parseType === 'json') {
|
if (parseType === 'json') {
|
||||||
try {
|
try {
|
||||||
|
// perform a check to see if the user cleared the field completly
|
||||||
|
if(variables === "" ){
|
||||||
|
variables = "{}";
|
||||||
|
}
|
||||||
//parse a JSON string
|
//parse a JSON string
|
||||||
if (reviver) {
|
if (reviver) {
|
||||||
json_data = JSON.parse(variables, reviver);
|
json_data = JSON.parse(variables, reviver);
|
||||||
@@ -103,7 +107,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if(variables=== ""){
|
if(variables === ""){
|
||||||
variables = '---';
|
variables = '---';
|
||||||
}
|
}
|
||||||
json_data = jsyaml.load(variables);
|
json_data = jsyaml.load(variables);
|
||||||
|
|||||||
Reference in New Issue
Block a user