Fix issue on adding values to complex properties in Property Assignment 20/133320/3
authorimamSidero <imam.hussain@est.tech>
Fri, 17 Feb 2023 17:03:38 +0000 (17:03 +0000)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Tue, 21 Feb 2023 18:10:23 +0000 (18:10 +0000)
value field for complex types are restored and validation for the complex type is fixed

Issue-ID: SDC-4400
Signed-off-by: Imam hussain <imam.hussain@est.tech>
Change-Id: I320b2f2bdb8c8e236e7cd232902a4a07d0c245c8

catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java
catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts
catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html

index a25a332..6c820a1 100644 (file)
@@ -371,17 +371,19 @@ public class PropertyValueConstraintValidationUtil {
                 final PropertyDefinition propertyCopyWithNewValue = copyPropertyWithNewValue(propertyDefinition,
                     objectMapper.writeValueAsString(value),mapKey);
                 propertyCopyWithNewValue.setToscaSubPath(mapKey);
-                if (ToscaType.isPrimitiveType(schemaType)) {
-                    evaluateCollectionPrimitiveSchemaType(propertyCopyWithNewValue, schemaType);
-                } else if (ToscaType.isCollectionType(schemaType)) {
-                    propertyCopyWithNewValue.setType(schemaType);
-                    propertyCopyWithNewValue.setSchemaType(propertyDefinition.getSchemaProperty().getSchemaType());
-                    evaluateCollectionTypeProperties(propertyCopyWithNewValue);
-                } else {
-                    propertyCopyWithNewValue.setType(schemaType);
-                    completePropertyName.append(UNDERSCORE);
-                    completePropertyName.append(propertyCopyWithNewValue.getName());
-                    evaluateComplexTypeProperties(propertyCopyWithNewValue);
+                if (isPropertyNotMappedAsInput(propertyCopyWithNewValue)) {
+                    if (ToscaType.isPrimitiveType(schemaType)) {
+                        evaluateCollectionPrimitiveSchemaType(propertyCopyWithNewValue, schemaType);
+                    } else if (ToscaType.isCollectionType(schemaType)) {
+                        propertyCopyWithNewValue.setType(schemaType);
+                        propertyCopyWithNewValue.setSchemaType(propertyDefinition.getSchemaProperty().getSchemaType());
+                        evaluateCollectionTypeProperties(propertyCopyWithNewValue);
+                    } else {
+                        propertyCopyWithNewValue.setType(schemaType);
+                        completePropertyName.append(UNDERSCORE);
+                        completePropertyName.append(propertyCopyWithNewValue.getName());
+                        evaluateComplexTypeProperties(propertyCopyWithNewValue);
+                    }
                 }
             } catch (final Exception e) {
                 logger.debug(e.getMessage(), e);
index 02b2d0b..c2ea1ec 100644 (file)
@@ -119,7 +119,7 @@ export class DerivedFEProperty extends PropertyBEModel {
                 }
        
             }
-            this.valueObj = ((this.type == PROPERTY_TYPES.JSON || this.type == PROPERTY_TYPES.MAP) && typeof value == 'object') ? JSON.stringify(value) : value;
+            this.valueObj = (this.type == PROPERTY_TYPES.JSON && typeof value == 'object') ? JSON.stringify(value) : value;
             if (value != null) {
                 this.value = typeof value == 'object' ? JSON.stringify(value) : value;
             }
index 959ed36..8e7e3a1 100644 (file)
@@ -25,7 +25,7 @@
             <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div>
         </div>
         <div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap">
-            <checkbox *ngIf="nestedLevel != 1" [(checked)]="property.isSelected" [disabled]="property.isDisabled || readonly || property.mapKey == ''" (checkedChange)="toggleTosca.emit(property)" ></checkbox>
+            <checkbox *ngIf="nestedLevel == 2" [(checked)]="property.isSelected" [disabled]="property.isDisabled || readonly || property.mapKey == ''" (checkedChange)="toggleTosca.emit(property)" ></checkbox>
             <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div>
         </div> <!-- simple children of complex type within map or list -->
         <div class="table-cell map-entry" *ngIf="property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && !property.mapInlist"><!-- map left cell -->