1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Fix job template extra vars form validation

This commit is contained in:
Marliana Lara 2018-05-03 13:29:04 -04:00
parent 2abf959d84
commit 187534dba8
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
3 changed files with 22 additions and 11 deletions

View File

@ -72,7 +72,13 @@
$scope.removeChoicesReady();
}
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
ParseTypeChange({ scope: $scope, field_id: 'job_template_variables', onChange: callback });
ParseTypeChange({
scope: $scope,
field_id: 'extra_vars',
variable: 'extra_vars',
onChange: callback
});
selectCount++;
if (selectCount === 3) {
var verbosity;
@ -279,7 +285,7 @@
}
}
else {
if (fld !== 'variables' &&
if (fld !== 'extra_vars' &&
fld !== 'survey' &&
fld !== 'forks') {
data[fld] = $scope[fld];
@ -304,7 +310,7 @@
delete data.credential;
delete data.vault_credential;
data.extra_vars = ToJSON($scope.parseType, $scope.variables, true);
data.extra_vars = ToJSON($scope.parseType, $scope.extra_vars, true);
// We only want to set the survey_enabled flag to
// true for this job template if a survey exists

View File

@ -251,7 +251,12 @@ export default
default_val: dft
});
ParseTypeChange({ scope: $scope, field_id: 'job_template_variables', onChange: callback });
ParseTypeChange({
scope: $scope,
field_id: 'extra_vars',
variable: 'extra_vars',
onChange: callback
});
jobTemplateLoadFinished();
});
@ -275,7 +280,7 @@ export default
$scope.name = jobTemplateData.name;
var fld, i;
for (fld in form.fields) {
if (fld !== 'variables' && fld !== 'survey' && fld !== 'forks' && jobTemplateData[fld] !== null && jobTemplateData[fld] !== undefined) {
if (fld !== 'extra_vars' && fld !== 'survey' && fld !== 'forks' && jobTemplateData[fld] !== null && jobTemplateData[fld] !== undefined) {
if (form.fields[fld].type === 'select') {
if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) {
for (i = 0; i < $scope[fld + '_options'].length; i++) {
@ -300,10 +305,10 @@ export default
master[fld] = $scope[fld];
}
}
if (fld === 'variables') {
if (fld === 'extra_vars') {
// Parse extra_vars, converting to YAML.
$scope.variables = ParseVariableString(jobTemplateData.extra_vars);
master.variables = $scope.variables;
$scope.extra_vars = ParseVariableString(jobTemplateData.extra_vars);
master.extra_vars = $scope.extra_vars;
}
if (form.fields[fld].type === 'lookup' && jobTemplateData.summary_fields[form.fields[fld].sourceModel]) {
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
@ -617,7 +622,7 @@ export default
}
}
else {
if (fld !== 'variables' &&
if (fld !== 'extra_vars' &&
fld !== 'survey' &&
fld !== 'forks') {
data[fld] = $scope[fld];
@ -654,7 +659,7 @@ export default
data.vault_credential = null;
}
data.extra_vars = ToJSON($scope.parseType,
$scope.variables, true);
$scope.extra_vars, true);
// We only want to set the survey_enabled flag to
// true for this job template if a survey exists

View File

@ -348,7 +348,7 @@ function(NotificationsList, i18n) {
alwaysShowAsterisk: true
}
},
variables: {
extra_vars: {
label: i18n._('Extra Variables'),
type: 'textarea',
class: 'Form-textAreaLabel Form-formGroup--fullWidth',