From 7449a13dcff5bce8d82f7d49f5413205f00c6dc9 Mon Sep 17 00:00:00 2001 From: Laurence Maultsby Date: Mon, 27 Feb 2017 11:13:01 -0500 Subject: [PATCH] Volume image choice case fix (general choice case fix) Signed-off-by: Laurence Maultsby --- .../src/src/components/EditDescriptorModelProperties.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js index a69f3bba2..816bde55e 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -371,7 +371,8 @@ export default function EditDescriptorModelProperties(props) { const cases = property.properties.map(d => { if (d.type === 'case') { - caseByNameMap[d.name] = d.properties[0]; + //Previous it was assumed that a case choice would have only one property. Now we pass on either the only item or the + caseByNameMap[d.name] = d.properties && (d.properties.length == 1 ? d.properties[0] : d.properties); return { optionName: d.name, optionTitle: d.description, @@ -424,7 +425,9 @@ export default function EditDescriptorModelProperties(props) { const hasProperties = _.isArray(valueProperty.properties) && valueProperty.properties.length; const isMissingDescriptorMeta = !hasProperties && !Property.isLeaf(valueProperty); //Some magic that prevents errors for arising - const valueResponse = valueProperty.properties.length ? valueProperty.properties.map((d, i) => { + const valueResponse = valueProperty.properties && valueProperty.properties.length ? valueProperty.properties.map(valuePropertyFn) : (!isMissingDescriptorMeta) ? build(container, valueProperty, path.concat(valueProperty.name), utils.resolvePath(container.model, path.concat(valueProperty.name).join('.')) || container.model[valueProperty.name]) : + valueProperty.map && valueProperty.map(valuePropertyFn); + function valuePropertyFn(d, i) { const childPath = path.concat(valueProperty.name, d.name); const childValue = utils.resolvePath(container.model, childPath.join('.')); return ( @@ -432,7 +435,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('.')) || container.model[valueProperty.name]) : null + } // end magic const onFocus = onFocusPropertyFormInputElement.bind(container, property, path, value); -- 2.25.1