uptime
This commit is contained in:
1 parent
7f15811fdf
commit
8e6a8e5a06
7 files changed
+113
-114
No files matched your search
@@ -88,6 +88,7 @@ const UptimeMonitors = () => {
|
||||
);
|
||||
|
||||
const monitors: IMonitor[] = response?.data?.monitors ?? ([] as IMonitor[]);
|
||||
const checksMap = response?.data?.checksMap || {};
|
||||
const count = response?.data?.count || 0;
|
||||
const upCount = response?.data?.upCount || 0;
|
||||
const downCount = response?.data?.downCount || 0;
|
||||
@@ -156,6 +157,7 @@ const UptimeMonitors = () => {
|
||||
/>
|
||||
<MonitorTable
|
||||
monitors={monitors}
|
||||
checksMap={checksMap}
|
||||
refetch={refetch}
|
||||
setSelectedMonitor={setSelectedMonitor}
|
||||
sortField={sortField}
|
||||
|
||||
@@ -14,12 +14,14 @@ import { useTheme } from "@mui/material/styles";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { usePatch } from "@/hooks/UseApi";
|
||||
|
||||
import type { ICheck } from "@/types/check";
|
||||
import type { IMonitor } from "@/types/monitor";
|
||||
import type { ActionMenuItem } from "@/components/actions-menu";
|
||||
import type { ChartType } from "@/features/uiSlice";
|
||||
|
||||
export const MonitorTable = ({
|
||||
monitors,
|
||||
checksMap,
|
||||
refetch,
|
||||
setSelectedMonitor,
|
||||
sortField,
|
||||
@@ -33,6 +35,7 @@ export const MonitorTable = ({
|
||||
setRowsPerPage,
|
||||
}: {
|
||||
monitors: IMonitor[];
|
||||
checksMap: Record<string, ICheck[]>;
|
||||
refetch: Function;
|
||||
setSelectedMonitor: Function;
|
||||
sortField: string;
|
||||
@@ -206,9 +209,9 @@ export const MonitorTable = ({
|
||||
content: t("monitors.uptime.table.headers.responseTime"),
|
||||
render: (row) => {
|
||||
if (chartType === "histogram") {
|
||||
return <HistogramResponseTime checks={row.latestChecks ?? []} />;
|
||||
return <HistogramResponseTime checks={checksMap[row._id] ?? []} />;
|
||||
} else {
|
||||
return <HeatmapResponseTime checks={row.latestChecks ?? []} />;
|
||||
return <HeatmapResponseTime checks={checksMap[row._id] ?? []} />;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface IMonitor {
|
||||
createdBy: string;
|
||||
interval: number;
|
||||
rejectUnauthorized: boolean;
|
||||
latestChecks: ICheck[];
|
||||
latestStatuses: MonitorStatus[];
|
||||
n: number;
|
||||
name: string;
|
||||
port: number;
|
||||
@@ -56,6 +56,7 @@ export interface IMonitorWithStats {
|
||||
upCount: number;
|
||||
pausedCount: number;
|
||||
monitors: IMonitor[];
|
||||
checksMap: Record<string, ICheck[]>;
|
||||
}
|
||||
|
||||
export interface IMonitorWithMonitorStats {
|
||||
|
||||
Reference in new issue
Block a user