improve checks fetch and paginaiton

This commit is contained in:
Alex Holliday committed 2025-12-23 19:26:07 +00:00
1 parent 6978a7e2bb
commit 4667c59573
4 files changed
+131 -21

No files matched your search

+3 -3
View File
@@ -29,7 +29,7 @@ const ChecksPage = () => {
const monitors: IMonitor[] = monitorResponse?.data || [];
const { response: checksResponse, loading: checksLoading } = useGet<
ApiResponse<{ count: number; checks: ICheck[] }>
ApiResponse<{ hasMore: boolean; checks: ICheck[] }>
>(
`/checks?page=${page}&rowsPerPage=${rowsPerPage}&range=${range}&status=${status}${
selectedMonitorId !== "all" ? `&monitorId=${selectedMonitorId}` : ""
@@ -44,7 +44,7 @@ const ChecksPage = () => {
);
const checks = checksResponse?.data?.checks || [];
const checksCount = checksResponse?.data?.count || 0;
const hasMore = checksResponse?.data?.hasMore;
return (
<BasePage>
@@ -97,7 +97,7 @@ const ChecksPage = () => {
</Stack>
<ChecksTable
checks={checks}
count={checksCount}
hasMore={hasMore}
page={page}
setPage={setPage}
rowsPerPage={rowsPerPage}
+5 -4
View File
@@ -20,14 +20,14 @@ type CheckWithMonitor = ICheck & {
export const ChecksTable = ({
checks,
count,
hasMore,
page,
setPage,
rowsPerPage,
setRowsPerPage,
}: {
checks: CheckWithMonitor[];
count: number;
hasMore?: boolean;
page: number;
setPage: (page: number) => void;
rowsPerPage: number;
@@ -76,7 +76,7 @@ export const ChecksTable = ({
},
{
id: "message",
content: t("checks.table.headers.message"),
content: t("common.table.headers.message"),
render: (row) => {
return row.message || "N/A";
},
@@ -114,7 +114,8 @@ export const ChecksTable = ({
/>
<Pagination
component="div"
count={count}
count={0}
hasMore={hasMore}
page={page}
rowsPerPage={rowsPerPage}
onPageChange={handlePageChange}