mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 06:01:25 -03:30
Merge pull request #5996 from mabashian/5972-single-select-survey
Optional single select survey question with default bug fix
This commit is contained in:
commit
34c278fef5
@ -42,6 +42,13 @@ export default
|
||||
else if(question.type === "multiplechoice") {
|
||||
question.model = question.default ? angular.copy(question.default) : "";
|
||||
question.choices = question.choices.split(/\n/);
|
||||
|
||||
// Add a default empty string option to the choices array. If this choice is
|
||||
// selected then the extra var will not be sent when we POST to the launch
|
||||
// endpoint
|
||||
if(!question.required) {
|
||||
question.choices.unshift('');
|
||||
}
|
||||
}
|
||||
else if(question.type === "float"){
|
||||
question.model = (!Empty(question.default)) ? angular.copy(question.default) : (!Empty(question.default_float)) ? angular.copy(question.default_float) : "";
|
||||
|
||||
@ -90,9 +90,9 @@ export default
|
||||
// for optional select lists, if they are left blank make sure we submit
|
||||
// a value that the API will consider "empty"
|
||||
//
|
||||
case "multiplechoice":
|
||||
job_launch_data.extra_vars[fld] = "";
|
||||
break;
|
||||
// ISSUE: I don't think this logic ever actually fires
|
||||
// When I tested this, we don't pass this extra var back
|
||||
// through the api when the mutliselect is optional and empty
|
||||
case "multiselect":
|
||||
job_launch_data.extra_vars[fld] = [];
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user