Increase character limit of VFC property name to 100 and allow @ character 25/131425/9
authorimamSidero <imam.hussain@est.tech>
Tue, 11 Oct 2022 13:23:30 +0000 (14:23 +0100)
committerMichael Morris <michael.morris@est.tech>
Mon, 17 Oct 2022 14:57:35 +0000 (14:57 +0000)
VFC property name character limit is increased to 100 and allowing @ special character

Signed-off-by: imamSidero <imam.hussain@est.tech>
Issue-ID: SDC-4210
Change-Id: If7f0be254a62effe34ad426ba24eeb31f034dd3f

catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java
catalog-ui/src/app/app.ts
catalog-ui/src/app/utils/constants.ts
catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts
catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-view.html
catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html

index 2f98fae..7bec5d5 100644 (file)
@@ -84,7 +84,7 @@ import org.springframework.web.context.WebApplicationContext;
 public class BeGenericServlet extends BasicServlet {
 
     private static final Logger log = Logger.getLogger(BeGenericServlet.class);
-    private static final String PROPERTY_NAME_REGEX = "[\\w,\\d,_:]+";
+    private static final String PROPERTY_NAME_REGEX = "[a-zA-Z0-9_:-@]+";
     @Context
     protected HttpServletRequest servletRequest;
     protected ComponentsUtils componentsUtils;
index ba9bd44..76c1d28 100644 (file)
@@ -612,7 +612,7 @@ ng1appModule.config([
 
 ng1appModule.value('ValidationPattern', /^[\s\w\&_.:-]{1,1024}$/);
 ng1appModule.value('ComponentNameValidationPattern', /^(?=.*[^. ])[\s\w\&_.:-]{1,1024}$/); //DE250513 - same as ValidationPattern above, plus requirement that name not consist of dots and/or spaces alone.
-ng1appModule.value('PropertyNameValidationPattern', /^[a-zA-Z0-9_:-]{1,50}$/);// DE210977
+ng1appModule.value('PropertyNameValidationPattern', /^[a-zA-Z0-9_:-@]{1,100}$/);// DE210977
 ng1appModule.value('TagValidationPattern', /^[\s\w_.-]{1,50}$/);
 ng1appModule.value('VendorReleaseValidationPattern', /^[\x20-\x21\x23-\x29\x2B-\x2E\x30-\x39\x3B\x3D\x40-\x5B\x5D-\x7B\x7D-\xFF]{1,25}$/);
 ng1appModule.value('VendorNameValidationPattern', /^[\x20-\x21\x23-\x29\x2B-\x2E\x30-\x39\x3B\x3D\x40-\x5B\x5D-\x7B\x7D-\xFF]{1,60}$/);
index d6710ed..0de83d2 100644 (file)
@@ -165,6 +165,7 @@ export class PROPERTY_DATA {
 export class PROPERTY_VALUE_CONSTRAINTS {
   public static MAX_LENGTH = 2500;
   public static JSON_MAX_LENGTH = 4096;
+  public static NAME_MAX_LENGTH = 100;
 }
 
 export class Role {
index fe578b6..421e205 100644 (file)
@@ -25,7 +25,7 @@
 import * as _ from "lodash";
 import {DataTypesService} from "app/services/data-types-service";
 import {PropertyModel, DataTypesMap, Component} from "app/models";
-import {ValidationUtils, PROPERTY_DATA} from "app/utils";
+import {ValidationUtils, PROPERTY_DATA, PROPERTY_VALUE_CONSTRAINTS} from "app/utils";
 
 export interface IPropertyFormBaseViewScope extends ng.IScope {
 
@@ -51,6 +51,7 @@ export interface IPropertyFormBaseViewScope extends ng.IScope {
     isDescriptionDisable:boolean;
     isPropertyValueDisable:boolean;
     isArrowsDisabled:boolean;
+    nameMaxLength:number;
 
     //Validation pattern
     validationPattern:RegExp;
@@ -138,6 +139,7 @@ export abstract class PropertyFormBaseView {
         this.$scope.dataTypes = this.DataTypesService.getAllDataTypesFromModel(this.component.model); //Get all data types in service
         this.$scope.modalPropertyFormBase = this.$uibModalInstance;
         this.$scope.isNew = !angular.isDefined(this.$scope.property.name);
+        this.$scope.nameMaxLength = PROPERTY_VALUE_CONSTRAINTS.NAME_MAX_LENGTH;
 
         this.initValidations();
         this.initButtonsState();
index ae96b66..bb4524e 100644 (file)
@@ -37,9 +37,9 @@
                             <label class="i-sdc-form-label" ng-class="{'required': !isService}">Name</label>
                             <input class="i-sdc-form-input"
                                    data-tests-id="propertyName"
-                                   data-ng-maxlength="50"
+                                   data-ng-maxlength="nameMaxLength"
                                    data-ng-disabled="isNameDisable"
-                                   maxlength="50"
+                                   maxlength="{{nameMaxLength}}"
                                    data-ng-model="property.name"
                                    type="text"
                                    name="propertyName"
@@ -50,7 +50,7 @@
 
                             <div class="input-error" data-ng-show="forms.editForm.propertyName.$dirty && forms.editForm.propertyName.$invalid">
                                 <span ng-show="forms.editForm.propertyName.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Property name' }"></span>
-                                <span ng-show="forms.editForm.propertyName.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '50' }"></span>
+                                <span ng-show="forms.editForm.propertyName.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{nameMaxLength}}' }"></span>
                                 <span ng-show="forms.editForm.propertyName.$error.pattern" translate="VALIDATION_ERROR_SPECIAL_CHARS_NOT_ALLOWED"></span>
                             </div>
                         </div>
index 103b134..614f158 100644 (file)
@@ -47,6 +47,7 @@ interface IPropertyFormViewModelScope extends ng.IScope {
     editForm:ng.IFormController;
     footerButtons:Array<any>;
     isNew:boolean;
+    nameMaxLength:number;
     isLoading:boolean;
     componentMetadata: { isService: boolean, isVfc: boolean }
     validationPattern:RegExp;
@@ -241,6 +242,7 @@ export class PropertyFormViewModel {
         this.$scope.validationPattern = this.ValidationPattern;
         this.$scope.propertyNameValidationPattern = this.PropertyNameValidationPattern;
         this.$scope.commentValidationPattern = this.CommentValidationPattern;
+        this.$scope.nameMaxLength = PROPERTY_VALUE_CONSTRAINTS.NAME_MAX_LENGTH;
         this.$scope.isNew = (this.formState === FormState.CREATE);
         this.$scope.componentMetadata = {
             isService: this.workspaceService.metadata.isService(),
index a6fd697..105bef3 100644 (file)
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
 -->
-<ng1-modal modal="modalInstanceProperty" type="classic" class="sdc-edit-property-container" buttons="footerButtons" header="{{isNew ? 'Add' : isViewOnly ? '' : 'Update'}} Property {{isViewOnly ? 'Definition' : ''}}" show-close-button="true" data-tests-id="sdc-edit-property-container">
+<ng1-modal modal="modalInstanceProperty" type="classic" class="sdc-edit-property-container" buttons="footerButtons" header="{{isNew ? 'Add' : 'Update' }} Property" show-close-button="true" data-tests-id="sdc-edit-property-container">
     <loader data-display="isLoading" relative="false" size="medium"></loader>
     <div class="sdc-modal-top-bar" data-ng-if="!isNew">
         <div class="sdc-modal-top-bar-buttons">
-            <span ng-click="delete(editPropertyModel.property)" data-ng-class="{'disabled' : isPropertyValueOwner || editPropertyModel.property.readonly || propertyOwnerType == 'group' || propertyOwnerType == 'policy' || isViewOnly}" class="sprite-new delete-btn" data-tests-id="delete_property"  sdc-smart-tooltip="">Delete</span>
+            <span ng-click="delete(editPropertyModel.property)" data-ng-class="{'disabled' : isPropertyValueOwner || editPropertyModel.property.readonly || propertyOwnerType == 'group' || propertyOwnerType == 'policy'}" class="sprite-new delete-btn" data-tests-id="delete_property"  sdc-smart-tooltip="">Delete</span>
             <span class="delimiter"></span>
             <span data-ng-click="getPrev()" data-ng-class="{'disabled' : !currentPropertyIndex }" class="sprite-new left-arrow" data-tests-id="get-prev" sdc-smart-tooltip="">Previous</span>
             <span data-ng-click="getNext()" data-ng-class="{'disabled' : isLastProperty }" class="sprite-new right-arrow" data-tests-id="get-next" sdc-smart-tooltip="">Next</span>
@@ -37,9 +37,9 @@
                             <label class="i-sdc-form-label" ng-class="{'required': !componentMetadata.isService}">Name</label>
                             <input class="i-sdc-form-input"
                                    data-tests-id="propertyName"
-                                   data-ng-maxlength="50"
-                                   data-ng-disabled="!isNew || editPropertyModel.property.readonly || isViewOnly"
-                                   maxlength="50"
+                                   data-ng-maxlength="nameMaxLength"
+                                   data-ng-disabled="!isNew || editPropertyModel.property.readonly"
+                                   maxlength="{{nameMaxLength}}"
                                    data-ng-model="editPropertyModel.property.name"
                                    type="text"
                                    name="propertyName"
@@ -50,7 +50,7 @@
 
                             <div class="input-error" data-ng-show="forms.editForm.propertyName.$dirty && forms.editForm.propertyName.$invalid">
                                 <span ng-show="forms.editForm.propertyName.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Property name' }"></span>
-                                <span ng-show="forms.editForm.propertyName.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '50' }"></span>
+                                <span ng-show="forms.editForm.propertyName.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{nameMaxLength}}' }"></span>
                                 <span ng-show="forms.editForm.propertyName.$error.pattern" translate="VALIDATION_ERROR_SPECIAL_CHARS_NOT_ALLOWED"></span>
                             </div>
                         </div>
@@ -65,7 +65,7 @@
                                     <select class="i-sdc-form-select"
                                             data-tests-id="propertyType"
                                             data-required
-                                            data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly || isViewOnly"
+                                            data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly"
                                             name="type"
                                             data-ng-change="onTypeChange()"
                                             data-ng-model="editPropertyModel.property.type">
@@ -88,7 +88,7 @@
                                     <select class="i-sdc-form-select"
                                             data-required
                                             data-tests-id="schema-type"
-                                            data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly || isViewOnly"
+                                            data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly"
                                             name="schemaType"
                                             data-ng-change="onSchemaTypeChange()"
                                             data-ng-model="editPropertyModel.property.schema.property.type">
                     <label class="i-sdc-form-label">Description</label>
                             <textarea  class="i-sdc-form-textarea"
                                        data-ng-maxlength="400"
-                                       data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly || isViewOnly"
+                                       data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly"
                                        maxlength="400"
                                        data-ng-pattern="commentValidationPattern"
                                        name="description"
                                               type-name="editPropertyModel.property.type"
                                               parent-form-obj="forms.editForm"
                                               fields-prefix-name="currentPropertyIndex"
-                                              read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly"
+                                              read-only="editPropertyModel.property.readonly && !isPropertyValueOwner"
                                               default-value="{{getDefaultValue()}}"
                                               expand-by-default="true"></fields-structure>
 
                                           schema-property="editPropertyModel.property.schema.property"
                                           parent-form-obj="forms.editForm"
                                           fields-prefix-name="currentPropertyIndex"
-                                          read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isVnfConfiguration || isViewOnly"
+                                          read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isVnfConfiguration"
                                           default-value="{{getDefaultValue()}}"
                                           max-length="maxLength"
                                           constraints="editPropertyModel.property.constraints && editPropertyModel.property.constraints[0].validValues">
                                            schema-property="editPropertyModel.property.schema.property"
                                            parent-form-obj="forms.editForm"
                                            fields-prefix-name="currentPropertyIndex"
-                                           read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly"
+                                           read-only="editPropertyModel.property.readonly && !isPropertyValueOwner"
                                            default-value="{{getDefaultValue()}}"
                                            max-length="maxLength"
                                            constraints="editPropertyModel.property.constraints && editPropertyModel.property.constraints[0].validValues"></type-list>
                                     <select class="i-sdc-form-select"
                                             data-tests-id="constraints"
                                             ng-if="(editPropertyModel.property.constraints)"
-                                            data-ng-disabled="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly"
+                                            data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner"
 
                                             data-ng-change="onValueChange()"
                                             data-ng-model="editPropertyModel.property.value">
                                            data-tests-id="defaultvalue"
                                            ng-if="!(editPropertyModel.property.constraints) && !((editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean')"
                                            data-ng-maxlength="maxLength"
-                                           data-ng-disabled="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly"
+                                           data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner"
                                            maxlength="{{maxLength}}"
                                            data-ng-model="editPropertyModel.property.value"
                                            type="text"
                                     <select class="i-sdc-form-select"
                                             data-tests-id="booleantype"
                                             ng-if="(editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean'"
-                                            data-ng-disabled="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isViewOnly"
+                                            data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner"
                                             name="value"
                                             data-ng-change="onValueChange()"
                                             data-ng-model="editPropertyModel.property.value">