This commit is contained in:
Sofia Papacharalampous 2024-05-23 16:16:04 +03:00
parent 9fd8b680e4
commit cd241ec922
1 changed files with 7 additions and 6 deletions

View File

@ -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 = {
@ -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) {