summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/nfvo-utils/getValue.js
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui/src/nfvo-utils/getValue.js')
-rw-r--r--openecomp-ui/src/nfvo-utils/getValue.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/openecomp-ui/src/nfvo-utils/getValue.js b/openecomp-ui/src/nfvo-utils/getValue.js
index e6871c094d..101655bf31 100644
--- a/openecomp-ui/src/nfvo-utils/getValue.js
+++ b/openecomp-ui/src/nfvo-utils/getValue.js
@@ -19,14 +19,26 @@ function getValueFromObject(element) {
return element.choices && element.choices.length > 0 && element.choices[0] !== '' && element.choices[0] !== optionInputOther.OTHER ||
element.other && element.choices[0] === optionInputOther.OTHER ?
element : undefined;
-}
+}
function getValueFromVariable(variable) {
return variable ? variable : undefined;
}
let getValue = element => {
- return typeof element === 'object' ? getValueFromObject(element) : getValueFromVariable(element);
+ return typeof element === 'object' ? getValueFromObject(element) : getValueFromVariable(element);
};
- export default getValue; \ No newline at end of file
+export function getStrValue(choiceObject) {
+ if (!choiceObject) {
+ return undefined;
+ }
+ if (choiceObject.choice && choiceObject.choice !== '' && choiceObject.choice !== optionInputOther.OTHER) {
+ return choiceObject.choice;
+ }
+ else if (choiceObject.other && choiceObject.choice === optionInputOther.OTHER) {
+ return choiceObject.other;
+ }
+}
+
+ export default getValue;