Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for User profile (/profile): only 20 group memberships shown instead of all #3105

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
30 changes: 23 additions & 7 deletions src/app/profile-page/profile-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,29 @@ <h1>{{'profile.title' | translate}}</h1>
<button class="btn btn-primary" (click)="updateProfile()"><i class="fas fa-edit"></i> {{'profile.form.submit' | translate}}</button>
</div>

<ng-container *ngVar="(groupsRD$ | async)?.payload?.page as groups">
<div *ngIf="groups?.length > 0">
<h2 class="mt-4">{{'profile.groups.head' | translate}}</h2>
<ul class="list-group list-group-flush">
<li *ngFor="let group of groups" class="list-group-item">{{ dsoNameService.getName(group) }}</li>
</ul>
</div>
<ng-container *ngVar="(groupsRD$ | async) as groupsRD">
<ng-container *ngTemplateOutlet="groupsRD.isLoading ? loader : content"></ng-container>
<ng-template #content>
<ds-pagination *ngIf="groupsRD?.payload"
[hideGear]="true"
[hidePagerWhenSinglePage]="true"
[hidePaginationDetail]="true"
[paginationOptions]="optionsGroupsPagination"
[collectionSize]="groupsRD?.payload?.totalElements">
<ng-container *ngVar="groupsRD?.payload?.page as groups">
<div *ngIf="groups?.length > 0">
<h2 class="mt-4">{{'profile.groups.head' | translate}}</h2>
<ul class="list-group list-group-flush">
<li *ngFor="let group of groups" class="list-group-item">{{ dsoNameService.getName(group) }}</li>
</ul>
</div>
</ng-container>
</ds-pagination>
</ng-template>
<ng-template #loader>
<ds-loading [showMessage]="false"></ds-loading>
</ng-template>
<ds-error *ngIf="groupsRD.hasFailed" message="{{'error.profile-groups' | translate}}"></ds-error>
</ng-container>

<ng-container *ngVar="(specialGroupsRD$ | async)?.payload?.page as specialGroups">
Expand Down
8 changes: 8 additions & 0 deletions src/app/profile-page/profile-page.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NgTemplateOutlet } from '@angular/common';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import {
ComponentFixture,
Expand Down Expand Up @@ -29,7 +30,10 @@ import { EPersonDataService } from '../core/eperson/eperson-data.service';
import { EPerson } from '../core/eperson/models/eperson.model';
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
import { SuggestionsNotificationComponent } from '../notifications/suggestions-notification/suggestions-notification.component';
import { ErrorComponent } from '../shared/error/error.component';
import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component';
import { NotificationsService } from '../shared/notifications/notifications.service';
import { PaginationComponent } from '../shared/pagination/pagination.component';
import {
createFailedRemoteDataObject$,
createSuccessfulRemoteDataObject$,
Expand Down Expand Up @@ -134,6 +138,10 @@ describe('ProfilePageComponent', () => {
ProfilePageSecurityFormComponent,
ProfilePageResearcherFormComponent,
SuggestionsNotificationComponent,
NgTemplateOutlet,
PaginationComponent,
ThemedLoadingComponent,
ErrorComponent,
],
},
})
Expand Down
34 changes: 33 additions & 1 deletion src/app/profile-page/profile-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
AsyncPipe,
NgForOf,
NgIf,
NgTemplateOutlet,
} from '@angular/common';
import {
Component,
Expand Down Expand Up @@ -33,8 +34,10 @@ import { RemoteData } from '../core/data/remote-data';
import { EPersonDataService } from '../core/eperson/eperson-data.service';
import { EPerson } from '../core/eperson/models/eperson.model';
import { Group } from '../core/eperson/models/group.model';
import { PaginationService } from '../core/pagination/pagination.service';
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
import {
getAllCompletedRemoteData,
getAllSucceededRemoteData,
getFirstCompletedRemoteData,
getRemoteDataPayload,
Expand All @@ -44,7 +47,11 @@ import {
hasValue,
isNotEmpty,
} from '../shared/empty.util';
import { ErrorComponent } from '../shared/error/error.component';
import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component';
import { NotificationsService } from '../shared/notifications/notifications.service';
import { PaginationComponent } from '../shared/pagination/pagination.component';
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
import { followLink } from '../shared/utils/follow-link-config.model';
import { VarDirective } from '../shared/utils/var.directive';
import { ThemedProfilePageMetadataFormComponent } from './profile-page-metadata-form/themed-profile-page-metadata-form.component';
Expand All @@ -65,6 +72,10 @@ import { ProfilePageSecurityFormComponent } from './profile-page-security-form/p
NgIf,
NgForOf,
SuggestionsNotificationComponent,
NgTemplateOutlet,
PaginationComponent,
ThemedLoadingComponent,
ErrorComponent,
],
standalone: true,
})
Expand Down Expand Up @@ -122,6 +133,15 @@ export class ProfilePageComponent implements OnInit {
private currentUser: EPerson;
canChangePassword$: Observable<boolean>;

/**
* Default configuration for group pagination
**/
optionsGroupsPagination = Object.assign(new PaginationComponentOptions(),{
id: 'page_groups',
currentPage: 1,
pageSize: 20,
});

isResearcherProfileEnabled$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);

