4 files changed
+8
-7
No files matched your search
@@ -46,7 +46,7 @@ const ActionsMenu = ({
|
||||
setIsLoading(true);
|
||||
const action = await dispatch(pauseUptimeMonitor({ monitorId: monitor._id }));
|
||||
if (pauseUptimeMonitor.fulfilled.match(action)) {
|
||||
const state = action?.payload?.data.isActive === false ? "paused" : "resumed";
|
||||
const state = action?.payload?.data.isActive === false ? "resumed" : "paused";
|
||||
createToast({ body: `Monitor ${state} successfully.` });
|
||||
pauseCallback();
|
||||
} else {
|
||||
|
||||
@@ -13,6 +13,7 @@ export const useFetchMonitorsWithChecks = ({
|
||||
filter,
|
||||
field,
|
||||
order,
|
||||
monitorUpdateTrigger,
|
||||
}) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [count, setCount] = useState(undefined);
|
||||
@@ -63,6 +64,7 @@ export const useFetchMonitorsWithChecks = ({
|
||||
teamId,
|
||||
theme,
|
||||
types,
|
||||
monitorUpdateTrigger,
|
||||
]);
|
||||
return [monitors, count, isLoading, networkError];
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { networkService } from "../main";
|
||||
import { createToast } from "../Utils/toastUtils";
|
||||
|
||||
export const useFetchMonitorsWithSummary = ({ teamId, types }) => {
|
||||
export const useFetchMonitorsWithSummary = ({ teamId, types, monitorUpdateTrigger }) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [monitors, setMonitors] = useState(undefined);
|
||||
const [monitorsSummary, setMonitorsSummary] = useState(undefined);
|
||||
@@ -30,7 +30,7 @@ export const useFetchMonitorsWithSummary = ({ teamId, types }) => {
|
||||
}
|
||||
};
|
||||
fetchMonitors();
|
||||
}, [teamId, types]);
|
||||
}, [teamId, types, monitorUpdateTrigger]);
|
||||
return [monitors, monitorsSummary, isLoading, networkError];
|
||||
};
|
||||
|
||||
|
||||
@@ -24,14 +24,12 @@ import { useState, useCallback } from "react";
|
||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import useMonitorsFetch from "./Hooks/useMonitorsFetch";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { setRowsPerPage } from "../../../Features/UI/uiSlice";
|
||||
import PropTypes from "prop-types";
|
||||
import useFetchMonitorsWithSummary from "../../../Hooks/useFetchMonitorsWithSummary";
|
||||
import useFetchMonitorsWithChecks from "../../../Hooks/useFetchMonitorsWithChecks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }];
|
||||
const TYPES = ["http", "ping", "docker", "port"];
|
||||
const CreateMonitorButton = ({ shouldRender }) => {
|
||||
@@ -103,6 +101,7 @@ const UptimeMonitors = () => {
|
||||
useFetchMonitorsWithSummary({
|
||||
teamId,
|
||||
types: TYPES,
|
||||
monitorUpdateTrigger,
|
||||
});
|
||||
|
||||
const [
|
||||
@@ -119,11 +118,10 @@ const UptimeMonitors = () => {
|
||||
filter: search,
|
||||
field: sort?.field,
|
||||
order: sort?.order,
|
||||
triggerUpdate,
|
||||
monitorUpdateTrigger,
|
||||
});
|
||||
|
||||
const isLoading = monitorsWithSummaryIsLoading || monitorsWithChecksIsLoading;
|
||||
|
||||
if (networkError) {
|
||||
return (
|
||||
<GenericFallback>
|
||||
@@ -194,6 +192,7 @@ const UptimeMonitors = () => {
|
||||
sort={sort}
|
||||
setSort={setSort}
|
||||
monitorsAreLoading={monitorsWithChecksIsLoading}
|
||||
triggerUpdate={triggerUpdate}
|
||||
/>
|
||||
<Pagination
|
||||
itemCount={monitorsWithChecksCount}
|
||||
|
||||
Reference in new issue
Block a user