UI – Fix hosts table pagination (#20853)

## #20604
<img width="1511" alt="Screenshot 2024-07-30 at 11 50 20 AM"
src="https://github.com/user-attachments/assets/c96ff108-4c3b-436a-8d4b-c3e2099264dd">

<img width="1511" alt="Screenshot 2024-07-30 at 11 50 48 AM"
src="https://github.com/user-attachments/assets/63a4596a-dd12-41e3-8c83-f196ac3b3a40">

- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
jacobshandling 2024-07-31 10:02:16 -07:00 committed by GitHub
parent a33bd65272
commit d19e5c4a9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View file

@ -0,0 +1 @@
* Fix a bug where hosts page would sometimes allow excess pagination

View file

@ -55,7 +55,7 @@ export const LABEL_SLUG_PREFIX = "labels/";
export const DEFAULT_SORT_HEADER = "display_name";
export const DEFAULT_SORT_DIRECTION = "asc";
export const DEFAULT_PAGE_SIZE = 20;
export const DEFAULT_PAGE_SIZE = 50;
export const DEFAULT_PAGE_INDEX = 0;
export const getHostSelectStatuses = (isSandboxMode = false) => {

View file

@ -405,8 +405,8 @@ const ManageHostsPage = ({
osName,
osVersion,
vulnerability,
page: tableQueryData ? tableQueryData.pageIndex : 0,
perPage: tableQueryData ? tableQueryData.pageSize : 50,
page: tableQueryData ? tableQueryData.pageIndex : DEFAULT_PAGE_INDEX,
perPage: tableQueryData ? tableQueryData.pageSize : DEFAULT_PAGE_SIZE,
device_mapping: true,
osSettings: osSettingsStatus,
diskEncryptionStatus,
@ -1578,7 +1578,7 @@ const ManageHostsPage = ({
}
defaultPageIndex={page || DEFAULT_PAGE_INDEX}
defaultSearchQuery={searchQuery}
pageSize={50}
pageSize={DEFAULT_PAGE_SIZE}
additionalQueries={JSON.stringify(selectedFilters)}
inputPlaceHolder={HOSTS_SEARCH_BOX_PLACEHOLDER}
actionButton={{