Fleet UI: Fix bug to view more than 20 teams (#7623)

This commit is contained in:
RachelElysia 2022-09-08 11:13:20 -04:00 committed by GitHub
parent df014bd508
commit cd8e42ba82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 13 deletions

View file

@ -0,0 +1 @@
* UI supports more than 20 teams

View file

@ -253,7 +253,7 @@ const TeamManagementPage = (): JSX.Element => {
showMarkAllPages={false}
isAllPagesSelected={false}
searchable={teams && teams.length > 0 && searchString !== ""}
disablePagination
isClientSidePagination
/>
)}
{showCreateTeamModal && (

View file

@ -3,6 +3,7 @@ import sendRequest from "services";
import endpoints from "utilities/endpoints";
import { pick } from "lodash";
import { buildQueryStringFromParams } from "utilities/url";
import { IEnrollSecret } from "interfaces/enroll_secret";
import {
INewMembersBody,
@ -51,21 +52,15 @@ export default {
return sendRequest("GET", path);
},
loadAll: ({
page = 0,
perPage = 20,
globalFilter = "",
}: ILoadTeamsParams = {}): Promise<ILoadTeamsResponse> => {
const { TEAMS } = endpoints;
const queryParams = {
query: globalFilter,
};
// TODO: add this query param logic to client class
const pagination = `page=${page}&per_page=${perPage}`;
let searchQuery = "";
if (globalFilter !== "") {
searchQuery = `&query=${globalFilter}`;
}
const path = `${TEAMS}?${pagination}${searchQuery}`;
const queryString = buildQueryStringFromParams(queryParams);
const endpoint = endpoints.TEAMS;
const path = `${endpoint}?${queryString}`;
return sendRequest("GET", path);
},