Merge pull request #6251 from jakemcdermott/5987-fix-sometimes-missing-verbosity-and-job-type-values

Fix sometimes missing job_type and verbosity field values

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-03-13 19:30:24 +00:00
committed by GitHub

View File

@@ -217,6 +217,7 @@ export default
}); });
$scope.$watch('verbosity', sync_verbosity_select2); $scope.$watch('verbosity', sync_verbosity_select2);
$scope.$watch('job_type', sync_job_type_select2);
SurveyControllerInit({ SurveyControllerInit({
scope: $scope, scope: $scope,
@@ -337,10 +338,31 @@ export default
})); }));
} }
function sync_verbosity_select2() { function sync_verbosity_select2(newValue) {
if (newValue === 0 || (newValue && typeof newValue !== 'object')) {
$scope.verbosity = { value: newValue };
return;
}
select2LoadDefer.push(CreateSelect2({ select2LoadDefer.push(CreateSelect2({
element:'#job_template_verbosity', element:'#job_template_verbosity',
multiple: false multiple: false,
scope: $scope,
model: 'verbosity',
options: 'verbosity_options',
}));
}
function sync_job_type_select2(newValue) {
if (newValue === 0 || (newValue && typeof newValue !== 'object')) {
$scope.job_type = { value: newValue };
return;
}
select2LoadDefer.push(CreateSelect2({
element:'#job_template_job_type',
multiple: false,
scope: $scope,
model: 'job_type',
options: 'job_type_options',
})); }));
} }
@@ -657,7 +679,6 @@ export default
variable: 'verbosity_options', variable: 'verbosity_options',
callback: 'choicesReady' callback: 'choicesReady'
}); });
sync_verbosity_select2();
// setup job type options lookup // setup job type options lookup
GetChoices({ GetChoices({