X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditDescriptorModelProperties.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditDescriptorModelProperties.js;h=2c4b71c1dd8905a4196a6e9a78e9110d4b524e92;hp=a2373e6466a3ea03771614a482ea113d925eed97;hb=fee1b6e85ac33ab3781a718b64678525ddfc2c9f;hpb=354a4f472b33534f1c0405bbeb8a4cdf250a8713 diff --git a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js index a2373e646..2c4b71c1d 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -342,6 +342,14 @@ export default function EditDescriptorModelProperties(props) { } }); selectedOptionValue = utils.resolvePath(container.model, ['uiState.choice', selectName, 'selected'].join('.')); + } else { + property.properties.map(function(p) { + let pname = p.properties[0].name; + if(container.model.hasOwnProperty(pname)) { + utils.assignPathValue(container.model, ['uiState.choice', selectName, 'selected'].join('.'), [p.name, pname].join('.')); + } + }) + selectedOptionValue = utils.resolvePath(container.model, ['uiState.choice', selectName, 'selected'].join('.')); } } //If selectedOptionValue is present, take first item in string which represents the case name. @@ -358,7 +366,7 @@ export default function EditDescriptorModelProperties(props) { {build(container, d, childPath, childValue, props)} ); - }) : (!isMissingDescriptorMeta) ? build(container, valueProperty, path.concat(valueProperty.name), utils.resolvePath(container.model, path.concat(valueProperty.name).join('.'))) : null + }) : (!isMissingDescriptorMeta) ? build(container, valueProperty, path.concat(valueProperty.name), utils.resolvePath(container.model, path.concat(valueProperty.name).join('.')) || container.model[valueProperty.name]) : null // end magic const onFocus = onFocusPropertyFormInputElement.bind(container, property, path, value); @@ -510,6 +518,14 @@ export default function EditDescriptorModelProperties(props) { if (property.type === 'choice') { value = utils.resolvePath(container.model, ['uiState.choice'].concat(path, 'selected').join('.')); + if(!value) { + property.properties.map(function(p) { + let pname = p.properties[0].name; + if(container.model.hasOwnProperty(pname)) { + value = container.model[pname]; + } + }) + } } let displayValue = typeof value === 'object' ? '' : value;