X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditDescriptorModelProperties.js;h=b510715107f1c8142f70201a3ef76aaac776fbed;hp=59d2f95d6b508606f4a77c09bc63bc2f323bd6ab;hb=3b6a64f8e61794b1283d707e60c2b698c988d3fb;hpb=d6fe3a42ce1833b3646870cee06a71c602007e47 diff --git a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js index 59d2f95d6..b51071510 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -39,6 +39,7 @@ import SelectionManager from '../libraries/SelectionManager' import DeletionManager from '../libraries/DeletionManager' import DescriptorModelIconFactory from '../libraries/model/IconFactory' import getEventPath from '../libraries/getEventPath' +import CatalogDataStore from '../stores/CatalogDataStore' import imgAdd from '../../../node_modules/open-iconic/svg/plus.svg' import imgRemove from '../../../node_modules/open-iconic/svg/trash.svg' @@ -173,16 +174,19 @@ export default function EditDescriptorModelProperties(props) { } function buildField(container, property, path, value, fieldKey) { + let cds = CatalogDataStore; + let catalogs = cds.getTransientCatalogs(); const name = path.join('.'); const isEditable = true; const isGuid = Property.isGuid(property); const onChange = onFormFieldValueChanged.bind(container); const isEnumeration = Property.isEnumeration(property); + const isLeafRef = Property.isLeafRef(property); const onFocus = onFocusPropertyFormInputElement.bind(container, property, path, value); const placeholder = changeCase.title(property.name); const className = ClassNames(property.name + '-input', {'-is-guid': isGuid}); - const fieldValue = value ? value.constructor.name == "String" ? value : '' : undefined; + const fieldValue = value ? (value.constructor.name != "Object") ? value : '' : undefined; if (isEnumeration) { const enumeration = Property.getEnumeration(property, value); const options = enumeration.map((d, i) => { @@ -200,6 +204,26 @@ export default function EditDescriptorModelProperties(props) { return ; } + if (isLeafRef) { + let fullFieldKey = _.isArray(fieldKey) ? fieldKey.join(':') : fieldKey; + let containerRef = container; + while (containerRef.parent) { + fullFieldKey = containerRef.parent.key + ':' + fullFieldKey; + containerRef = containerRef.parent; + } + const leafRefPathValues = Property.getLeafRef(property, path, value, fullFieldKey, catalogs, container); + + const options = leafRefPathValues && leafRefPathValues.map((d, i) => { + return ; + }); + const isValueSet = leafRefPathValues.filter(d => d.isSelected).length > 0; + if (!isValueSet || property.cardinality === '0..1') { + const noValueDisplayText = changeCase.title(property.name); + options.unshift(); + } + return ; + } + if (property['preserve-line-breaks']) { return