mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
AC-1035 UI now supports stringified YAML coming from the API on Job Template.
This commit is contained in:
parent
10e85b50b1
commit
1ba917afaf
@ -594,8 +594,22 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
data.extra_vars === "" || data.extra_vars === null) {
|
||||
$scope.variables = "---";
|
||||
} else {
|
||||
json_obj = JSON.parse(data.extra_vars);
|
||||
$scope.variables = jsyaml.safeDump(json_obj);
|
||||
$scope.variables = '---';
|
||||
try {
|
||||
json_obj = JSON.parse(data.extra_vars);
|
||||
$scope.variables = jsyaml.safeDump(json_obj);
|
||||
}
|
||||
catch (e) {
|
||||
$log.info('Attempt to parse extra_vars as JSON faild. Attempting to parse as YAML');
|
||||
try {
|
||||
json_obj = jsyaml.safeLoad(data.extra_vars);
|
||||
$scope.variables = jsyaml.safeDump(json_obj);
|
||||
}
|
||||
catch(e2) {
|
||||
ProcessErrors($scope, data.extra_vars, e2.message, null, { hdr: 'Error!',
|
||||
msg: 'Attempts to parse variables as JSON and YAML failed. Last attempt returned: ' + e2.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
master.variables = $scope.variables;
|
||||
}
|
||||
|
@ -379,8 +379,22 @@ function JobsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, J
|
||||
data.extra_vars === "" || data.extra_vars === null) {
|
||||
$scope.variables = "---";
|
||||
} else {
|
||||
json_obj = JSON.parse(data.extra_vars);
|
||||
$scope.variables = jsyaml.safeDump(json_obj);
|
||||
$scope.variables = '---';
|
||||
try {
|
||||
json_obj = JSON.parse(data.extra_vars);
|
||||
$scope.variables = jsyaml.safeDump(json_obj);
|
||||
}
|
||||
catch (e) {
|
||||
$log.info('Attempt to parse extra_vars as JSON faild. Attempting to parse as YAML');
|
||||
try {
|
||||
json_obj = jsyaml.safeLoad(data.extra_vars);
|
||||
$scope.variables = jsyaml.safeDump(json_obj);
|
||||
}
|
||||
catch(e2) {
|
||||
ProcessErrors($scope, data.extra_vars, e2.message, null, { hdr: 'Error!',
|
||||
msg: 'Attempts to parse variables as JSON and YAML failed. Last attempt returned: ' + e2.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (JobTemplateForm.fields[fld].type === 'lookup' && data.summary_fields[JobTemplateForm.fields[fld].sourceModel]) {
|
||||
|
@ -133,10 +133,13 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
|
||||
return function (scope, data, status, form, defaultMsg) {
|
||||
var field, fieldErrors, msg;
|
||||
Wait('stop');
|
||||
if ($AnsibleConfig.debug_mode && console) {
|
||||
console.log('Debug status: ' + status);
|
||||
console.log('Debug data: ');
|
||||
console.log(data);
|
||||
if ($AnsibleConfig.debug_mode) {
|
||||
$log.debug('Debug status: ' + status);
|
||||
$log.debug('Debug data: ');
|
||||
$log.debug(data);
|
||||
if (defaultMsg.msg) {
|
||||
$log.debug('Debug: ' + defaultMsg.msg);
|
||||
}
|
||||
}
|
||||
if (status === 403) {
|
||||
msg = 'The API responded with a 403 Access Denied error. ';
|
||||
|
Loading…
Reference in New Issue
Block a user