aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/properties-assignment/services
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-08-26 11:00:03 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-09-07 13:17:19 +0000
commit0411615fe4f55fe3463da2576de376c7478fcfb2 (patch)
tree6e9792f607de443c2d04dde2d54412d0e6a85603 /catalog-ui/src/app/ng2/pages/properties-assignment/services
parent00f293346ed73585faea502c6fc6bac1481f7422 (diff)
Support TOSCA functions in sub properties
Change-Id: Ibfd95c928bbb10089cfc9749ae4e7b05270e3d68 Issue-ID: SDC-4151 Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/services')
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/services/hierarchy-nav.service.ts1
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts18
2 files changed, 19 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/services/hierarchy-nav.service.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/services/hierarchy-nav.service.ts
index 1a800baac7..e3baad6cb2 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/services/hierarchy-nav.service.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/services/hierarchy-nav.service.ts
@@ -44,6 +44,7 @@ export class HierarchyNavService {
});
let tree = this.unflatten(flattenProperties, '', []);
+
return tree[0].childrens; // Return the childrens without the root.
}
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 8e9be8b9a0..753cb6afe0 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
@@ -24,6 +24,7 @@ import { DataTypeModel, PropertyFEModel, PropertyBEModel, InstanceBePropertiesMa
import { DataTypeService } from "app/ng2/services/data-type.service";
import { PropertiesService } from "app/ng2/services/properties.service";
import { PROPERTY_TYPES, PROPERTY_DATA } from "app/utils";
+import { SubPropertyToscaFunction } from "app/models/sub-property-tosca-function";
@Injectable()
export class PropertiesUtils {
@@ -143,14 +144,31 @@ export class PropertiesUtils {
} else if (property.derivedDataType === DerivedPropertyType.COMPLEX) {
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) => {
property.childPropUpdated(childProp);
});
+
}
}
property.updateValueObjOrig();
};
+ public setFlattenedChildernToscaFunction = (subPropertyToscaFunctions: SubPropertyToscaFunction[], derivedPropArray: Array<DerivedFEProperty>, topLevelPropertyName: string) => {
+ if (!subPropertyToscaFunctions || !derivedPropArray || !topLevelPropertyName){
+ return;
+ }
+ derivedPropArray.forEach((prop, index) => {
+ const subPropertyPath = prop.propertiesName.substring(prop.propertiesName.indexOf(topLevelPropertyName) + topLevelPropertyName.length + 1);
+ subPropertyToscaFunctions.forEach(subPropertyToscaFunction => {
+ const toscaFunctionPath = subPropertyToscaFunction.subPropertyPath.join('#');
+ if (subPropertyPath === toscaFunctionPath){
+ prop.toscaFunction = subPropertyToscaFunction.toscaFunction;
+ }
+ })
+ })
+ }
+
/*
* Loops through flattened properties array and to assign values
* Then, convert any neccessary strings to objects, and vis-versa