mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Fix job template extra vars form validation
This commit is contained in:
@@ -72,7 +72,13 @@
|
|||||||
$scope.removeChoicesReady();
|
$scope.removeChoicesReady();
|
||||||
}
|
}
|
||||||
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
|
$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++;
|
selectCount++;
|
||||||
if (selectCount === 3) {
|
if (selectCount === 3) {
|
||||||
var verbosity;
|
var verbosity;
|
||||||
@@ -279,7 +285,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (fld !== 'variables' &&
|
if (fld !== 'extra_vars' &&
|
||||||
fld !== 'survey' &&
|
fld !== 'survey' &&
|
||||||
fld !== 'forks') {
|
fld !== 'forks') {
|
||||||
data[fld] = $scope[fld];
|
data[fld] = $scope[fld];
|
||||||
@@ -304,7 +310,7 @@
|
|||||||
delete data.credential;
|
delete data.credential;
|
||||||
delete data.vault_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
|
// We only want to set the survey_enabled flag to
|
||||||
// true for this job template if a survey exists
|
// true for this job template if a survey exists
|
||||||
|
|||||||
@@ -251,7 +251,12 @@ export default
|
|||||||
default_val: dft
|
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();
|
jobTemplateLoadFinished();
|
||||||
});
|
});
|
||||||
@@ -275,7 +280,7 @@ export default
|
|||||||
$scope.name = jobTemplateData.name;
|
$scope.name = jobTemplateData.name;
|
||||||
var fld, i;
|
var fld, i;
|
||||||
for (fld in form.fields) {
|
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 (form.fields[fld].type === 'select') {
|
||||||
if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) {
|
if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) {
|
||||||
for (i = 0; i < $scope[fld + '_options'].length; i++) {
|
for (i = 0; i < $scope[fld + '_options'].length; i++) {
|
||||||
@@ -300,10 +305,10 @@ export default
|
|||||||
master[fld] = $scope[fld];
|
master[fld] = $scope[fld];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fld === 'variables') {
|
if (fld === 'extra_vars') {
|
||||||
// Parse extra_vars, converting to YAML.
|
// Parse extra_vars, converting to YAML.
|
||||||
$scope.variables = ParseVariableString(jobTemplateData.extra_vars);
|
$scope.extra_vars = ParseVariableString(jobTemplateData.extra_vars);
|
||||||
master.variables = $scope.variables;
|
master.extra_vars = $scope.extra_vars;
|
||||||
}
|
}
|
||||||
if (form.fields[fld].type === 'lookup' && jobTemplateData.summary_fields[form.fields[fld].sourceModel]) {
|
if (form.fields[fld].type === 'lookup' && jobTemplateData.summary_fields[form.fields[fld].sourceModel]) {
|
||||||
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
|
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
|
||||||
@@ -617,7 +622,7 @@ export default
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (fld !== 'variables' &&
|
if (fld !== 'extra_vars' &&
|
||||||
fld !== 'survey' &&
|
fld !== 'survey' &&
|
||||||
fld !== 'forks') {
|
fld !== 'forks') {
|
||||||
data[fld] = $scope[fld];
|
data[fld] = $scope[fld];
|
||||||
@@ -654,7 +659,7 @@ export default
|
|||||||
data.vault_credential = null;
|
data.vault_credential = null;
|
||||||
}
|
}
|
||||||
data.extra_vars = ToJSON($scope.parseType,
|
data.extra_vars = ToJSON($scope.parseType,
|
||||||
$scope.variables, true);
|
$scope.extra_vars, true);
|
||||||
|
|
||||||
// We only want to set the survey_enabled flag to
|
// We only want to set the survey_enabled flag to
|
||||||
// true for this job template if a survey exists
|
// true for this job template if a survey exists
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ function(NotificationsList, i18n) {
|
|||||||
alwaysShowAsterisk: true
|
alwaysShowAsterisk: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
variables: {
|
extra_vars: {
|
||||||
label: i18n._('Extra Variables'),
|
label: i18n._('Extra Variables'),
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
class: 'Form-textAreaLabel Form-formGroup--fullWidth',
|
class: 'Form-textAreaLabel Form-formGroup--fullWidth',
|
||||||
|
|||||||
Reference in New Issue
Block a user