mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 13:28:27 +00:00
Display pagination for certs when reached per page init
This commit is contained in:
+6
-3
@@ -27,7 +27,8 @@ import {
|
|||||||
Th,
|
Th,
|
||||||
THead,
|
THead,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Tr} from "@app/components/v2";
|
Tr
|
||||||
|
} from "@app/components/v2";
|
||||||
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
|
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
|
||||||
import { useListWorkspaceCertificates } from "@app/hooks/api";
|
import { useListWorkspaceCertificates } from "@app/hooks/api";
|
||||||
import { certStatusToNameMap } from "@app/hooks/api/certificates/constants";
|
import { certStatusToNameMap } from "@app/hooks/api/certificates/constants";
|
||||||
@@ -45,9 +46,11 @@ type Props = {
|
|||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PER_PAGE_INIT = 25;
|
||||||
|
|
||||||
export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
|
export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [perPage, setPerPage] = useState(25);
|
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
|
||||||
|
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
const { data, isLoading } = useListWorkspaceCertificates({
|
const { data, isLoading } = useListWorkspaceCertificates({
|
||||||
@@ -184,7 +187,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
})}
|
})}
|
||||||
</TBody>
|
</TBody>
|
||||||
</Table>
|
</Table>
|
||||||
{!isLoading && data?.totalCount !== undefined && (
|
{!isLoading && data?.totalCount !== undefined && data.totalCount >= PER_PAGE_INIT && (
|
||||||
<Pagination
|
<Pagination
|
||||||
count={data.totalCount}
|
count={data.totalCount}
|
||||||
page={page}
|
page={page}
|
||||||
|
|||||||
Reference in New Issue
Block a user