Fix an issue with results per page causing page to crash

This commit is contained in:
Konstantinos Triantafyllou 2022-06-06 11:55:11 +03:00
parent b88c65a343
commit 99e3aad2a0
2 changed files with 4 additions and 8 deletions

View File

@ -276,17 +276,17 @@
<div *ngIf="(searchUtils.status !== errorCodes.LOADING || !loadPaging)"> <div *ngIf="(searchUtils.status !== errorCodes.LOADING || !loadPaging)">
<ng-container *ngTemplateOutlet="selected_filters_pills;"></ng-container> <ng-container *ngTemplateOutlet="selected_filters_pills;"></ng-container>
</div> </div>
<div *ngIf="availablePageOptions.length > 0 || sort || searchUtils.totalResults > searchUtils.size || <div *ngIf="searchUtils.totalResults > 10 || sort || searchUtils.totalResults > searchUtils.size ||
(!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING)" (!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING)"
class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-margin-medium-top" uk-grid> class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-margin-medium-top" uk-grid>
<div> <div>
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<div *ngIf="availablePageOptions.length > 0" class="uk-width-small uk-margin-right"> <div *ngIf="searchUtils.totalResults > 10" class="uk-width-small uk-margin-right">
<div input type="select" placeholder="Results per page" inputClass="flat x-small" <div input type="select" placeholder="Results per page" inputClass="flat x-small"
[options]="availablePageOptions" [(value)]="searchUtils.size" [disabled]="disabled" [options]="pageOptions" [(value)]="searchUtils.size" [disabled]="disabled"
(valueChange)="sizeChanged($event)"></div> (valueChange)="sizeChanged($event)"></div>
</div> </div>
<search-sorting *ngIf="sort" <search-sorting *ngIf="sort && searchUtils.totalResults > 0"
[entityType]="entityType" [sortBy]="searchUtils.sortBy" [entityType]="entityType" [sortBy]="searchUtils.sortBy"
(sortByChange)="sortByChanged($event)" (sortByChange)="sortByChanged($event)"
[isDisabled]="disabled"> [isDisabled]="disabled">

View File

@ -1701,8 +1701,4 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
} }
return totalPages; return totalPages;
} }
get availablePageOptions() {
return this.pageOptions.filter(option => option < this.searchUtils.totalResults);
}
} }