translation fix
This commit is contained in:
1 parent
2523d73625
commit
310084a902
2 files changed
+26
-11
No files matched your search
@@ -10,6 +10,7 @@ import PropTypes from "prop-types";
|
|||||||
import Dialog from "../../../../../Components/Dialog";
|
import Dialog from "../../../../../Components/Dialog";
|
||||||
import { networkService } from "../../../../../Utils/NetworkService.js";
|
import { networkService } from "../../../../../Utils/NetworkService.js";
|
||||||
import { usePauseMonitor } from "../../../../../Hooks/monitorHooks";
|
import { usePauseMonitor } from "../../../../../Hooks/monitorHooks";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InfrastructureMenu Component
|
* InfrastructureMenu Component
|
||||||
@@ -31,6 +32,7 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
|
|||||||
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [pauseMonitor] = usePauseMonitor();
|
const [pauseMonitor] = usePauseMonitor();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const openMenu = (e) => {
|
const openMenu = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -64,12 +66,16 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
|
|||||||
try {
|
try {
|
||||||
await pauseMonitor({ monitorId: monitor.id });
|
await pauseMonitor({ monitorId: monitor.id });
|
||||||
createToast({
|
createToast({
|
||||||
body: `Monitor ${monitor.isActive ? "paused" : "resumed"} successfully.`,
|
body: t("monitorActions.pauseResumeSuccess", "Monitor {{action}} successfully", {
|
||||||
|
action: monitor.isActive ? t("monitorActions.paused", "paused") : t("monitorActions.resumed", "resumed")
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
updateCallback();
|
updateCallback();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
createToast({
|
createToast({
|
||||||
body: `Failed to ${monitor.isActive ? "pause" : "resume"} monitor.`,
|
body: t("monitorActions.pauseResumeFailed", "Failed to {{action}} monitor", {
|
||||||
|
action: monitor.isActive ? t("pause", "pause") : t("resume", "resume")
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -79,9 +85,9 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
|
|||||||
await networkService.deleteMonitorById({
|
await networkService.deleteMonitorById({
|
||||||
monitorId: monitor.id,
|
monitorId: monitor.id,
|
||||||
});
|
});
|
||||||
createToast({ body: "Monitor deleted successfully." });
|
createToast({ body: t("monitorActions.deleteSuccess", "Monitor deleted successfully") });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
createToast({ body: "Failed to delete monitor." });
|
createToast({ body: t("monitorActions.deleteFailed", "Failed to delete monitor") });
|
||||||
} finally {
|
} finally {
|
||||||
setIsDialogOpen(false);
|
setIsDialogOpen(false);
|
||||||
updateCallback();
|
updateCallback();
|
||||||
@@ -125,13 +131,13 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={() => openDetails(monitor.id)}>Details</MenuItem>
|
<MenuItem onClick={() => openDetails(monitor.id)}>{t("monitorActions.details", "Details")}</MenuItem>
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<MenuItem onClick={() => openConfigure(monitor.id)}>Configure</MenuItem>
|
<MenuItem onClick={() => openConfigure(monitor.id)}>{t("configure", "Configure")}</MenuItem>
|
||||||
)}
|
)}
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<MenuItem onClick={handlePause}>
|
<MenuItem onClick={handlePause}>
|
||||||
{monitor.isActive ? "Pause" : "Resume"}
|
{monitor.isActive ? t("pause", "Pause") : t("resume", "Resume")}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
@@ -139,17 +145,17 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
|
|||||||
onClick={openRemove}
|
onClick={openRemove}
|
||||||
sx={{ color: theme.palette.error.main }}
|
sx={{ color: theme.palette.error.main }}
|
||||||
>
|
>
|
||||||
Remove
|
{t("remove", "Remove")}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
<Dialog
|
<Dialog
|
||||||
open={isDialogOpen}
|
open={isDialogOpen}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
title="Do you really want to delete this monitor?"
|
title={t("deleteDialogTitle", "Do you really want to delete this monitor?")}
|
||||||
description="Once deleted, this monitor cannot be retrieved."
|
description={t("deleteDialogDescription", "Once deleted, this monitor cannot be retrieved.")}
|
||||||
onCancel={cancelRemove}
|
onCancel={cancelRemove}
|
||||||
confirmationButtonLabel="Delete"
|
confirmationButtonLabel={t("delete", "Delete")}
|
||||||
onConfirm={handleRemove}
|
onConfirm={handleRemove}
|
||||||
modelTitle="modal-delete-monitor"
|
modelTitle="modal-delete-monitor"
|
||||||
modelDescription="delete-monitor-confirmation"
|
modelDescription="delete-monitor-confirmation"
|
||||||
|
|||||||
@@ -280,6 +280,15 @@
|
|||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"createA": "Create a",
|
"createA": "Create a",
|
||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
|
"monitorActions": {
|
||||||
|
"details": "Details",
|
||||||
|
"paused": "paused",
|
||||||
|
"resumed": "resumed",
|
||||||
|
"pauseResumeSuccess": "Monitor {{action}} successfully",
|
||||||
|
"pauseResumeFailed": "Failed to {{action}} monitor",
|
||||||
|
"deleteSuccess": "Monitor deleted successfully",
|
||||||
|
"deleteFailed": "Failed to delete monitor"
|
||||||
|
},
|
||||||
"maintenanceWindowDescription": "Your pings won't be sent during this time frame",
|
"maintenanceWindowDescription": "Your pings won't be sent during this time frame",
|
||||||
"startTime": "Start time",
|
"startTime": "Start time",
|
||||||
"timeZoneInfo": "All dates and times are in GMT+0 time zone.",
|
"timeZoneInfo": "All dates and times are in GMT+0 time zone.",
|
||||||
|
|||||||
Reference in new issue
Block a user