constructor(private authService: AuthService,
Expand All @@ -131,6 +151,7 @@ export class ProfilePageComponent implements OnInit {
private authorizationService: AuthorizationDataService,
private configurationService: ConfigurationDataService,
public dsoNameService: DSONameService,
private paginationService: PaginationService,
) {
}

Expand All @@ -142,7 +163,18 @@ export class ProfilePageComponent implements OnInit {
getRemoteDataPayload(),
tap((user: EPerson) => this.currentUser = user),
);
this.groupsRD$ = this.user$.pipe(switchMap((user: EPerson) => user.groups));
this.groupsRD$ = this.paginationService.getCurrentPagination(this.optionsGroupsPagination.id, this.optionsGroupsPagination).pipe(
switchMap((pageOptions: PaginationComponentOptions) => {
return this.epersonService.findById(this.currentUser.id, true, true, followLink('groups',{
findListOptions: {
elementsPerPage: pageOptions.pageSize,
currentPage: pageOptions.currentPage,
} }));
}),
getAllCompletedRemoteData(),
getRemoteDataPayload(),
switchMap((user: EPerson) => user?.groups),
);
this.canChangePassword$ = this.user$.pipe(switchMap((user: EPerson) => this.authorizationService.isAuthorized(FeatureID.CanChangePassword, user._links.self.href)));
this.specialGroupsRD$ = this.authService.getSpecialGroupsFromAuthStatus();

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/bn.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "অবজেক্ট নিয়ে আসতে ত্রুটি হচ্ছে",

//"error.profile-groups": "Error retrieving profile groups"
"error.profile-groups": "প্রোফাইল গোষ্ঠীগুলি অনুসন্ধান করার সময় একটি ত্রুটি ঘটেছে৷",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "সাম্প্রতিক জমাগুলো আনতে ত্রুটি হচ্ছে",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/ca.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Error en recuperar objectes",

//"error.profile-groups": "Error retrieving profile groups"
"error.profile-groups": "S'ha produït un error en recuperar els grups de perfils",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Error en recuperar els enviaments recents",

Expand Down
5 changes: 4 additions & 1 deletion src/assets/i18n/cs.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Chyba při načítání objektů",

//"error.profile-groups": "Error retrieving profile groups"
"error.profile-groups": "Chyba při načítání skupin profilů",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Chyba při načítání nedávných příspěvků",

Expand Down Expand Up @@ -11036,4 +11039,4 @@
"item.page.cc.license.disclaimer": "Except where otherwised noted, this item's license is described as",


}
}
3 changes: 3 additions & 0 deletions src/assets/i18n/de.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2271,6 +2271,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Fehler beim Laden der Objekte",

//"error.profile-groups": "Error retrieving profile groups"
"error.profile-groups": "Fehler beim Abrufen der letzten Einreichungen",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Fehler beim Laden der neuesten Veröffentlichungen",

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/el.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@
"error.items": "Σφάλμα κατά την ανάκτηση τεκμηρίων",
"error.objects": "Σφάλμα κατά την ανάκτηση αντικειμένων",
"error.recent-submissions": "Σφάλμα κατά την ανάκτηση πρόσφατων υποβολών",
"error.profile-groups": "Σφάλμα κατά την ανάκτηση ομάδων προφίλ",
"error.search-results": "Σφάλμα κατά την ανάκτηση των αποτελεσμάτων αναζήτησης",
"error.sub-collections": "Σφάλμα κατά την ανάκτηση υποσυλλογών",
"error.sub-communities": "Σφάλμα κατά την ανάκτηση υποκοινοτήτων",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,8 @@

"error.recent-submissions": "Error fetching recent submissions",

"error.profile-groups": "Error retrieving profile groups",

"error.search-results": "Error fetching search results",

"error.invalid-search-query": "Search query is not valid. Please check <a href=\"https://solr.apache.org/guide/query-syntax-and-parsing.html\" target=\"_blank\">Solr query syntax</a> best practices for further information about this error.",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/es.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,9 @@
// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Error al recuperar los envíos recientes",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Error al recuperar grupos del perfil",

// "error.search-results": "Error fetching search results",
"error.search-results": "Error al recuperar los resultados de búsqueda",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/fi.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Virhe kohteita noudettaessa",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Virhe noudettaessa profiiliryhmiä",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Virhe viimeksi lisättyjä julkaisuja noudettaessa",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/fr.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Erreur lors de la récupération des objets",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Erreur lors de la récupération des groupes de profils",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Erreur lors de la récupération des dépôts récents",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/gd.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2408,6 +2408,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Mearachd a' faighinn oibseactan",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Thachair mearachd a' lorg nam buidhnean pròifil",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Mearachd a' faighinn chur-a-steachan ùra",

Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/hi.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,8 @@

