diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 25807d3..312d561 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -247,7 +247,30 @@ export class HomeComponent { if (!stakeholders || stakeholders.length == 0) { this.status = this.errorCodes.NONE; } else { - this.stakeholders = stakeholders; + // compare function for alphabetical order based on the 'name' property + function compare (a, b) { + if(a.name < b.name) { + return -1; + } + if(a.name > b.name) { + return 1; + } + return 0; + } + let publicStakeholders = []; + let restrictedStakeholders = []; + stakeholders.forEach(stakeholder => { + if(stakeholder.visibility == "PUBLIC") { + publicStakeholders.push(stakeholder); + } else { + restrictedStakeholders.push(stakeholder); + } + }); + // actual sorting of the arrays + publicStakeholders.sort(compare); + restrictedStakeholders.sort(compare); + // joining the two arrays again + this.stakeholders = publicStakeholders.concat(restrictedStakeholders); } this.loading = false; }, diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 389cd74..b2ad62b 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 389cd74ba564e77f6ac85fa890259ba1c880c372 +Subproject commit b2ad62b6ad0e7c36e6be4b7a3de39631a81fd9bc