diff options
author | imamSidero <imam.hussain@est.tech> | 2023-01-04 15:16:31 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-05 09:54:53 +0000 |
commit | 01482efa58dd30e82e640f237a654b8b079a7554 (patch) | |
tree | f3c0e8b665ac1ea09dc7c5c6cf0fcdb9697f4fa7 /catalog-ui/src/app/ng2/components | |
parent | 8137832ef9e5163fca232e7152c4ba55b7ef6350 (diff) |
Bug fix for list of map values in properties
Fixed list of map values in properties assignment page
Issue-ID: SDC-4315
Signed-off-by: Imam hussain <imam.hussain@est.tech>
Change-Id: I3d4fcc11327bbc38d1ec24a06ca45aedcfb47ce1
Diffstat (limited to 'catalog-ui/src/app/ng2/components')
-rw-r--r-- | catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts index b1ceb9328e..548c676285 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts @@ -155,16 +155,18 @@ export class DynamicPropertyComponent { let mapKeyValue = this.property instanceof DerivedFEProperty ? this.property.mapKey : ""; if (this.property.type == PROPERTY_TYPES.LIST && mapKeyValue === "") { - if(this.property.value != null) { - const valueJson = JSON.parse(this.property.value); - if(this.property instanceof PropertyFEModel && this.property.expandedChildPropertyId != null){ - let indexNumber = Number(Object.keys(valueJson).sort().reverse()[0]) + 1; - mapKeyValue = indexNumber.toString(); - }else{ - mapKeyValue = Object.keys(valueJson).sort().reverse()[0]; + if (this.property.schemaType != PROPERTY_TYPES.MAP) { + if (this.property.value != null) { + const valueJson = JSON.parse(this.property.value); + if (this.property instanceof PropertyFEModel && this.property.expandedChildPropertyId != null) { + let indexNumber = Number(Object.keys(valueJson).sort().reverse()[0]) + 1; + mapKeyValue = indexNumber.toString(); + }else{ + mapKeyValue = Object.keys(valueJson).sort().reverse()[0]; + } + }else { + mapKeyValue = "0"; } - }else { - mapKeyValue = "0"; } } let newProps: Array<DerivedFEProperty> = this.propertiesUtils.createListOrMapChildren(this.property, mapKeyValue, null); @@ -286,7 +288,7 @@ export class DynamicPropertyComponent { } preventInsertItem = (property:DerivedFEProperty):boolean => { - if(property.type == PROPERTY_TYPES.MAP && Object.keys(property.valueObj).indexOf('') > -1 ){ + if(property.type == PROPERTY_TYPES.MAP && property.valueObj != null && Object.keys(property.valueObj).indexOf('') > -1 ){ return true; } return false; |