From 8dc65f554336541c0cd605e0fe6587dd2ca6bdd0 Mon Sep 17 00:00:00 2001 From: imamSidero Date: Tue, 15 Nov 2022 10:18:16 +0000 Subject: Provide tosca function to map values Providing the capability to add tosca function as the map values against it's key Issue-ID: SDC-4264 Signed-off-by: Imam hussain Change-Id: Ieaa49f9ac18b848bfd3996e9c6e08f9b4a32b999 --- .../tosca-function/tosca-function.component.ts | 6 +++--- .../tosca-get-function/tosca-get-function.component.ts | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function') 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 e40a4d6e1e..bc73796672 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 @@ -18,7 +18,7 @@ */ import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; -import {ComponentMetadata, PropertyBEModel, PropertyDeclareAPIModel} from 'app/models'; +import {ComponentMetadata, PropertyBEModel, PropertyDeclareAPIModel, DerivedFEProperty} from 'app/models'; import {TopologyTemplateService} from "../../../services/component-services/topology-template.service"; import {WorkspaceService} from "../../workspace/workspace.service"; import {ToscaGetFunctionType} from "../../../../models/tosca-get-function-type"; @@ -101,8 +101,8 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { if (this.property instanceof PropertyDeclareAPIModel && this.property.subPropertyToscaFunctions && ( this.property).propertiesName){ let propertiesPath = ( this.property).propertiesName.split("#"); if (propertiesPath.length > 1){ - propertiesPath = propertiesPath.slice(1); - let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, propertiesPath)); + let keyToFind = this.property.type === PROPERTY_TYPES.MAP ? [(this.property.input).mapKey] : propertiesPath.slice(1); + let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind !== null ? 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 a32a4d0e45..0757e3d361 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 @@ -18,7 +18,7 @@ */ import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; -import {AttributeBEModel, ComponentMetadata, DataTypeModel, PropertyBEModel, PropertyModel, PropertyDeclareAPIModel} from 'app/models'; +import {AttributeBEModel, ComponentMetadata, DataTypeModel, PropertyBEModel, PropertyModel, PropertyDeclareAPIModel, DerivedFEProperty} from 'app/models'; import {TopologyTemplateService} from "../../../../services/component-services/topology-template.service"; import {WorkspaceService} from "../../../workspace/workspace.service"; import {PropertiesService} from "../../../../services/properties.service"; @@ -261,7 +261,7 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges { } private propertyTypeToString() { - if (this.isSubProperty()){ + if (this.isSubProperty() && this.property.type != PROPERTY_TYPES.MAP){ return this.getType((this.property).propertiesName.split("#").slice(1), this.property.type); } if (this.property.schemaType) { @@ -367,6 +367,9 @@ 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 instanceof PropertyDeclareAPIModel && ( this.property).input instanceof DerivedFEProperty){ + return property.type === this.property.schema.property.type; + } if (!property.schema || !property.schema.property) { return false; } -- cgit 1.2.3-korg