pagination and empty state fix
This commit is contained in:
1 parent
4e678a4ce7
commit
bd6aa0fa3a
13 files changed
+39
-47
No files matched your search
@@ -215,6 +215,7 @@ export const IncidentsTable = ({
|
||||
rowsPerPage={rowsPerPage}
|
||||
onPageChange={handlePageChange}
|
||||
onRowsPerPageChange={handleRowsPerPageChange}
|
||||
itemsOnPage={incidents.length}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -269,6 +269,7 @@ export const InfraMonitorsTable = ({
|
||||
rowsPerPage={rowsPerPage}
|
||||
onPageChange={handlePageChange}
|
||||
onRowsPerPageChange={handleRowsPerPageChange}
|
||||
itemsOnPage={monitors.length}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -85,13 +85,6 @@ const InfrastructureMonitors = () => {
|
||||
return `/monitors/team/with-checks?${params.toString()}`;
|
||||
}, [page, rowsPerPage, filter, field, sortOrder]);
|
||||
|
||||
const {
|
||||
data: monitors,
|
||||
isLoading: monitorsLoading,
|
||||
error,
|
||||
refetch: refetchMonitors,
|
||||
} = useGet<Monitor[]>("/monitors/team?type=hardware", {}, { keepPreviousData: true });
|
||||
|
||||
const {
|
||||
data: monitorsWithChecksData,
|
||||
isLoading: monitorsWithChecksLoading,
|
||||
@@ -104,7 +97,7 @@ const InfrastructureMonitors = () => {
|
||||
);
|
||||
|
||||
const { summary, count } = monitorsWithChecksData ?? {};
|
||||
const isLoading = monitorsLoading || monitorsWithChecksLoading;
|
||||
const isLoading = monitorsWithChecksLoading;
|
||||
|
||||
// Delete hook
|
||||
const { deleteFn, loading: isDeleting } = useDelete();
|
||||
@@ -114,7 +107,6 @@ const InfrastructureMonitors = () => {
|
||||
await deleteFn(`/monitors/${selectedMonitor.id}`);
|
||||
setSelectedMonitor(null);
|
||||
refetch();
|
||||
refetchMonitors();
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@@ -124,8 +116,8 @@ const InfrastructureMonitors = () => {
|
||||
return (
|
||||
<MonitorBasePageWithStates
|
||||
loading={isLoading}
|
||||
error={error ?? monitorsWithChecksError}
|
||||
items={monitors || []}
|
||||
error={monitorsWithChecksError}
|
||||
totalCount={summary?.totalMonitors ?? 0}
|
||||
page="infrastructure"
|
||||
actionLink="/infrastructure/create"
|
||||
>
|
||||
|
||||
@@ -185,6 +185,7 @@ export const MaintenanceWindowTable = ({
|
||||
emptyViewText={t("common.table.empty")}
|
||||
/>
|
||||
<Pagination
|
||||
itemsOnPage={maintenanceWindows.length}
|
||||
component="div"
|
||||
count={maintenanceWindowCount}
|
||||
page={page}
|
||||
|
||||
@@ -33,12 +33,12 @@ const MaintenanceWindowPage = () => {
|
||||
return (
|
||||
<BasePageWithStates
|
||||
page={t("pages.maintenanceWindow.fallback.title")}
|
||||
totalCount={maintenanceWindowCount}
|
||||
bullets={
|
||||
t("pages.maintenanceWindow.fallback.checks", { returnObjects: true }) as string[]
|
||||
}
|
||||
loading={isLoading}
|
||||
error={!!error}
|
||||
items={maintenanceWindows}
|
||||
actionButtonText={t("pages.maintenanceWindow.fallback.actionButton")}
|
||||
actionLink="/maintenance/create"
|
||||
>
|
||||
|
||||
@@ -45,7 +45,7 @@ const NotificationsPage = () => {
|
||||
}
|
||||
loading={isLoading || isValidating}
|
||||
error={!!error}
|
||||
items={notifications ?? []}
|
||||
totalCount={notifications?.length ?? 0}
|
||||
actionButtonText={t("pages.notifications.fallback.actionButton")}
|
||||
actionLink="/notifications/create"
|
||||
>
|
||||
|
||||
@@ -248,6 +248,7 @@ export const PageSpeedMonitorsTable = ({
|
||||
rowsPerPage={rowsPerPage}
|
||||
onPageChange={handlePageChange}
|
||||
onRowsPerPageChange={handleRowsPerPageChange}
|
||||
itemsOnPage={monitors.length}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -70,7 +70,7 @@ const PageSpeedMonitorsPage = () => {
|
||||
<MonitorBasePageWithStates
|
||||
loading={isLoading}
|
||||
error={monitorsError || settingsError}
|
||||
items={monitors || []}
|
||||
totalCount={summary?.totalMonitors ?? 0}
|
||||
page="pageSpeed"
|
||||
actionLink="/pagespeed/create"
|
||||
priorityFallback={showApiKeyWarning ? <PageSpeedKeyPriorityFallback /> : undefined}
|
||||
|
||||
@@ -43,7 +43,7 @@ const StatusPages = () => {
|
||||
t("pages.statusPages.fallback.checks", { returnObjects: true }) as string[]
|
||||
}
|
||||
error={!!error}
|
||||
items={statusPages ?? []}
|
||||
totalCount={statusPages?.length ?? 0}
|
||||
actionButtonText={t("pages.statusPages.fallback.actionButton")}
|
||||
actionLink="/status/create"
|
||||
>
|
||||
|
||||
@@ -253,6 +253,7 @@ export const MonitorTable = ({
|
||||
rowsPerPage={rowsPerPage}
|
||||
onPageChange={(_e, newPage) => setPage(newPage)}
|
||||
onRowsPerPageChange={(e) => setRowsPerPage(Number(e.target.value))}
|
||||
itemsOnPage={monitors.length}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -85,18 +85,6 @@ const UptimeMonitorsPage = () => {
|
||||
return `/monitors/team/with-checks?${params.toString()}`;
|
||||
}, [effectiveTypes, page, rowsPerPage, filter, field, sortOrder]);
|
||||
|
||||
// Data fetching
|
||||
const {
|
||||
data: monitors,
|
||||
isLoading: monitorsLoading,
|
||||
error,
|
||||
refetch: refetchMonitorsAndSummary,
|
||||
} = useGet<Monitor[]>(
|
||||
"/monitors/team?type=http&type=ping&type=port&type=docker",
|
||||
{},
|
||||
{ keepPreviousData: true }
|
||||
);
|
||||
|
||||
const {
|
||||
data: monitorsWithChecksData,
|
||||
isLoading: monitorsWithChecksLoading,
|
||||
@@ -126,20 +114,19 @@ const UptimeMonitorsPage = () => {
|
||||
await deleteFn(`/monitors/${selectedMonitor.id}`);
|
||||
setSelectedMonitor(null);
|
||||
refetch();
|
||||
refetchMonitorsAndSummary();
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
setSelectedMonitor(null);
|
||||
};
|
||||
|
||||
const isLoading = monitorsLoading || monitorsWithChecksLoading;
|
||||
const isLoading = monitorsWithChecksLoading;
|
||||
|
||||
return (
|
||||
<MonitorBasePageWithStates
|
||||
loading={isLoading}
|
||||
error={error || monitorsWithChecksError}
|
||||
items={monitors || []}
|
||||
error={monitorsWithChecksError}
|
||||
totalCount={summary?.totalMonitors ?? 0}
|
||||
page="uptime"
|
||||
actionLink="/uptime/create"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user