aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2022-12-05 14:13:39 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-12-19 17:36:36 +0000
commit7e08a2976d34066412af14fe633eecde3ce19fc7 (patch)
tree9ae3fa04c966ddcb02686ff78d7660b031b909dc /catalog-ui/src/app/models
parenta64c4b2e9ede88f2448bde3c80a36f3b5770ca57 (diff)
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 <imam.hussain@est.tech> Change-Id: Ib2e11945f76b7004dbf8807274ee6333b9d9aa05
Diffstat (limited to 'catalog-ui/src/app/models')
-rw-r--r--catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts14
1 files changed, 12 insertions, 2 deletions
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){