diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index 1b4294f25..a3098650c 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -38,6 +38,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn currentPage: number = 0; pageSize: number = 5; listingItems: RecentActivityItem[]= []; + @Input() includeDescriptions: boolean = true; @Input() includeDmps: boolean = true; @@ -145,8 +146,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn return this.authentication.currentAccountIsAuthenticated(); } - refresh(resetPagination: boolean = false): void { - if (resetPagination) this._resetPagination(); + refresh(): void { this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { @@ -156,7 +156,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn ] }; - const initItems = this.currentPage == 0; + const initItems = this.currentPage == 0; this.loadMore({ size: initItems ? this.pageSize : this.pageSize*this.currentPage, offset: 0 }, initItems); } @@ -206,13 +206,14 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn }) if (updatePage && response.length > 0 && this.listingItems.length >= this.currentPage*this.pageSize) this._setPage(this.currentPage+1); - else this.updateUrl(); + else this._resetPagination(); }); } private _resetPagination(): void { - this.pageSize = 5; - this.currentPage = 0; + if (this.listingItems.length == 0) this.currentPage = 0; + else this.currentPage = Math.ceil(this.listingItems.length/this.pageSize); + this.updateUrl(); } private _setPage(page: number) {