aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2022-12-21 17:51:43 +0000
committerimamSidero <imam.hussain@est.tech>2023-01-03 15:03:15 +0000
commitdb3e2ef238fa29e06cec3cb3f5b11fb407b161ce (patch)
tree1dbca1372aa87c881a4ed93a8788e3eff0d38e9d /catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function
parent5b1a92cea1fb437c236a77468f3e8e351e25a990 (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/tosca-function')
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts12
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts18
2 files changed, 24 insertions, 6 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
index 0198dfd760..6b43cb014d 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
@@ -29,7 +29,7 @@ import {ToscaFunctionType} from "../../../../models/tosca-function-type.enum";
import {ToscaGetFunctionValidationEvent} from "./tosca-get-function/tosca-get-function.component";
import {ToscaFunction} from "../../../../models/tosca-function";
import {ToscaConcatFunctionValidationEvent} from "./tosca-concat-function/tosca-concat-function.component";
-import {PROPERTY_TYPES} from "../../../../utils/constants";
+import {PROPERTY_TYPES, PROPERTY_DATA} from "../../../../utils/constants";
import {YamlFunctionValidationEvent} from "./yaml-function/yaml-function.component";
import {ToscaConcatFunction} from "../../../../models/tosca-concat-function";
import {YamlFunction} from "../../../../models/yaml-function";
@@ -101,8 +101,14 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
if (this.property instanceof PropertyDeclareAPIModel && this.property.subPropertyToscaFunctions && (<PropertyDeclareAPIModel> this.property).propertiesName){
let propertiesPath = (<PropertyDeclareAPIModel> this.property).propertiesName.split("#");
if (propertiesPath.length > 1){
- let keyToFind = (this.property.type == PROPERTY_TYPES.MAP || this.property.type == PROPERTY_TYPES.LIST) ? [(<DerivedFEProperty>this.property.input).mapKey] : propertiesPath.slice(1);
- let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind !== null ? keyToFind : propertiesPath.slice(1)));
+ let keyToFind = [];
+ if (this.property.type == PROPERTY_TYPES.MAP || this.property.type == PROPERTY_TYPES.LIST) {
+ keyToFind.push((<DerivedFEProperty>this.property.input).mapKey);
+ if (PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.property.schemaType) === -1) {
+ keyToFind.push(propertiesPath.reverse()[0]);
+ }
+ }
+ let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind.length > 0 ? keyToFind : propertiesPath.slice(1)));
if (subPropertyToscaFunction){
this.toscaFunction = subPropertyToscaFunction.toscaFunction;
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts
index 46541cf355..84018fd546 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts
@@ -261,7 +261,15 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
}
private propertyTypeToString() {
- if (this.isSubProperty() && this.property.type != PROPERTY_TYPES.MAP && this.property.type != PROPERTY_TYPES.LIST){
+ if (this.isSubProperty()){
+ if (this.typeHasSchema(this.property.type) && this.property instanceof PropertyDeclareAPIModel &&
+ (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) {
+ if(this.isComplexType(this.property.schemaType)){
+ return this.property.input.type;
+ }else{
+ return this.property.schema.property.type;
+ }
+ }
return this.getType((<PropertyDeclareAPIModel>this.property).propertiesName.split("#").slice(1), this.property.type);
}
if (this.property.schemaType) {
@@ -367,8 +375,12 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
private hasSameType(property: PropertyBEModel | AttributeBEModel): boolean {
if (this.typeHasSchema(this.property.type)) {
- if ((this.property.type === PROPERTY_TYPES.MAP || this.property.type === PROPERTY_TYPES.LIST) && this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) {
- return property.type === this.property.schema.property.type;
+ if (this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) {
+ if(this.isComplexType(this.property.schemaType)){
+ return property.type === this.property.input.type;
+ }else{
+ return property.type === this.property.schema.property.type;
+ }
}
if (!property.schema || !property.schema.property) {
return false;