Skip to content

Commit

Permalink
[DSC-508] Customize TopComponent query pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Sufiyan Shaikh committed Mar 7, 2022
1 parent 1c8bba5 commit 468f786
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/+explore/explore.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('ExploreComponent', () => {
style: 'col-md-6',
order: 'desc',
sortField: 'dc.date.accessioned',
numberOfItems: 5,
titleKey: 'lastPublications'
};

Expand Down
1 change: 1 addition & 0 deletions src/app/core/layout/models/section.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface TopSection extends SectionComponent {
order: string;
titleKey: string;
componentType: 'top';
numberOfItems: number;
}

export interface SearchSection extends SectionComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('TopSectionComponent', () => {
style: 'col-md-6',
order: 'desc',
sortField: 'dc.date.accessioned',
numberOfItems: 5,
titleKey: undefined
};

Expand Down Expand Up @@ -119,6 +120,7 @@ describe('TopSectionComponent', () => {
style: 'col-md-6',
order: 'desc',
sortField: 'dc.date.foo',
numberOfItems: 5,
titleKey: 'lastPublications'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down

0 comments on commit 468f786

Please sign in to comment.