mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
onChangeItemsPerPage update
This commit is contained in:
parent
46f433eac3
commit
127c9e5840
1 changed files with 6 additions and 3 deletions
|
@ -65,7 +65,7 @@ interface SavedObjectFinderState {
|
|||
query: string;
|
||||
isFetchingItems: boolean;
|
||||
page: number;
|
||||
perPage: number;
|
||||
perPage: number | 'all';
|
||||
sortDirection?: Direction;
|
||||
sortOpen: boolean;
|
||||
filterOpen: boolean;
|
||||
|
@ -213,6 +213,9 @@ class SavedObjectFinderUi extends React.Component<
|
|||
}
|
||||
|
||||
private getPageCount() {
|
||||
if (this.state.perPage === 'all') {
|
||||
return 1;
|
||||
}
|
||||
return Math.ceil(
|
||||
(this.state.filteredTypes.length === 0
|
||||
? this.state.items.length
|
||||
|
@ -244,9 +247,9 @@ class SavedObjectFinderUi extends React.Component<
|
|||
}
|
||||
|
||||
// If begin is greater than the length of the sequence, an empty array is returned.
|
||||
const startIndex = this.state.page * this.state.perPage;
|
||||
const startIndex = this.state.perPage === 'all' ? 1 : this.state.page * this.state.perPage;
|
||||
// If end is greater than the length of the sequence, slice extracts through to the end of the sequence (arr.length).
|
||||
const lastIndex = startIndex + this.state.perPage;
|
||||
const lastIndex = this.state.perPage === 'all' ? items.length : startIndex + this.state.perPage;
|
||||
return items
|
||||
.filter(
|
||||
(item) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue