From: Laurence Maultsby Date: Tue, 17 Jan 2017 14:36:39 +0000 (-0500) Subject: Config parameter map styling pass, 2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=4942bd7d5bb83c05b66c0876d2e020041b4c1b63;p=osm%2FUI.git Config parameter map styling pass, 2 Signed-off-by: Laurence Maultsby --- diff --git a/skyquake/plugins/composer/src/src/components/EditConfigParameterMap.js b/skyquake/plugins/composer/src/src/components/EditConfigParameterMap.js index 1add58c4d..bbf771bb2 100644 --- a/skyquake/plugins/composer/src/src/components/EditConfigParameterMap.js +++ b/skyquake/plugins/composer/src/src/components/EditConfigParameterMap.js @@ -45,7 +45,7 @@ import imgAdd from '../../../node_modules/open-iconic/svg/plus.svg' import imgRemove from '../../../node_modules/open-iconic/svg/trash.svg' import '../styles/EditDescriptorModelProperties.scss' - +import '../styles/EditConfigParameterMap.scss'; function getDescriptorMetaBasicForType(type) { @@ -160,13 +160,14 @@ function startEditing() { if (DescriptorModelFactory.isContainer(this)) { event.preventDefault(); const name = event.target.name; - const value = event.target.value; - utils.assignPathValue(this.model, name, value); + const value = JSON.parse(event.target.value); + utils.assignPathValue(this.model, 'config-parameter-source.config-parameter-source-ref', value.value); + utils.assignPathValue(this.model, 'config-parameter-source.member-vnf-index-ref', value.index); CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot()); } } - function buildField(container, property, path, value, fieldKey) { + function buildField(container, property, path, value, fieldKey, vnfdIndex) { let cds = CatalogDataStore; let catalogs = cds.getTransientCatalogs(); @@ -180,67 +181,53 @@ function startEditing() { const placeholder = changeCase.title(property.name); const className = ClassNames(property.name + '-input', {'-is-guid': isGuid}); const fieldValue = value ? (value.constructor.name != "Object") ? value : '' : undefined; - if (isEnumeration) { - const enumeration = Property.getEnumeration(property, value); - const options = enumeration.map((d, i) => { - // note yangforge generates values for enums but the system does not use them - // so we categorically ignore them - // https://trello.com/c/uzEwVx6W/230-bug-enum-should-not-use-index-only-name - //return ; - return ; - }); - const isValueSet = enumeration.filter(d => d.isSelected).length > 0; - if (!isValueSet || property.cardinality === '0..1') { - const noValueDisplayText = changeCase.title(property.name); - options.unshift(); - } - return ; - } - - if (isLeafRef) { + // if (isEnumeration) { + // const enumeration = Property.getEnumeration(property, value); + // const options = enumeration.map((d, i) => { + // // note yangforge generates values for enums but the system does not use them + // // so we categorically ignore them + // // https://trello.com/c/uzEwVx6W/230-bug-enum-should-not-use-index-only-name + // //return ; + // return ; + // }); + // const isValueSet = enumeration.filter(d => d.isSelected).length > 0; + // if (!isValueSet || property.cardinality === '0..1') { + // const noValueDisplayText = changeCase.title(property.name); + // options.unshift(); + // } + // return ; + // } + + if (isLeafRef && (path.indexOf("config-parameter-source-ref") > -1)) { let fullFieldKey = _.isArray(fieldKey) ? fieldKey.join(':') : fieldKey; let containerRef = container; + let vnfdName = null; + let options = []; + let leafRefPathValues = []; while (containerRef.parent) { fullFieldKey = containerRef.parent.key + ':' + fullFieldKey; containerRef = containerRef.parent; } - const leafRefPathValues = Property.getLeafRef(property, path, value, fullFieldKey, catalogs, container); + let parentProperty = container.parent.constituentVnfd; + parentProperty.map((v, i) => { + let somevalues = Property.getConfigParamRef(property, path, value, fullFieldKey, catalogs, container, v.vnfdId); + options = somevalues && options.concat(somevalues.map((d, i) => { + return ; + })) + leafRefPathValues = leafRefPathValues.concat(somevalues); - const options = leafRefPathValues && leafRefPathValues.map((d, i) => { - return ; }); + const isValueSet = leafRefPathValues.filter(d => d.isSelected).length > 0; - if (!isValueSet || property.cardinality === '0..1') { + if (!isValueSet) { const noValueDisplayText = changeCase.title(property.name); options.unshift(); } - return ; - } - - if (property['preserve-line-breaks']) { - return