From 50169222c721c7ce122c727db340e25db417353b Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 28 Apr 2023 16:10:32 +0300 Subject: [PATCH] Fix infinite loop in home page when total number of results is less than the page size --- .../src/app/core/services/logging/logging-service.ts | 8 ++++---- .../src/app/ui/dashboard/drafts/drafts.component.ts | 2 +- .../recent-edited-activity.component.ts | 4 ++-- .../recent-edited-dataset-activity.component.ts | 4 ++-- .../recent-edited-dmp-activity.component.ts | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dmp-frontend/src/app/core/services/logging/logging-service.ts b/dmp-frontend/src/app/core/services/logging/logging-service.ts index b8d8a2629..24b9d2645 100644 --- a/dmp-frontend/src/app/core/services/logging/logging-service.ts +++ b/dmp-frontend/src/app/core/services/logging/logging-service.ts @@ -44,17 +44,17 @@ export class LoggingService { switch (level) { case LogLevel.Debug: // tslint:disable-next-line:no-console - console.debug(objects.join(', ')); + // console.debug(objects.join(', ')); break; case LogLevel.Info: // tslint:disable-next-line:no-console - console.info(objects.join(', ')); + // console.info(objects.join(', ')); break; case LogLevel.Warning: - console.warn(objects.join(', ')); + // console.warn(objects.join(', ')); break; case LogLevel.Error: - console.error(objects.join(', ')); + // console.error(objects.join(', ')); break; } }); diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts index 369332994..8e035eb31 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -122,7 +122,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { this.datasetDrafts = response.data; this.totalCount = response.totalCount; this.totalCountDraftDatasets.emit(this.datasetDrafts.length); - if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) { + if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "drafts", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value; 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 56394ae6f..682565fb6 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 @@ -151,7 +151,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn } }); this.totalCountRecentEdited.emit(this.allRecentActivities.length); - if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize) { + if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value; @@ -186,7 +186,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn } }); this.totalCountRecentEdited.emit(this.allRecentActivities.length); - if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize) { + if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value; diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts index 7a98594b7..4967e0b70 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.ts @@ -122,7 +122,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen this.datasetActivities = response.data; this.totalCount = response.totalCount; this.totalCountDatasets.emit(this.datasetActivities.length) - if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) { + if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value; @@ -146,7 +146,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen this.datasetActivities = response.data; this.totalCount = response.totalCount; this.totalCountDatasets.emit(this.datasetActivities.length); - if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) { + if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value; diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts index 56dff7e62..e31593623 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts @@ -133,7 +133,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O this.dmpActivities = response.data; this.totalCount = response.totalCount; this.totalCountDmps.emit(this.dmpActivities.length); - if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) { + if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value; @@ -182,7 +182,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O this.dmpActivities = response.data; this.totalCount = response.totalCount; this.totalCountDmps.emit(this.dmpActivities.length); - if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) { + if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) { let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value }; if(this.formGroup.get("like").value) { queryParams['keyword'] = this.formGroup.get("like").value;