X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditDescriptorModelProperties.js;h=e75f3cd53ed896201382c68696277cb055a74ed1;hb=b584e4b139ec4a30a97ea42ff54c76753731d707;hp=d04dddfb5a3cff9504a1604fe4ca757c84c60ffe;hpb=3ea4a6fecbcd4265ad9da9c06720e9d879bfbf57;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js index d04dddfb5..e75f3cd53 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -74,7 +74,7 @@ function getTitle(model = {}) { export default function EditDescriptorModelProperties(props) { const container = props.container; - + const readonly = props.readonly; if (!(DescriptorModelFactory.isContainer(container))) { return } @@ -141,6 +141,9 @@ export default function EditDescriptorModelProperties(props) { } CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot()); } + if(readonly) { + return null; + } return ( ); @@ -158,6 +161,9 @@ export default function EditDescriptorModelProperties(props) { } CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot()); } + if(readonly) { + return null; + } return ( ); @@ -178,8 +184,9 @@ export default function EditDescriptorModelProperties(props) { let catalogs = cds.getTransientCatalogs(); const name = path.join('.'); + const isEditable = !readonly; //true const isGuid = Property.isGuid(property); - const isEditable = isGuid; + const isBoolean = Property.isBoolean(property); const onChange = onFormFieldValueChanged.bind(container); const isEnumeration = Property.isEnumeration(property); const isLeafRef = Property.isLeafRef(property); @@ -201,7 +208,7 @@ export default function EditDescriptorModelProperties(props) { const noValueDisplayText = changeCase.title(property.name); options.unshift({noValueDisplayText}); } - return {options}; + return {options}; } if (isLeafRef) { @@ -221,28 +228,54 @@ export default function EditDescriptorModelProperties(props) { const noValueDisplayText = changeCase.title(property.name); options.unshift({noValueDisplayText}); } - return {options}; + return {options}; + } + + if (isBoolean) { + let fullFieldKey = _.isArray(fieldKey) ? fieldKey.join(':') : fieldKey; + let containerRef = container; + while (containerRef.parent) { + fullFieldKey = containerRef.parent.key + ':' + fullFieldKey; + containerRef = containerRef.parent; + } + + const options = [ + TRUE, + FALSE + ] + + // if (!isValueSet) { + const noValueDisplayText = changeCase.title(property.name); + options.unshift(); + // } + let val = value; + if(typeof(val) == 'number') { + val = value ? "TRUE" : "FALSE" + } + const isValueSet = (val != '' && val) + return {options}; } if (property['preserve-line-breaks']) { - return ; + return ; } - return ; } @@ -305,7 +338,7 @@ export default function EditDescriptorModelProperties(props) { // write the current choice value into the state let choiceObject = utils.resolvePath(this.model, [name, selected].join('.')); let isTopCase = false; - if (!choiceObject) { + if (choiceObject) { isTopCase = true; choiceObject = utils.resolvePath(this.model, [selected].join('.')); } @@ -412,7 +445,7 @@ export default function EditDescriptorModelProperties(props) { return ( - + {options} {valueResponse}