@@ -9,7 +9,12 @@ import { RemoteData } from '../core/data/remote-data';
99import { PaginatedList } from '../core/data/paginated-list.model' ;
1010import { filter , switchMap , tap } from 'rxjs/operators' ;
1111import { EPersonDataService } from '../core/eperson/eperson-data.service' ;
12- import { getAllSucceededRemoteData , getFirstCompletedRemoteData , getRemoteDataPayload } from '../core/shared/operators' ;
12+ import {
13+ getAllCompletedRemoteData ,
14+ getAllSucceededRemoteData ,
15+ getFirstCompletedRemoteData ,
16+ getRemoteDataPayload
17+ } from '../core/shared/operators' ;
1318import { hasValue , isNotEmpty } from '../shared/empty.util' ;
1419import { followLink } from '../shared/utils/follow-link-config.model' ;
1520import { AuthService } from '../core/auth/auth.service' ;
@@ -19,6 +24,8 @@ import { FeatureID } from '../core/data/feature-authorization/feature-id';
1924import { ConfigurationDataService } from '../core/data/configuration-data.service' ;
2025import { ConfigurationProperty } from '../core/shared/configuration-property.model' ;
2126import { DSONameService } from '../core/breadcrumbs/dso-name.service' ;
27+ import { PaginationService } from '../core/pagination/pagination.service' ;
28+ import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model' ;
2229
2330@Component ( {
2431 selector : 'ds-profile-page' ,
@@ -79,6 +86,15 @@ export class ProfilePageComponent implements OnInit {
7986 private currentUser : EPerson ;
8087 canChangePassword$ : Observable < boolean > ;
8188
89+ /**
90+ * Default configuration for group pagination
91+ **/
92+ optionsGroupsPagination = Object . assign ( new PaginationComponentOptions ( ) , {
93+ id : 'page_groups' ,
94+ currentPage : 1 ,
95+ pageSize : 20 ,
96+ } ) ;
97+
8298 isResearcherProfileEnabled$ : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
8399
84100 constructor ( private authService : AuthService ,
@@ -88,6 +104,7 @@ export class ProfilePageComponent implements OnInit {
88104 private authorizationService : AuthorizationDataService ,
89105 private configurationService : ConfigurationDataService ,
90106 public dsoNameService : DSONameService ,
107+ private paginationService : PaginationService ,
91108 ) {
92109 }
93110
@@ -99,7 +116,18 @@ export class ProfilePageComponent implements OnInit {
99116 getRemoteDataPayload ( ) ,
100117 tap ( ( user : EPerson ) => this . currentUser = user )
101118 ) ;
102- this . groupsRD$ = this . user$ . pipe ( switchMap ( ( user : EPerson ) => user . groups ) ) ;
119+ this . groupsRD$ = this . paginationService . getCurrentPagination ( this . optionsGroupsPagination . id , this . optionsGroupsPagination ) . pipe (
120+ switchMap ( ( pageOptions : PaginationComponentOptions ) => {
121+ return this . epersonService . findById ( this . currentUser . id , true , true , followLink ( 'groups' , {
122+ findListOptions : {
123+ elementsPerPage : pageOptions . pageSize ,
124+ currentPage : pageOptions . currentPage ,
125+ } } ) ) ;
126+ } ) ,
127+ getAllCompletedRemoteData ( ) ,
128+ getRemoteDataPayload ( ) ,
129+ switchMap ( ( user : EPerson ) => user ?. groups ) ,
130+ ) ;
103131 this . canChangePassword$ = this . user$ . pipe ( switchMap ( ( user : EPerson ) => this . authorizationService . isAuthorized ( FeatureID . CanChangePassword , user . _links . self . href ) ) ) ;
104132 this . specialGroupsRD$ = this . authService . getSpecialGroupsFromAuthStatus ( ) ;
105133
0 commit comments