diff --git a/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx b/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx
index 15193da3e..147f1c297 100644
--- a/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx
+++ b/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx
@@ -9,6 +9,8 @@ import Settings from "../../../../../assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types";
import Dialog from "../../../../../Components/Dialog";
import { networkService } from "../../../../../Utils/NetworkService.js";
+import { usePauseMonitor } from "../../../../../Hooks/monitorHooks";
+import { useTranslation } from "react-i18next";
/**
* InfrastructureMenu Component
@@ -19,7 +21,7 @@ import { networkService } from "../../../../../Utils/NetworkService.js";
* @param {string} props.monitor.id - Unique ID of the monitor.
* @param {string} [props.monitor.url] - URL associated with the monitor.
* @param {string} props.monitor.type - Type of monitor (e.g., uptime, infrastructure).
- * @param {boolean} props.monitor.isActive - Indicates if the monitor is currently active.
+ * @param {boolean} props.monitor.isActive - Indicates if the monitor is currently active (true) or paused (false).
* @param {boolean} props.isAdmin - Whether the user has admin privileges.
* @param {Function} props.updateCallback - Callback to trigger when the monitor data is updated.
* @returns {JSX.Element} The rendered component.
@@ -29,6 +31,8 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
const [isOpen, setIsOpen] = useState(false);
const [isDialogOpen, setIsDialogOpen] = useState(false);
const theme = useTheme();
+ const [pauseMonitor] = usePauseMonitor();
+ const { t } = useTranslation();
const openMenu = (e) => {
e.stopPropagation();
@@ -54,14 +58,26 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
navigate(`/infrastructure/${id}`);
}
+ const openConfigure = (id) => {
+ navigate(`/infrastructure/configure/${id}`);
+ };
+
+ const handlePause = async () => {
+ // Pass updateCallback as triggerUpdate to the hook
+ await pauseMonitor({ monitorId: monitor.id, triggerUpdate: updateCallback });
+ // Toast is already displayed in the hook, no need to display it again
+ };
+
const handleRemove = async () => {
try {
await networkService.deleteMonitorById({
monitorId: monitor.id,
});
- createToast({ body: "Monitor deleted successfully." });
+ createToast({
+ body: t("monitorActions.deleteSuccess"),
+ });
} catch (error) {
- createToast({ body: "Failed to delete monitor." });
+ createToast({ body: t("monitorActions.deleteFailed") });
} finally {
setIsDialogOpen(false);
updateCallback();
@@ -105,15 +121,53 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
},
}}
>
- {isAdmin && }
+
+ {isAdmin && (
+
+ )}
+ {isAdmin && (
+
+ )}
+ {isAdmin && (
+
+ )}