From 7e08a2976d34066412af14fe633eecde3ce19fc7 Mon Sep 17 00:00:00 2001 From: imamSidero Date: Mon, 5 Dec 2022 14:13:39 +0000 Subject: Provide tosca function to List entries Providing the capability to add tosca function as the List entries Issue-ID: SDC-4288 Signed-off-by: Imam hussain Change-Id: Ib2e11945f76b7004dbf8807274ee6333b9d9aa05 --- .../app/models/properties-inputs/derived-fe-property.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'catalog-ui/src/app/models') diff --git a/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts b/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts index 7d832c5193..60d2726575 100644 --- a/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts +++ b/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts @@ -55,7 +55,7 @@ export class DerivedFEProperty extends PropertyBEModel { this.canBeDeclared = true; //defaults to true } else { //creating a direct child of list or map (ie. Item that can be deleted, with UUID instead of name) super(null); - if(property.type === PROPERTY_TYPES.MAP && property.subPropertyToscaFunctions != null){ + if(property.subPropertyToscaFunctions != null){ property.subPropertyToscaFunctions.forEach((item : SubPropertyToscaFunction) => { if(item.subPropertyPath[0] === key){ this.toscaFunction = item.toscaFunction; @@ -69,7 +69,17 @@ export class DerivedFEProperty extends PropertyBEModel { this.propertiesName = parentName + '#' + this.name; if (property.type == PROPERTY_TYPES.LIST) { - this.mapKey = property.schema.property.type.split('.').pop(); + if(property.value != null) { + const valueJson = JSON.parse(property.value); + if (key != '') { + this.mapKey = key; + }else{ + let indexNumber = Number(Object.keys(valueJson).sort().reverse()[0]) + 1; + this.mapKey = indexNumber.toString(); + } + }else { + this.mapKey = "0"; + } this.mapKeyError = null; this.type = property.schema.property.type; if (this.type == PROPERTY_TYPES.MAP){ -- cgit 1.2.3-korg