diff options
author | Michael Lando <ml636r@att.com> | 2017-08-10 18:21:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-08-10 18:21:36 +0000 |
commit | ce07d7cd59425944f85d0fef5126ebeef731bc7b (patch) | |
tree | a0d8bb991aa164e01eb930b23f34d9e27999602a /openecomp-ui/src/nfvo-utils/getValue.js | |
parent | 46f9fd57f24428f6a6fd0d290b0463e188975231 (diff) | |
parent | 644017cb3edd5b7a077a634ffd5daf2fee6bc088 (diff) |
Merge "[SDC] OnBoard with enabled tests and features"
Diffstat (limited to 'openecomp-ui/src/nfvo-utils/getValue.js')
-rw-r--r-- | openecomp-ui/src/nfvo-utils/getValue.js | 18 |
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; |