mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 03:01:06 -03:30
JSHint
fixed some jshint errors for extra_vars fix from earlier. also changed the launch configuration modal button to 'Launch' instead of continue
This commit is contained in:
@@ -171,7 +171,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
"class": "btn btn-default",
|
"class": "btn btn-default",
|
||||||
"id": "password-cancel-button"
|
"id": "password-cancel-button"
|
||||||
},{
|
},{
|
||||||
label: "Continue",
|
label: "Launch",
|
||||||
onClick: function() {
|
onClick: function() {
|
||||||
scope.$emit(callback);
|
scope.$emit(callback);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -103,59 +103,43 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// if(variables.indexOf('{{')>-1){
|
|
||||||
// lines = variables.split(/\n/);
|
|
||||||
// for(i=0; i<lines.length; i++){
|
|
||||||
// if(lines[i].indexOf('{{')>-1){
|
|
||||||
// lines[i] = lines[i].replace('{{', '"{{');
|
|
||||||
// // lines[i] = lines[i].replace(lines[i].lastIndexOf('}}'), '}}"');
|
|
||||||
// lines[i] = lines[i]+'"';
|
|
||||||
// // newVars = newVars+ lines[i];
|
|
||||||
// newVars.push(lines[i])
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// json_data = jsyaml.load(newVars.toString());
|
|
||||||
|
|
||||||
// bracketVar = variables.substr(variables.indexOf('{{'), variables.indexOf('}}'));
|
|
||||||
// bracketVar = bracketVar.trimRight();
|
|
||||||
// key = variables.substr(0, variables.indexOf(':'));
|
|
||||||
// json_data = jsyaml.load(variables);
|
|
||||||
// json_data[key] = bracketVar;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
json_data = jsyaml.load(variables);
|
json_data = jsyaml.load(variables);
|
||||||
|
if(json_data!==null){
|
||||||
|
$.each( json_data, function( key, value ) {
|
||||||
|
// console.log( key + ": " + value );
|
||||||
|
if(value.toString() === "[object Object]"){
|
||||||
|
json_data = undefined;
|
||||||
|
throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$.each( json_data, function( key, value ) {
|
|
||||||
console.log( key + ": " + value );
|
|
||||||
if(value.toString() === "[object Object]"){
|
|
||||||
//$log.error('Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.');
|
|
||||||
|
|
||||||
throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
json_data = {};
|
json_data = undefined; // {};
|
||||||
$log.error('Failed to parse YAML string. Parser returned: ' + e.message);
|
// $log.error('Failed to parse YAML string. Parser returned undefined');
|
||||||
ProcessErrors(null, variables, e.message, null, { hdr: 'Error!',
|
ProcessErrors(null, variables, e.message, null, { hdr: 'Error!',
|
||||||
msg: 'Failed to parse YAML string. Parser returned: ' + e.message });
|
msg: 'Failed to parse YAML string. Parser returned undefined'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make sure our JSON is actually an object
|
// Make sure our JSON is actually an object
|
||||||
if (typeof json_data !== 'object') {
|
if (typeof json_data !== 'object') {
|
||||||
ProcessErrors(null, variables, null, null, { hdr: 'Error!',
|
ProcessErrors(null, variables, null, null, { hdr: 'Error!',
|
||||||
msg: 'Failed to parse variables. Attempted to parse ' + parseType + ' Parser did not return an object.' });
|
msg: 'Failed to parse variables. Attempted to parse ' + parseType + ' Parser did not return an object.' });
|
||||||
setTimeout( function() {
|
// setTimeout( function() {
|
||||||
throw { name: 'Parse error', message: 'Failed to parse variables. Attempted to parse ' + parseType + ' Parser did not return an object.' };
|
throw 'Parse error. Failed to parse variables.';
|
||||||
}, 1000);
|
// }, 1000);
|
||||||
}
|
}
|
||||||
result = json_data;
|
result = json_data;
|
||||||
if (stringify) {
|
if (stringify) {
|
||||||
if ($.isEmptyObject(json_data)) {
|
if(json_data === undefined){
|
||||||
result = undefined;
|
result = undefined;
|
||||||
|
}
|
||||||
|
else if ($.isEmptyObject(json_data)) {
|
||||||
|
result = "";
|
||||||
} else {
|
} else {
|
||||||
result = JSON.stringify(json_data, undefined, '\t');
|
result = JSON.stringify(json_data, undefined, '\t');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user