mirror of
https://github.com/ansible/awx.git
synced 2026-07-12 00:44:36 -02:30
Merge branch 'master' of github.com:ansible/ansible-tower
Conflicts: awx/ui/static/js/helpers/Variables.js
This commit is contained in:
@@ -107,6 +107,10 @@ angular.module('PermissionFormDefinition', [])
|
||||
value: 'admin',
|
||||
ngShow: "category == 'Inventory'"
|
||||
}, {
|
||||
label: 'Create',
|
||||
value: 'create',
|
||||
ngShow: "category == 'Deploy'"
|
||||
}, {
|
||||
label: 'Run',
|
||||
value: 'run',
|
||||
ngShow: "category == 'Deploy'"
|
||||
@@ -135,4 +139,4 @@ angular.module('PermissionFormDefinition', [])
|
||||
|
||||
related: { }
|
||||
|
||||
}); // Form
|
||||
}); // Form
|
||||
|
||||
@@ -171,7 +171,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
"class": "btn btn-default",
|
||||
"id": "password-cancel-button"
|
||||
},{
|
||||
label: "Continue",
|
||||
label: "Launch",
|
||||
onClick: function() {
|
||||
scope.$emit(callback);
|
||||
},
|
||||
|
||||
@@ -34,6 +34,8 @@ angular.module('PermissionsHelper', [])
|
||||
} else {
|
||||
scope.projectrequired = true;
|
||||
html = "<dl>\n" +
|
||||
"<dt>Create</dt>\n" +
|
||||
"<dd>Allow the user or team to create deployments. This implies that they can run and check deployments</dd>\n" +
|
||||
"<dt>Run</dt>\n" +
|
||||
"<dd>Allow the user or team to perform a live deployment of the project against the inventory. In Run mode modules will " +
|
||||
"be executed, and changes to the inventory will occur.</dd>\n" +
|
||||
|
||||
@@ -103,59 +103,40 @@ angular.module('VariablesHelper', ['Utilities'])
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
|
||||
$.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 + '.';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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 + '.';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
json_data = {};
|
||||
$log.error('Failed to parse YAML string. Parser returned: ' + e.message);
|
||||
json_data = undefined; // {};
|
||||
// $log.error('Failed to parse YAML string. Parser returned undefined');
|
||||
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
|
||||
if (typeof json_data !== 'object') {
|
||||
ProcessErrors(null, variables, null, null, { hdr: 'Error!',
|
||||
msg: 'Failed to parse variables. Attempted to parse ' + parseType + ' Parser did not return an object.' });
|
||||
setTimeout( function() {
|
||||
throw { name: 'Parse error', message: 'Failed to parse variables. Attempted to parse ' + parseType + ' Parser did not return an object.' };
|
||||
}, 1000);
|
||||
// setTimeout( function() {
|
||||
throw 'Parse error. Failed to parse variables.';
|
||||
// }, 1000);
|
||||
}
|
||||
result = json_data;
|
||||
if (stringify) {
|
||||
if ($.isEmptyObject(json_data)) {
|
||||
if(json_data === undefined){
|
||||
result = undefined;
|
||||
}
|
||||
else if ($.isEmptyObject(json_data)) {
|
||||
result = "";
|
||||
} else {
|
||||
result = JSON.stringify(json_data, undefined, '\t');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user