mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -03:30
Added extra logic around survey question choice splitting to prevent console errors
This commit is contained in:
@@ -70,7 +70,7 @@ function PromptService (Empty, $filter) {
|
|||||||
} else {
|
} else {
|
||||||
question.model = question.default.split(/\n/);
|
question.model = question.default.split(/\n/);
|
||||||
}
|
}
|
||||||
question.choices = question.choices.split(/\n/);
|
question.choices = typeof question.choices.split === 'function' ? question.choices.split(/\n/) : question.choices;
|
||||||
}
|
}
|
||||||
else if(question.type === "multiplechoice") {
|
else if(question.type === "multiplechoice") {
|
||||||
if(params.extra_data && params.extra_data[question.variable]) {
|
if(params.extra_data && params.extra_data[question.variable]) {
|
||||||
@@ -80,7 +80,7 @@ function PromptService (Empty, $filter) {
|
|||||||
question.model = question.default ? angular.copy(question.default) : "";
|
question.model = question.default ? angular.copy(question.default) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
question.choices = question.choices.split(/\n/);
|
question.choices = typeof question.choices.split === 'function' ? question.choices.split(/\n/) : question.choices;
|
||||||
|
|
||||||
// Add a default empty string option to the choices array. If this choice is
|
// 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
|
// selected then the extra var will not be sent when we POST to the launch
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function link($sce, $filter, Empty, scope, element, attrs) {
|
|||||||
|
|
||||||
// Split out choices to be consumed by the multiple-choice directive
|
// Split out choices to be consumed by the multiple-choice directive
|
||||||
if (!_.isUndefined(scope.question.choices)) {
|
if (!_.isUndefined(scope.question.choices)) {
|
||||||
scope.choices = scope.question.choices.split('\n');
|
scope.choices = typeof scope.question.choices.split === 'function' ? scope.question.choices.split('\n') : scope.question.choices;
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitizeDefault();
|
sanitizeDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user