sort data type drop down lists in add property 63/134163/3
authorshikha0203 <shivani.khare@est.tech>
Fri, 14 Apr 2023 11:53:16 +0000 (12:53 +0100)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Tue, 18 Apr 2023 18:29:02 +0000 (18:29 +0000)
Issue-ID: SDC-4474
Signed-off-by: shikha0203 <shivani.khare@est.tech>
Change-Id: Iaf6c197b7a80bdf1d133858c3f814e7297a832bc

catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts

index dc9c82d..4b41e7a 100644 (file)
@@ -291,6 +291,7 @@ export class PropertyFormViewModel {
             hasGetFunctionValue: property.isToscaFunction(),
             isGetFunctionValid: true,
         };
+        this.$scope.editPropertyModel.types.sort((a,b) => a.localeCompare(b));
         this.$scope.isPropertyValueOwner = this.isPropertyValueOwner;
         this.$scope.propertyOwnerType = this.propertyOwnerType;
         this.$scope.modelNameFilter = this.workspaceService.metadata.model;
@@ -317,11 +318,10 @@ export class PropertyFormViewModel {
 
         this.DataTypesService.fetchDataTypesByModel(this.workspaceService.metadata.model).then(response => {
             this.$scope.dataTypes = response.data as DataTypesMap;
-
-            this.$scope.nonPrimitiveTypes = _.filter(Object.keys(this.$scope.dataTypes), (type:string)=> {
-                return this.$scope.editPropertyModel.types.indexOf(type) == -1;
-            });
-            this.$scope.isLoading = false;
+                this.$scope.nonPrimitiveTypes = _.filter(Object.keys(this.$scope.dataTypes), (type: string) => {
+                    return this.$scope.editPropertyModel.types.indexOf(type) == -1 ;
+                }).sort((a, b) => a.localeCompare(b));
+                this.$scope.isLoading = false;
         });
 
         //scope methods