"error.objects": "मदो को लाने में त्रुटि",

"error.profile-groups": "प्रोफ़ाइल समूह पुनर्प्राप्त करने में त्रुटि",

"error.recent-submissions": "हाल ही की प्रस्तुतियां लाने में त्रुटि",

"error.search-results": "खोज परिणाम लाने में त्रुटि",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/hu.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Tárgyak megjelenítésekor hiba történt",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Hiba a profilcsoportok lekérésekor",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Friss feltöltések megjelenítésekor hiba történt",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/it.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Errore durante il recupero degli oggetti",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Errore durante il recupero dei gruppi di profili",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Errore durante il recupero delle submissions recenti",

Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/ja.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2640,6 +2640,10 @@
// TODO New key - Add a translation
"error.objects": "Error fetching objects",

// TODO New key - Add a translation
//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Error retrieving profile groups",

// "error.recent-submissions": "Error fetching recent submissions",
// TODO New key - Add a translation
"error.recent-submissions": "Error fetching recent submissions",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/kk.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Нысандарды алу қатесі",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Профиль топтарын алу қатесі",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Соңғы жіберілімдерді алу қатесі",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/lv.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Objektu ielasīšanas kļūda",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Izgūstot profilu grupas, radās kļūda",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Neseno iesniegumu ielasīšanas kļūda",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/nl.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Fout bij het ophalen van objecten",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Fout bij het ophalen van profielgroepen",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Fout bij het ophalen van recent toegevoegde items",

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/pl.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@
"error.item": "Wystąpił błąd podczas tworzenia pozycji",
"error.items": "Wystąpił błąd podczas tworzenia pozycji",
"error.objects": "Wystąpił błąd podczas tworzenia obiektów",
"error.profile-groups": "Błąd podczas pobierania grup profili",
"error.recent-submissions": "Wystąpił błąd podczas tworzenia ostatniego zgłoszenia",
"error.search-results": "Wystąpił błąd podczas tworzenia wyników wyszukiwania",
"error.sub-collections": "Wystąpił błąd podczas tworzenia podkolekcji",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/pt-BR.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2768,6 +2768,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Erro ao carregar objetos",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Erro ao recuperar grupos de perfis",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Erro ao carregar as submissões recentes",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/pt-PT.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2793,6 +2793,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Erro ao carregar objetos!",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Erro ao recuperar grupos de perfis",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Erro ao carregar depósitos recentes!",

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/sr-cyr.json5
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@
"error.item": "Грешка при преузимању ставке",
"error.items": "Грешка при преузимању ставки",
"error.objects": "Грешка при преузимању објеката",
"error.profile-groups": "Грешка при преузимању група профила",
"error.recent-submissions": "Грешка при преузимању недавних поднесака",
"error.search-results": "Грешка при преузимању резултата претраге",
"error.invalid-search-query": "Упит за претрагу није исправан. Проверите најбоља решења за <a href=\"https://solr.apache.org/guide/query-syntax-and-parsing.HTML\" target=\"_blank\">Solr синтаксу упита</a> за додатне информације о овој грешци.",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/sr-lat.json5
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@
"error.item": "Greška pri preuzimanju stavke",
"error.items": "Greška pri preuzimanju stavki",
"error.objects": "Greška pri preuzimanju objekata",
"error.profile-groups": "Greška pri preuzimanju grupa profila",
"error.recent-submissions": "Greška pri preuzimanju nedavnih podnesaka",
"error.search-results": "Greška pri preuzimanju rezultata pretrage",
"error.invalid-search-query": "Upit za pretragu nije ispravan. Proverite najbolja rešenja za <a href=\"https://solr.apache.org/guide/kueri-sintak-and-parsing.html\" target=\"_blank\">Solr sintaksu upita</a> za dodatne informacije o ovoj grešci .",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/sv.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Ett fel uppstod när objekt hämtades",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Det gick inte att hämta profilgrupper",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Ett fel uppstod när senste bidrag hämtades",

Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/sw.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2640,6 +2640,10 @@
// TODO New key - Add a translation
"error.objects": "Error fetching objects",

//"error.profile-groups": "Error retrieving profile groups",
// TODO New key - Add a translation
"error.profile-groups": "Error retrieving profile groups",

// "error.recent-submissions": "Error fetching recent submissions",
// TODO New key - Add a translation
"error.recent-submissions": "Error fetching recent submissions",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/tr.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,9 @@
// "error.objects": "Error fetching objects",
"error.objects": "Alınan nesneler hatası",

//"error.profile-groups": "Error retrieving profile groups",
"error.profile-groups": "Profil grupları alınırken hata oluştu",

// "error.recent-submissions": "Error fetching recent submissions",
"error.recent-submissions": "Son başvuruları alma hatası",

Expand Down
Loading
Loading