Fix for list of map type on SELF property 30/129830/5
authorimamSidero <imam.hussain@est.tech>
Thu, 7 Jul 2022 16:10:03 +0000 (21:40 +0530)
committerMichael Morris <michael.morris@est.tech>
Thu, 14 Jul 2022 16:27:38 +0000 (16:27 +0000)
Adding the multi value types to the schema type in property-creator
component

Issue-ID: SDC-4085
Change-Id: I9e6319caa85a99b6be90762698f66435f85811a3
Signed-off-by: Imam Hussain <imam.hussain@est.tech>
catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.html
catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.ts

index df2136b..52b8d99 100644 (file)
@@ -19,6 +19,7 @@
                 <ui-element-dropdown [testId]="'property-type'"
                                      class="cell link-selector"
                                      [values]="typesProperties"
+                                     (change)="onTypeChange()"
                                      [(value)]="propertyModel.type"></ui-element-dropdown>
             </div>
             <div class="i-sdc-form-item propertySchemaType" *ngIf="showSchema()">
index 57c9f97..ba7533a 100644 (file)
@@ -41,6 +41,17 @@ export class PropertyCreatorComponent {
         return [PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP].indexOf(this.propertyModel.type) > -1;
     }
 
+    onTypeChange(): void {
+        this.propertyModel.schema.property.type='';
+        const typeList =  this.typesProperties;
+        if(this.propertyModel.type === PROPERTY_TYPES.MAP){
+            this.typesSchemaProperties = typeList.filter(dropdownObject => (dropdownObject.label != 'list' && dropdownObject.label != 'map'));
+        }
+        if(this.propertyModel.type === PROPERTY_TYPES.LIST){
+            this.typesSchemaProperties = typeList.filter(dropdownObject => dropdownObject.label != 'list');
+        }
+    }
+
     onSchemaTypeChange(): void {
         if (this.propertyModel.type === PROPERTY_TYPES.MAP) {
             this.propertyModel.value = JSON.stringify({'': null});
@@ -63,9 +74,7 @@ export class PropertyCreatorComponent {
         this.typesProperties = _.map(PROPERTY_DATA.TYPES,
             (type: string) => new DropdownValue(type, type)
         );
-        const typesSimpleProperties = _.map(PROPERTY_DATA.SIMPLE_TYPES,
-            (type: string) => new DropdownValue(type, type)
-        );
+        const typesSimpleProperties = this.typesProperties.filter(dropdownObject => dropdownObject.label != 'list');
         const nonPrimitiveTypesValues = _.map(nonPrimitiveTypes,
             (type: string) => new DropdownValue(type,
                 type.replace('org.openecomp.datatypes.heat.', ''))