X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditDescriptorModelProperties.js;h=ed29b265afeb7154b98e93bc0ddd787b1faa8de9;hb=3675ba75a1448e3aa468abb95f177666f8edfa48;hp=c1d65be018c0e1387ec3e3376833d75f78c41eaf;hpb=6dfc2c17a4e7f26ffc4e00685a4b24dd22db7d47;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 c1d65be01..ed29b265a 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -78,6 +78,8 @@ function getTitle(model = {}) { export default function EditDescriptorModelProperties(props) { const container = props.container; + const readonly = props.readonly; + const isEditable = !readonly; //true if (!(DescriptorModelFactory.isContainer(container))) { return @@ -148,6 +150,9 @@ export default function EditDescriptorModelProperties(props) { } CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot()); } + if(readonly) { + return null; + } return ( ); @@ -165,6 +170,9 @@ export default function EditDescriptorModelProperties(props) { } CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot()); } + if(readonly) { + return null; + } return ( ); @@ -175,7 +183,6 @@ export default function EditDescriptorModelProperties(props) { let catalogs = cds.getTransientCatalogs(); const pathToProperty = path.join('.'); - const isEditable = true; const isGuid = Property.isGuid(property); const isBoolean = Property.isBoolean(property); const isEnumeration = Property.isEnumeration(property); @@ -206,7 +213,7 @@ export default function EditDescriptorModelProperties(props) { processFieldValueChange.bind(container, pathToProperty), 2000, {maxWait: 5000})); // max wait for short-name // create an onChange event handler for a select field for the specified field path const onSelectChange = changeHandler.bind(null, processFieldValueChange.bind(container, pathToProperty)); - + if (isEnumeration) { const enumeration = Property.getEnumeration(property, value); const options = enumeration.map((d, i) => { @@ -222,18 +229,18 @@ export default function EditDescriptorModelProperties(props) { options.unshift({noValueDisplayText}); } return ( - + className={ClassNames({'-value-not-set': !isValueSet})} + defaultValue={value} + title={pathToProperty} + onChange={onSelectChange} + onFocus={onFocus} + onBlur={endEditing} + onMouseDown={startEditing} + onMouseOver={startEditing} + disabled={!isEditable}> {options} ); @@ -257,18 +264,18 @@ export default function EditDescriptorModelProperties(props) { options.unshift({noValueDisplayText}); } return ( - + {options} ); @@ -290,28 +297,28 @@ export default function EditDescriptorModelProperties(props) { } const isValueSet = (val != '' && val) return ( - + {options} ); } - + if (Property.isLeafEmpty(property)) { // A null value indicates the leaf exists (as opposed to undefined). // We stick in a string when the user actually sets it to simplify things // but the correct thing happens when we serialize to user data - let isEmptyLeafPresent = (value === EMPTY_LEAF_PRESENT || value === null); + let isEmptyLeafPresent = (value === EMPTY_LEAF_PRESENT || value === null); let present = isEmptyLeafPresent ? EMPTY_LEAF_PRESENT : ""; const options = [ Enabled, @@ -319,18 +326,18 @@ export default function EditDescriptorModelProperties(props) { ] return ( - + {options} ); @@ -338,25 +345,25 @@ export default function EditDescriptorModelProperties(props) { if (property['preserve-line-breaks']) { return ( - + ); } return ( - ); @@ -428,7 +435,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('.')); } @@ -505,7 +512,7 @@ export default function EditDescriptorModelProperties(props) { if(fieldProperties) { //Check each case statement in model and see if it is present in container model. cases.map(function(c){ - if(fieldProperties.hasOwnProperty(c.optionValue.split('.')[1])) { + if(c.optionValue && fieldProperties.hasOwnProperty(c.optionValue.split('.')[1])) { utils.assignPathValue(container.model, ['uiState.choice', pathToChoice, 'selected'].join('.'), c.optionValue); } }); @@ -542,17 +549,18 @@ export default function EditDescriptorModelProperties(props) { return ( - {options} @@ -649,7 +657,7 @@ export default function EditDescriptorModelProperties(props) { let field; const valuePath = path.slice(); // create a unique field Id for use as react component keys and html element ids - // notes: + // notes: // keys only need to be unique on components in the same array // html element ids should be unique with the document (or form) let fieldId = uniqueId; @@ -818,4 +826,3 @@ export default function EditDescriptorModelProperties(props) { ); }; -