mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Fleet UI: Manage Host Page disable next on pagination of if on last page of results (#7356)
This commit is contained in:
parent
1f149a7d8d
commit
5e8f46da73
3 changed files with 10 additions and 0 deletions
1
changes/issue-7357-fix-next-button-server-side
Normal file
1
changes/issue-7357-fix-next-button-server-side
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Disable next buton for manage host page when next page has 0 results
|
||||
|
|
@ -78,6 +78,7 @@ import {
|
|||
LABEL_SLUG_PREFIX,
|
||||
DEFAULT_SORT_HEADER,
|
||||
DEFAULT_SORT_DIRECTION,
|
||||
DEFAULT_PAGE_SIZE,
|
||||
HOST_SELECT_STATUSES,
|
||||
} from "./constants";
|
||||
import { isAcceptableStatus, getNextLocationPath } from "./helpers";
|
||||
|
|
@ -563,6 +564,12 @@ const ManageHostsPage = ({
|
|||
}
|
||||
}, [availableTeams, currentTeam, location, labels]);
|
||||
|
||||
const isLastPage =
|
||||
tableQueryData &&
|
||||
!!filteredHostCount &&
|
||||
DEFAULT_PAGE_SIZE * tableQueryData.pageIndex + (hosts?.length || 0) >=
|
||||
filteredHostCount;
|
||||
|
||||
const handleLabelChange = ({ slug }: ILabel): boolean => {
|
||||
if (!slug) {
|
||||
return false;
|
||||
|
|
@ -1889,6 +1896,7 @@ const ManageHostsPage = ({
|
|||
onPrimarySelectActionClick={onDeleteHostsClick}
|
||||
onQueryChange={onTableQueryChange}
|
||||
toggleAllPagesSelected={toggleAllMatchingHosts}
|
||||
disableNextPage={isLastPage}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export const LABEL_SLUG_PREFIX = "labels/";
|
|||
|
||||
export const DEFAULT_SORT_HEADER = "hostname";
|
||||
export const DEFAULT_SORT_DIRECTION = "asc";
|
||||
export const DEFAULT_PAGE_SIZE = 20;
|
||||
|
||||
export const HOST_SELECT_STATUSES = [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue