Enable UI component to display property constraints 75/133075/5
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>
Tue, 31 Jan 2023 09:45:22 +0000 (09:45 +0000)
committerMichael Morris <michael.morris@est.tech>
Wed, 8 Feb 2023 15:32:22 +0000 (15:32 +0000)
Issue-ID: SDC-4360
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: I63510720a260b830baea3813ff0adb304fa480e4

catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java
catalog-ui/src/app/models/properties-inputs/property-be-model.ts
catalog-ui/src/app/models/properties.ts
catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html

index 113f8ba..3993ef0 100644 (file)
@@ -693,6 +693,7 @@ public class PolicyBusinessLogic extends BaseBusinessLogic {
             final PropertyDataDefinition currentProperty = oldProperties.get(newProperty.getName());
             currentProperty.setValue(newPropertyValueEither);
             currentProperty.setToscaFunction(newProperty.getToscaFunction());
+            currentProperty.setPropertyConstraints(newProperty.getPropertyConstraints());
             validatePropertyValueWithConstraints(currentProperty, policyOwnerComponent);
         }
         return policy;
index b4c1c2f..ae72977 100644 (file)
@@ -71,6 +71,7 @@ export class PropertyBEModel {
     inputPath: string;
     toscaPresentation: ToscaPresentationData;
     metadata: Metadata;
+    propertyConstraints: any;
     /**
      * @deprecated Use toscaFunction instead
      */
@@ -81,6 +82,7 @@ export class PropertyBEModel {
     constructor(property?: PropertyBEModel) {
         if (property) {
             this.constraints = property.constraints;
+            this.propertyConstraints = property.propertyConstraints;
             this.defaultValue = property.defaultValue;
             this.description = property.description;
             this.fromDerived = property.fromDerived;
index 80575c4..cff1324 100644 (file)
@@ -94,7 +94,13 @@ export class PropertyModel extends PropertyBEModel implements IPropertyModel {
     constructor(property?:PropertyModel) {
         super(property);
         if (property) {
-            this.constraints = property.constraints;
+            if (property.propertyConstraints) {
+                this.constraints = new Array();
+                property.propertyConstraints.forEach((constraint: any) => {
+                    this.constraints.push(JSON.parse(constraint));
+                });
+            }
+            this.propertyConstraints = property.propertyConstraints;
             this.source = property.source;
             this.valueUniqueUid = property.valueUniqueUid;
             this.path = property.path;
index 6e6c29b..bfe7f49 100644 (file)
                     <label class="i-sdc-form-label">Constraints</label>
                     <ng-container>
                         <app-constraints [property-constraints]="editPropertyModel.property.constraints"
-                                         [is-view-only]="editPropertyModel.property.propertyView? !editPropertyModel.property.propertyView :(isViewOnly || componentMetadata.isService)"
+                                         [is-view-only]="editPropertyModel.property.propertyView? !editPropertyModel.property.propertyView : (isViewOnly || componentMetadata.isService)"
                                          [property-type]="editPropertyModel.property.type"
                                          (on-constraint-change)="onConstraintChange($event)">
                         </app-constraints>