Sort drop down lists in VFC requirements and capabilities 94/133594/2
authorshikha0203 <shivani.khare@est.tech>
Thu, 9 Mar 2023 10:21:30 +0000 (10:21 +0000)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Thu, 9 Mar 2023 22:24:59 +0000 (22:24 +0000)
Issue-ID: SDC-4429
Signed-off-by: shikha0203 <shivani.khare@est.tech>
Change-Id: I10c1f8cb6cd57e4c49b70d0a400a7aed068133b0

catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts

index e7b39c0..4421c27 100644 (file)
@@ -41,16 +41,19 @@ export class ReqAndCapabilitiesService {
         // -- COMMON for both --
         this.capabilityTypesList = [];
         let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes(this.workspaceService.metadata.model);
-        Object.keys(capabilityTypesResult).forEach(key => {this.capabilityTypesList.push(capabilityTypesResult[key])})
+        Object.keys(capabilityTypesResult).forEach(key => {this.capabilityTypesList.push(capabilityTypesResult[key])});
+        this.capabilityTypesList.sort((capabilityType1, capabilityType2) => capabilityType1.toscaPresentation.type.localeCompare(capabilityType2.toscaPresentation.type));
 
         if (initInputsFor === 'INPUTS_FOR_REQUIREMENTS') {
             this.relationshipTypesList = [];
             let relationshipTypesResult = await this.toscaTypesServiceNg2.fetchRelationshipTypes(this.workspaceService.metadata.model);
             Object.keys(relationshipTypesResult).forEach(key => {this.relationshipTypesList.push(relationshipTypesResult[key])});
+            this.relationshipTypesList.sort((relationship1,relationship2) => relationship1.toscaPresentation.type.localeCompare(relationship2.toscaPresentation.type));
 
             this.nodeTypesList = [];
             let nodeTypesResult = await this.toscaTypesServiceNg2.fetchNodeTypes(this.workspaceService.metadata.model);
-            Object.keys(nodeTypesResult).forEach(key => {this.nodeTypesList.push(nodeTypesResult[key])})
+            Object.keys(nodeTypesResult).forEach(key => {this.nodeTypesList.push(nodeTypesResult[key])});
+            this.nodeTypesList.sort((node1,node2) => node1.componentMetadataDefinition.componentMetadataDataDefinition.toscaResourceName.localeCompare(node2.componentMetadataDefinition.componentMetadataDataDefinition.toscaResourceName));
         }
     }