22 AsyncPipe ,
33 NgForOf ,
44 NgIf ,
5+ NgTemplateOutlet ,
56} from '@angular/common' ;
67import {
78 Component ,
@@ -33,8 +34,10 @@ import { RemoteData } from '../core/data/remote-data';
3334import { EPersonDataService } from '../core/eperson/eperson-data.service' ;
3435import { EPerson } from '../core/eperson/models/eperson.model' ;
3536import { Group } from '../core/eperson/models/group.model' ;
37+ import { PaginationService } from '../core/pagination/pagination.service' ;
3638import { ConfigurationProperty } from '../core/shared/configuration-property.model' ;
3739import {
40+ getAllCompletedRemoteData ,
3841 getAllSucceededRemoteData ,
3942 getFirstCompletedRemoteData ,
4043 getRemoteDataPayload ,
@@ -44,7 +47,11 @@ import {
4447 hasValue ,
4548 isNotEmpty ,
4649} from '../shared/empty.util' ;
50+ import { ErrorComponent } from '../shared/error/error.component' ;
51+ import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component' ;
4752import { NotificationsService } from '../shared/notifications/notifications.service' ;
53+ import { PaginationComponent } from '../shared/pagination/pagination.component' ;
54+ import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model' ;
4855import { followLink } from '../shared/utils/follow-link-config.model' ;
4956import { VarDirective } from '../shared/utils/var.directive' ;
5057import { ThemedProfilePageMetadataFormComponent } from './profile-page-metadata-form/themed-profile-page-metadata-form.component' ;
@@ -65,6 +72,10 @@ import { ProfilePageSecurityFormComponent } from './profile-page-security-form/p
6572 NgIf ,
6673 NgForOf ,
6774 SuggestionsNotificationComponent ,
75+ NgTemplateOutlet ,
76+ PaginationComponent ,
77+ ThemedLoadingComponent ,
78+ ErrorComponent ,
6879 ] ,
6980 standalone : true ,
7081} )
@@ -122,6 +133,15 @@ export class ProfilePageComponent implements OnInit {
122133 private currentUser : EPerson ;
123134 canChangePassword$ : Observable < boolean > ;
124135
136+ /**
137+ * Default configuration for group pagination
138+ **/
139+ optionsGroupsPagination = Object . assign ( new PaginationComponentOptions ( ) , {
140+ id : 'page_groups' ,
141+ currentPage : 1 ,
142+ pageSize : 20 ,
143+ } ) ;
144+
125145 isResearcherProfileEnabled$ : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
126146
127147 constructor ( private authService : AuthService ,
@@ -131,6 +151,7 @@ export class ProfilePageComponent implements OnInit {
131151 private authorizationService : AuthorizationDataService ,
132152 private configurationService : ConfigurationDataService ,
133153 public dsoNameService : DSONameService ,
154+ private paginationService : PaginationService ,
134155 ) {
135156 }
136157
@@ -142,7 +163,18 @@ export class ProfilePageComponent implements OnInit {
142163 getRemoteDataPayload ( ) ,
143164 tap ( ( user : EPerson ) => this . currentUser = user ) ,
144165 ) ;
145- this . groupsRD$ = this . user$ . pipe ( switchMap ( ( user : EPerson ) => user . groups ) ) ;
166+ this . groupsRD$ = this . paginationService . getCurrentPagination ( this . optionsGroupsPagination . id , this . optionsGroupsPagination ) . pipe (
167+ switchMap ( ( pageOptions : PaginationComponentOptions ) => {
168+ return this . epersonService . findById ( this . currentUser . id , true , true , followLink ( 'groups' , {
169+ findListOptions : {
170+ elementsPerPage : pageOptions . pageSize ,
171+ currentPage : pageOptions . currentPage ,
172+ } } ) ) ;
173+ } ) ,
174+ getAllCompletedRemoteData ( ) ,
175+ getRemoteDataPayload ( ) ,
176+ switchMap ( ( user : EPerson ) => user ?. groups ) ,
177+ ) ;
146178 this . canChangePassword$ = this . user$ . pipe ( switchMap ( ( user : EPerson ) => this . authorizationService . isAuthorized ( FeatureID . CanChangePassword , user . _links . self . href ) ) ) ;
147179 this . specialGroupsRD$ = this . authService . getSpecialGroupsFromAuthStatus ( ) ;
148180
0 commit comments