pagination fix
This commit is contained in:
1 parent
93c24d2f5c
commit
e7e4ce7f57
5 files changed
+15
-5
No files matched your search
@@ -71,7 +71,7 @@ const InfrastructureMonitors = () => {
|
|||||||
|
|
||||||
const field = toFilterStatus !== undefined ? "status" : undefined;
|
const field = toFilterStatus !== undefined ? "status" : undefined;
|
||||||
|
|
||||||
const [monitors, count, isLoading, networkError] = useFetchMonitorsWithChecks({
|
const [summary, monitors, count, isLoading, networkError] = useFetchMonitorsWithChecks({
|
||||||
types: TYPES,
|
types: TYPES,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
page: page,
|
page: page,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Grid, Grid2 } from "@mui/material";
|
|||||||
import Card from "../Card/index.jsx";
|
import Card from "../Card/index.jsx";
|
||||||
|
|
||||||
const MonitorGrid = ({ shouldRender, monitors }) => {
|
const MonitorGrid = ({ shouldRender, monitors }) => {
|
||||||
|
console.log(monitors);
|
||||||
return (
|
return (
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const PageSpeed = () => {
|
|||||||
const isAdmin = useIsAdmin();
|
const isAdmin = useIsAdmin();
|
||||||
|
|
||||||
const [
|
const [
|
||||||
|
summary,
|
||||||
monitorsWithChecks,
|
monitorsWithChecks,
|
||||||
monitorsWithChecksCount,
|
monitorsWithChecksCount,
|
||||||
monitorsWithChecksIsLoading,
|
monitorsWithChecksIsLoading,
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { setRowsPerPage } from "../../../Features/UI/uiSlice.js";
|
import { setRowsPerPage } from "../../../Features/UI/uiSlice.js";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useFetchMonitorsWithChecks } from "@/Hooks/monitorHooks.js";
|
import {
|
||||||
|
useFetchMonitorsWithChecks,
|
||||||
|
useFetchMonitorsByTeamId,
|
||||||
|
} from "@/Hooks/monitorHooks.js";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const TYPES = ["http", "ping", "docker", "port", "game"];
|
const TYPES = ["http", "ping", "docker", "port", "game"];
|
||||||
@@ -136,6 +139,11 @@ const UptimeMonitors = () => {
|
|||||||
monitorUpdateTrigger,
|
monitorUpdateTrigger,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [monitors, listIsLoading, listNetworkError] = useFetchMonitorsByTeamId({
|
||||||
|
type: ["http", "ping", "docker", "port", "game"],
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(monitors);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isSearching) {
|
if (isSearching) {
|
||||||
setPage(undefined);
|
setPage(undefined);
|
||||||
@@ -149,7 +157,7 @@ const UptimeMonitors = () => {
|
|||||||
<PageStateWrapper
|
<PageStateWrapper
|
||||||
networkError={networkError}
|
networkError={networkError}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
items={monitorsWithChecks}
|
items={monitors}
|
||||||
type="uptimeMonitor"
|
type="uptimeMonitor"
|
||||||
fallbackLink="/uptime/create"
|
fallbackLink="/uptime/create"
|
||||||
>
|
>
|
||||||
@@ -187,7 +195,7 @@ const UptimeMonitors = () => {
|
|||||||
handleReset={handleReset}
|
handleReset={handleReset}
|
||||||
/>
|
/>
|
||||||
<SearchComponent
|
<SearchComponent
|
||||||
monitors={monitorsWithChecks}
|
monitors={monitors}
|
||||||
onSearchChange={setSearch}
|
onSearchChange={setSearch}
|
||||||
setIsSearching={setIsSearching}
|
setIsSearching={setIsSearching}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
|||||||
};
|
};
|
||||||
|
|
||||||
findByTeamId = async (teamId: string, config: TeamQueryConfig): Promise<Monitor[] | null> => {
|
findByTeamId = async (teamId: string, config: TeamQueryConfig): Promise<Monitor[] | null> => {
|
||||||
const { page = 0, rowsPerPage = 5, filter, field = "createdAt", order = "desc", type, limit } = config ?? {};
|
const { page = 0, rowsPerPage = 0, filter, field = "createdAt", order = "desc", type, limit } = config ?? {};
|
||||||
|
|
||||||
const query: Record<string, unknown> = {
|
const query: Record<string, unknown> = {
|
||||||
teamId: new mongoose.Types.ObjectId(teamId),
|
teamId: new mongoose.Types.ObjectId(teamId),
|
||||||
|
|||||||
Reference in new issue
Block a user