diff options
author | imamSidero <imam.hussain@est.tech> | 2022-12-21 17:51:43 +0000 |
---|---|---|
committer | imamSidero <imam.hussain@est.tech> | 2023-01-03 15:03:15 +0000 |
commit | db3e2ef238fa29e06cec3cb3f5b11fb407b161ce (patch) | |
tree | 1dbca1372aa87c881a4ed93a8788e3eff0d38e9d /catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts | |
parent | 5b1a92cea1fb437c236a77468f3e8e351e25a990 (diff) |
Provide tosca function to custom datatypes of list and map
Providing the capability to add tosca function as the custom datatypes of list and map
Issue-ID: SDC-4311
Signed-off-by: Imam hussain <imam.hussain@est.tech>
Change-Id: I7ec8943d8008440b091fc4eaa2aba49cdadcda8d
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts index 876fc8e5fa..0b984ac2a4 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts @@ -108,9 +108,21 @@ export class PropertiesUtils { newProps.push(parentProp); if (!property.schema.property.isSimpleType) { - let additionalChildren:Array<DerivedFEProperty> = this.createFlattenedChildren(property.schema.property.type, parentProp.propertiesName); + let additionalChildren:Array<DerivedFEProperty> = this.createFlattenedChildren(property.schema.property.type, parentProp.propertiesName, key); this.assignFlattenedChildrenValues(parentProp.valueObj, additionalChildren, parentProp.propertiesName); - additionalChildren.forEach(prop => prop.canBeDeclared = false); + additionalChildren.forEach(prop => { + prop.canBeDeclared = false; + if (property.subPropertyToscaFunctions != null) { + const subToscaFunctArray : SubPropertyToscaFunction[] = property.subPropertyToscaFunctions; + subToscaFunctArray.forEach(subToscaFunct => { + const keyArray : string[] = subToscaFunct.subPropertyPath; + if (keyArray.length > 1 && prop.mapKey == keyArray[0] && prop.name == keyArray[1]) { + prop.toscaFunction = subToscaFunct.toscaFunction; + } + }); + + } + }); newProps.push(...additionalChildren); } return newProps; @@ -119,10 +131,13 @@ export class PropertiesUtils { /** * Creates derivedFEProperties of a specified type and returns them. */ - private createFlattenedChildren = (type: string, parentName: string):Array<DerivedFEProperty> => { + private createFlattenedChildren = (type: string, parentName: string, key: string):Array<DerivedFEProperty> => { let tempProps: Array<DerivedFEProperty> = []; let dataTypeObj: DataTypeModel = this.dataTypeService.getDataTypeByTypeName(type); this.dataTypeService.getDerivedDataTypeProperties(dataTypeObj, tempProps, parentName); + tempProps.forEach(tempDervObj => { + tempDervObj.mapKey = key; + }); return _.sortBy(tempProps, ['propertiesName']); } @@ -151,7 +166,7 @@ export class PropertiesUtils { } }); } else if (property.derivedDataType === DerivedPropertyType.COMPLEX) { - property.flattenedChildren = this.createFlattenedChildren(property.type, property.name); + property.flattenedChildren = this.createFlattenedChildren(property.type, property.name, ""); this.assignFlattenedChildrenValues(property.valueObj, property.flattenedChildren, property.name); this.setFlattenedChildernToscaFunction(property.subPropertyToscaFunctions, property.flattenedChildren, property.name); property.flattenedChildren.forEach((childProp) => { |