From 468f786a286b2eae87ba4d756cd54ff0405da19b Mon Sep 17 00:00:00 2001 From: Sufiyan Shaikh Date: Mon, 7 Mar 2022 11:50:33 +0530 Subject: [PATCH] [DSC-508] Customize TopComponent query pagination --- src/app/+explore/explore.component.spec.ts | 1 + src/app/core/layout/models/section.model.ts | 1 + .../top-section/top-section.component.spec.ts | 2 ++ .../section-component/top-section/top-section.component.ts | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/+explore/explore.component.spec.ts b/src/app/+explore/explore.component.spec.ts index a2157585b29..9cca573466b 100644 --- a/src/app/+explore/explore.component.spec.ts +++ b/src/app/+explore/explore.component.spec.ts @@ -34,6 +34,7 @@ describe('ExploreComponent', () => { style: 'col-md-6', order: 'desc', sortField: 'dc.date.accessioned', + numberOfItems: 5, titleKey: 'lastPublications' }; diff --git a/src/app/core/layout/models/section.model.ts b/src/app/core/layout/models/section.model.ts index a04e8c0fa27..f0704387a23 100644 --- a/src/app/core/layout/models/section.model.ts +++ b/src/app/core/layout/models/section.model.ts @@ -55,6 +55,7 @@ export interface TopSection extends SectionComponent { order: string; titleKey: string; componentType: 'top'; + numberOfItems: number; } export interface SearchSection extends SectionComponent { diff --git a/src/app/shared/explore/section-component/top-section/top-section.component.spec.ts b/src/app/shared/explore/section-component/top-section/top-section.component.spec.ts index 1fbfaaf3ed8..50d31e5089d 100644 --- a/src/app/shared/explore/section-component/top-section/top-section.component.spec.ts +++ b/src/app/shared/explore/section-component/top-section/top-section.component.spec.ts @@ -81,6 +81,7 @@ describe('TopSectionComponent', () => { style: 'col-md-6', order: 'desc', sortField: 'dc.date.accessioned', + numberOfItems: 5, titleKey: undefined }; @@ -119,6 +120,7 @@ describe('TopSectionComponent', () => { style: 'col-md-6', order: 'desc', sortField: 'dc.date.foo', + numberOfItems: 5, titleKey: 'lastPublications' }; diff --git a/src/app/shared/explore/section-component/top-section/top-section.component.ts b/src/app/shared/explore/section-component/top-section/top-section.component.ts index 0e7b24e3da3..6ee6c71066a 100644 --- a/src/app/shared/explore/section-component/top-section/top-section.component.ts +++ b/src/app/shared/explore/section-component/top-section/top-section.component.ts @@ -26,12 +26,12 @@ export class TopSectionComponent implements OnInit { paginatedSearchOptions: PaginatedSearchOptions; ngOnInit() { - const order = this.topSection.order; + const numberOfItems = this.topSection.numberOfItems; const sortDirection = order && order.toUpperCase() === 'ASC' ? SortDirection.ASC : SortDirection.DESC; const pagination: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { id: 'search-object-pagination', - pageSize: 5, + pageSize: numberOfItems, currentPage: 1 });