From: KrupaNagabhushan Date: Tue, 31 Jan 2023 09:45:22 +0000 (+0000) Subject: Enable UI component to display property constraints X-Git-Tag: 1.12.2~33 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F133075%2F5;p=sdc.git Enable UI component to display property constraints Issue-ID: SDC-4360 Signed-off-by: KrupaNagabhushan Change-Id: I63510720a260b830baea3813ff0adb304fa480e4 --- diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java index 113f8ba4dc..3993ef0b70 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java @@ -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; diff --git a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts index b4c1c2fce7..ae72977b80 100644 --- a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts +++ b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts @@ -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; diff --git a/catalog-ui/src/app/models/properties.ts b/catalog-ui/src/app/models/properties.ts index 80575c4221..cff1324c30 100644 --- a/catalog-ui/src/app/models/properties.ts +++ b/catalog-ui/src/app/models/properties.ts @@ -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; diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html index 6e6c29b4fc..bfe7f49aaa 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html +++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html @@ -252,7 +252,7 @@