Feat: Migrate Hardcoded Strings

This commit is contained in:
Br0wnHammer committed 2025-03-17 01:16:42 +05:30
1 parent b6113a176f
commit cdbabeb225
30 files changed
+333 -186

No files matched your search

@@ -28,6 +28,7 @@ import {
} from "../../../Utils/timeUtils"; } from "../../../Utils/timeUtils";
import { useNavigate, useParams } from "react-router-dom"; import { useNavigate, useParams } from "react-router-dom";
import { buildErrors, hasValidationErrors } from "../../../Validation/error"; import { buildErrors, hasValidationErrors } from "../../../Validation/error";
import { useTranslation } from "react-i18next";
const getDurationAndUnit = (durationInMs) => { const getDurationAndUnit = (durationInMs) => {
if (durationInMs % MS_PER_DAY === 0) { if (durationInMs % MS_PER_DAY === 0) {
@@ -113,6 +114,7 @@ const CreateMaintenance = () => {
const { maintenanceWindowId } = useParams(); const { maintenanceWindowId } = useParams();
const navigate = useNavigate(); const navigate = useNavigate();
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const { user } = useSelector((state) => state.auth); const { user } = useSelector((state) => state.auth);
const [monitors, setMonitors] = useState([]); const [monitors, setMonitors] = useState([]);
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
@@ -293,7 +295,7 @@ const CreateMaintenance = () => {
component="span" component="span"
fontSize="inherit" fontSize="inherit"
> >
{`${maintenanceWindowId === undefined ? "Create a" : "Edit"}`}{" "} {`${maintenanceWindowId === undefined ? t("createA") : t("edit")}`}{" "}
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
@@ -301,13 +303,13 @@ const CreateMaintenance = () => {
fontSize="inherit" fontSize="inherit"
fontWeight="inherit" fontWeight="inherit"
> >
maintenance{" "} {t("maintenance")}{" "}
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
fontSize="inherit" fontSize="inherit"
> >
window {t("window")}
</Typography> </Typography>
</Typography> </Typography>
<Typography <Typography
@@ -315,7 +317,7 @@ const CreateMaintenance = () => {
variant="body2" variant="body2"
fontSize={14} fontSize={14}
> >
Your pings won&apos;t be sent during this time frame {t("maintenanceWindowDescription")}
</Typography> </Typography>
</Box> </Box>
<ConfigBox> <ConfigBox>
@@ -324,14 +326,14 @@ const CreateMaintenance = () => {
component="h2" component="h2"
variant="h2" variant="h2"
> >
General Settings {t("settingsGeneralSettings")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<TextInput <TextInput
id="name" id="name"
label="Friendly name" label={t("friendlyNameInput")}
placeholder="Maintenance at __ : __ for ___ minutes" placeholder={t("friendlyNamePlaceholder")}
value={form.name} value={form.name}
onChange={(event) => { onChange={(event) => {
handleFormChange("name", event.target.value); handleFormChange("name", event.target.value);
@@ -342,7 +344,7 @@ const CreateMaintenance = () => {
<Select <Select
id="repeat" id="repeat"
name="maintenance-repeat" name="maintenance-repeat"
label="Maintenance Repeat" label={t("maintenanceRepeat")}
value={getIdByValue(repeatConfig, form.repeat)} value={getIdByValue(repeatConfig, form.repeat)}
onChange={(event) => { onChange={(event) => {
handleFormChange( handleFormChange(
@@ -437,15 +439,15 @@ const CreateMaintenance = () => {
component="h2" component="h2"
variant="h2" variant="h2"
> >
Start time {t("startTime")}
</Typography> </Typography>
<Typography>All dates and times are in GMT+0 time zone.</Typography> <Typography>{t("timeZoneInfo")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<LocalizationProvider dateAdapter={AdapterDayjs}> <LocalizationProvider dateAdapter={AdapterDayjs}>
<MobileTimePicker <MobileTimePicker
id="startTime" id="startTime"
label="Start time" label={t("startTime")}
value={form.startTime} value={form.startTime}
onChange={(newTime) => { onChange={(newTime) => {
handleTimeChange("startTime", newTime); handleTimeChange("startTime", newTime);
@@ -486,7 +488,7 @@ const CreateMaintenance = () => {
<TextInput <TextInput
type="number" type="number"
id="duration" id="duration"
label="Duration" label={t("duration")}
value={form.duration} value={form.duration}
onChange={(event) => { onChange={(event) => {
handleFormChange("duration", event.target.value); handleFormChange("duration", event.target.value);
@@ -516,13 +518,13 @@ const CreateMaintenance = () => {
component="h2" component="h2"
variant="h2" variant="h2"
> >
Monitors to apply maintenance window to {t("monitorsToApply")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<Search <Search
id={"monitors"} id={"monitors"}
label="Add monitors" label={t("addMonitors")}
multiple={true} multiple={true}
isAdorned={false} isAdorned={false}
options={monitors ? monitors : []} options={monitors ? monitors : []}
@@ -547,7 +549,7 @@ const CreateMaintenance = () => {
onClick={() => navigate("/maintenance")} onClick={() => navigate("/maintenance")}
sx={{ mr: theme.spacing(6) }} sx={{ mr: theme.spacing(6) }}
> >
Cancel {t("cancel")}
</Button> </Button>
<Button <Button
loading={isLoading} loading={isLoading}
@@ -558,8 +560,8 @@ const CreateMaintenance = () => {
> >
{`${ {`${
maintenanceWindowId === undefined maintenanceWindowId === undefined
? "Create maintenance" ? t("createMaintenance")
: "Edit maintenance" : t("editMaintenance")
}`} }`}
</Button> </Button>
</Box> </Box>
@@ -8,6 +8,7 @@ import Settings from "../../../../assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { networkService } from "../../../../main"; import { networkService } from "../../../../main";
import { createToast } from "../../../../Utils/toastUtils"; import { createToast } from "../../../../Utils/toastUtils";
import { useTranslation } from "react-i18next";
import Dialog from "../../../../Components/Dialog"; import Dialog from "../../../../Components/Dialog";
@@ -18,6 +19,7 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const handleRemove = async (event) => { const handleRemove = async (event) => {
event.preventDefault(); event.preventDefault();
@@ -124,7 +126,7 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
handleEdit(); handleEdit();
}} }}
> >
Edit {t("edit")}
</MenuItem> </MenuItem>
<MenuItem <MenuItem
onClick={(e) => { onClick={(e) => {
@@ -142,7 +144,7 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
openRemove(e); openRemove(e);
}} }}
> >
Remove {t("remove")}
</MenuItem> </MenuItem>
</Menu> </Menu>
<Dialog <Dialog
@@ -10,6 +10,7 @@ import { useDispatch, useSelector } from "react-redux";
import { formatDurationRounded } from "../../../Utils/timeUtils"; import { formatDurationRounded } from "../../../Utils/timeUtils";
import { StatusLabel } from "../../../Components/Label"; import { StatusLabel } from "../../../Components/Label";
import { setRowsPerPage } from "../../../Features/UI/uiSlice"; import { setRowsPerPage } from "../../../Features/UI/uiSlice";
import { useTranslation } from "react-i18next";
import dayjs from "dayjs"; import dayjs from "dayjs";
/** /**
* Component for pagination actions (first, previous, next, last). * Component for pagination actions (first, previous, next, last).
@@ -50,12 +51,14 @@ const MaintenanceTable = ({
setPage(0); setPage(0);
}; };
const { t } = useTranslation();
const headers = [ const headers = [
{ {
id: "name", id: "name",
content: ( content: (
<Box onClick={() => handleSort("name")}> <Box onClick={() => handleSort("name")}>
Maintenance Window Name {t("maintenanceWindowName")}
<span <span
style={{ style={{
visibility: sort.field === "name" ? "visible" : "hidden", visibility: sort.field === "name" ? "visible" : "hidden",
@@ -76,7 +79,7 @@ const MaintenanceTable = ({
content: ( content: (
<Box onClick={() => handleSort("status")}> <Box onClick={() => handleSort("status")}>
{" "} {" "}
Status {t("status")}
<span <span
style={{ style={{
visibility: sort.field === "active" ? "visible" : "hidden", visibility: sort.field === "active" ? "visible" : "hidden",
@@ -105,21 +108,21 @@ const MaintenanceTable = ({
}, },
{ {
id: "nextWindow", id: "nextWindow",
content: "Next window", content: t("nextWindow"),
render: (row) => { render: (row) => {
return getTimeToNextWindow(row.start, row.end, row.repeat); return getTimeToNextWindow(row.start, row.end, row.repeat);
}, },
}, },
{ {
id: "repeat", id: "repeat",
content: "Repeat", content: t("repeat"),
render: (row) => { render: (row) => {
return row.repeat === 0 ? "N/A" : formatDurationRounded(row.repeat); return row.repeat === 0 ? "N/A" : formatDurationRounded(row.repeat);
}, },
}, },
{ {
id: "actions", id: "actions",
content: "Actions", content: t("actions"),
render: (row) => ( render: (row) => (
<ActionsMenu <ActionsMenu
maintenanceWindow={row} maintenanceWindow={row}
+3 -1
View File
@@ -9,9 +9,11 @@ import { networkService } from "../../main";
import Breadcrumbs from "../../Components/Breadcrumbs"; import Breadcrumbs from "../../Components/Breadcrumbs";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useIsAdmin } from "../../Hooks/useIsAdmin"; import { useIsAdmin } from "../../Hooks/useIsAdmin";
import { useTranslation } from "react-i18next";
const Maintenance = () => { const Maintenance = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const navigate = useNavigate(); const navigate = useNavigate();
const { rowsPerPage } = useSelector((state) => state.ui.maintenance); const { rowsPerPage } = useSelector((state) => state.ui.maintenance);
const isAdmin = useIsAdmin(); const isAdmin = useIsAdmin();
@@ -74,7 +76,7 @@ const Maintenance = () => {
}} }}
sx={{ fontWeight: 500 }} sx={{ fontWeight: 500 }}
> >
Create maintenance window {t("createMaintenanceWindow")}
</Button> </Button>
</Stack> </Stack>
<MaintenanceTable <MaintenanceTable
+3 -1
View File
@@ -4,6 +4,7 @@ import NotFoundSvg from "../../../src/assets/Images/sushi_404.svg";
import { Button, Stack, Typography } from "@mui/material"; import { Button, Stack, Typography } from "@mui/material";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
/** /**
* Support for defaultProps will be removed from function components in a future major release * Support for defaultProps will be removed from function components in a future major release
@@ -33,6 +34,7 @@ const DefaultValue = {
const NotFound = ({ title = DefaultValue.title, desc = DefaultValue.desc }) => { const NotFound = ({ title = DefaultValue.title, desc = DefaultValue.desc }) => {
const navigate = useNavigate(); const navigate = useNavigate();
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
return ( return (
<Stack <Stack
@@ -62,7 +64,7 @@ const NotFound = ({ title = DefaultValue.title, desc = DefaultValue.desc }) => {
sx={{ mt: theme.spacing(10) }} sx={{ mt: theme.spacing(10) }}
onClick={() => navigate("/")} onClick={() => navigate("/")}
> >
Go to the main dashboard {t("notFoundButton")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
+21 -20
View File
@@ -13,6 +13,7 @@ import {
import { monitorValidation } from "../../../Validation/validation"; import { monitorValidation } from "../../../Validation/validation";
import { createToast } from "../../../Utils/toastUtils"; import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger"; import { logger } from "../../../Utils/Logger";
import { useTranslation } from "react-i18next";
import ConfigBox from "../../../Components/ConfigBox"; import ConfigBox from "../../../Components/ConfigBox";
import TextInput from "../../../Components/Inputs/TextInput"; import TextInput from "../../../Components/Inputs/TextInput";
import Select from "../../../Components/Inputs/Select"; import Select from "../../../Components/Inputs/Select";
@@ -28,6 +29,7 @@ import Dialog from "../../../Components/Dialog";
const PageSpeedConfigure = () => { const PageSpeedConfigure = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const navigate = useNavigate(); const navigate = useNavigate();
const dispatch = useDispatch(); const dispatch = useDispatch();
const MS_PER_MINUTE = 60000; const MS_PER_MINUTE = 60000;
@@ -256,7 +258,7 @@ const PageSpeedConfigure = () => {
}, },
}} }}
> >
Editing... {t("editing")}
</Typography> </Typography>
</Stack> </Stack>
</Box> </Box>
@@ -284,12 +286,12 @@ const PageSpeedConfigure = () => {
{monitor?.isActive ? ( {monitor?.isActive ? (
<> <>
<PauseCircleOutlineIcon /> <PauseCircleOutlineIcon />
Pause {t("pause")}
</> </>
) : ( ) : (
<> <>
<PlayCircleOutlineRoundedIcon /> <PlayCircleOutlineRoundedIcon />
Resume {t("resume")}
</> </>
)} )}
</Button> </Button>
@@ -302,16 +304,15 @@ const PageSpeedConfigure = () => {
ml: theme.spacing(6), ml: theme.spacing(6),
}} }}
> >
Remove {t("remove")}
</Button> </Button>
</Box> </Box>
</Stack> </Stack>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">General settings</Typography> <Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p"> <Typography component="p">
Here you can select the URL of the host, together with the type of {t("pageSpeedConfigureSettingsDescription")}
monitor.
</Typography> </Typography>
</Box> </Box>
<Stack <Stack
@@ -325,7 +326,7 @@ const PageSpeedConfigure = () => {
<TextInput <TextInput
type="url" type="url"
id="monitor-url" id="monitor-url"
label="URL" label={t("url")}
placeholder="random.website.com" placeholder="random.website.com"
value={monitor?.url || ""} value={monitor?.url || ""}
onChange={handleChange} onChange={handleChange}
@@ -336,7 +337,7 @@ const PageSpeedConfigure = () => {
<TextInput <TextInput
type="text" type="text"
id="monitor-name" id="monitor-name"
label="Monitor display name" label={t("monitorDisplayName")}
placeholder="Example monitor" placeholder="Example monitor"
isOptional={true} isOptional={true}
value={monitor?.name || ""} value={monitor?.name || ""}
@@ -348,16 +349,16 @@ const PageSpeedConfigure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Incident notifications</Typography> <Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p"> <Typography component="p">
When there is an incident, notify users. {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="p">When there is a new incident,</Typography> <Typography component="p">{t("whenNewIncident")}</Typography>
<Checkbox <Checkbox
id="notify-sms" id="notify-sms"
label="Notify via SMS (coming soon)" label={t("notifySMS")}
isChecked={false} isChecked={false}
value="" value=""
onChange={() => logger.warn("disabled")} onChange={() => logger.warn("disabled")}
@@ -376,7 +377,7 @@ const PageSpeedConfigure = () => {
/> />
<Checkbox <Checkbox
id="notify-email" id="notify-email"
label="Also notify via email to multiple addresses (coming soon)" label={t("notifyEmails")}
isChecked={false} isChecked={false}
value="" value=""
onChange={() => logger.warn("disabled")} onChange={() => logger.warn("disabled")}
@@ -394,7 +395,7 @@ const PageSpeedConfigure = () => {
onChange={() => logger.warn("disabled")} onChange={() => logger.warn("disabled")}
/> />
<Typography mt={theme.spacing(4)}> <Typography mt={theme.spacing(4)}>
You can separate multiple emails with a comma {t("seperateEmails")}
</Typography> </Typography>
</Box> </Box>
) : ( ) : (
@@ -404,12 +405,12 @@ const PageSpeedConfigure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Advanced settings</Typography> <Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(20)}> <Stack gap={theme.spacing(20)}>
<Select <Select
id="monitor-frequency" id="monitor-frequency"
label="Check frequency" label={t("checkFrequency")}
items={frequencies} items={frequencies}
value={monitor?.interval / MS_PER_MINUTE || 3} value={monitor?.interval / MS_PER_MINUTE || 3}
onChange={(event) => handleChange(event, "interval")} onChange={(event) => handleChange(event, "interval")}
@@ -429,7 +430,7 @@ const PageSpeedConfigure = () => {
onClick={handleSave} onClick={handleSave}
sx={{ px: theme.spacing(12) }} sx={{ px: theme.spacing(12) }}
> >
Save {t("settingsSave")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
@@ -438,8 +439,8 @@ const PageSpeedConfigure = () => {
<Dialog <Dialog
open={isOpen} open={isOpen}
theme={theme} theme={theme}
title={"Do you really want to delete this monitor?"} title={t("deleteDialogTitle")}
description={"Once deleted, this monitor cannot be retrieved."} description={t("deleteDialogDescription")}
onCancel={() => setIsOpen(false)} onCancel={() => setIsOpen(false)}
confirmationButtonLabel={"Delete"} confirmationButtonLabel={"Delete"}
onConfirm={handleRemove} onConfirm={handleRemove}
+16 -13
View File
@@ -10,6 +10,7 @@ import {
checkEndpointResolution, checkEndpointResolution,
} from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice"; } from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice";
import { parseDomainName } from "../../../Utils/monitorUtils"; import { parseDomainName } from "../../../Utils/monitorUtils";
import { useTranslation } from "react-i18next";
// MUI // MUI
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
@@ -173,6 +174,8 @@ const CreatePageSpeed = () => {
} }
}; };
const { t } = useTranslation();
return ( return (
<Box <Box
className="create-monitor" className="create-monitor"
@@ -200,7 +203,7 @@ const CreatePageSpeed = () => {
component="span" component="span"
fontSize="inherit" fontSize="inherit"
> >
Create your{" "} {t("createYour")}{" "}
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
@@ -208,14 +211,14 @@ const CreatePageSpeed = () => {
fontWeight="inherit" fontWeight="inherit"
color={theme.palette.primary.contrastTextSecondary} color={theme.palette.primary.contrastTextSecondary}
> >
PageSpeed monitor {t("pageSpeedMonitor")}
</Typography> </Typography>
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">General settings</Typography> <Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p"> <Typography component="p">
Here you can select the URL of the host, together with the type of monitor. {t("distributedUptimeCreateSelectURL")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
@@ -248,9 +251,9 @@ const CreatePageSpeed = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Checks to perform</Typography> <Typography component="h2">{t("distributedUptimeCreateChecks")}</Typography>
<Typography component="p"> <Typography component="p">
You can always add or remove checks after adding your site. {t("distributedUptimeCreateChecksDescription")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
@@ -269,14 +272,14 @@ const CreatePageSpeed = () => {
filled={https.toString()} filled={https.toString()}
onClick={() => setHttps(true)} onClick={() => setHttps(true)}
> >
HTTPS {t("https")}
</Button> </Button>
<Button <Button
variant="group" // Why does this work? variant="group" // Why does this work?
filled={(!https).toString()} // There's nothing in the docs about this either filled={(!https).toString()} // There's nothing in the docs about this either
onClick={() => setHttps(false)} onClick={() => setHttps(false)}
> >
HTTP {t("http")}
</Button> </Button>
</ButtonGroup> </ButtonGroup>
</Stack> </Stack>
@@ -297,13 +300,13 @@ const CreatePageSpeed = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Incident notifications</Typography> <Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p"> <Typography component="p">
When there is an incident, notify users. {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="p">When there is a new incident,</Typography> <Typography component="p">{t("whenNewIncident")}</Typography>
<Checkbox <Checkbox
id="notify-email-default" id="notify-email-default"
label={`Notify via email (to ${user.email})`} label={`Notify via email (to ${user.email})`}
@@ -317,7 +320,7 @@ const CreatePageSpeed = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Advanced settings</Typography> <Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
@@ -341,7 +344,7 @@ const CreatePageSpeed = () => {
disabled={!Object.values(errors).every((value) => value === undefined)} disabled={!Object.values(errors).every((value) => value === undefined)}
loading={isLoading} loading={isLoading}
> >
Create monitor {t("createMonitor")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
@@ -2,11 +2,12 @@ import { Box, Typography, Divider } from "@mui/material";
import Checkbox from "../../../../../Components/Inputs/Checkbox"; import Checkbox from "../../../../../Components/Inputs/Checkbox";
import MetricsIcon from "../../../../../assets/icons/ruler-icon.svg?react"; import MetricsIcon from "../../../../../assets/icons/ruler-icon.svg?react";
import LegendBox from "../../../../../Components/Charts/LegendBox"; import LegendBox from "../../../../../Components/Charts/LegendBox";
import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
const AreaChartLegend = ({ metrics, handleMetrics }) => { const AreaChartLegend = ({ metrics, handleMetrics }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
return ( return (
<LegendBox <LegendBox
icon={<MetricsIcon />} icon={<MetricsIcon />}
@@ -17,7 +18,7 @@ const AreaChartLegend = ({ metrics, handleMetrics }) => {
fontSize={11} fontSize={11}
fontWeight={500} fontWeight={500}
> >
Shown {t("shown")}
</Typography> </Typography>
<Divider sx={{ mt: theme.spacing(2) }} /> <Divider sx={{ mt: theme.spacing(2) }} />
</Box> </Box>
@@ -2,6 +2,7 @@ import StatusBoxes from "../../../../../Components/StatusBoxes";
import StatBox from "../../../../../Components/StatBox"; import StatBox from "../../../../../Components/StatBox";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import { getHumanReadableDuration } from "../../../../../Utils/timeUtils"; import { getHumanReadableDuration } from "../../../../../Utils/timeUtils";
import { useTranslation } from "react-i18next";
const PageSpeedStatusBoxes = ({ shouldRender, monitor }) => { const PageSpeedStatusBoxes = ({ shouldRender, monitor }) => {
const { time: uptimeDuration, units: uptimeUnits } = getHumanReadableDuration( const { time: uptimeDuration, units: uptimeUnits } = getHumanReadableDuration(
@@ -12,6 +13,8 @@ const PageSpeedStatusBoxes = ({ shouldRender, monitor }) => {
monitor?.lastChecked monitor?.lastChecked
); );
const { t } = useTranslation();
return ( return (
<StatusBoxes shouldRender={shouldRender}> <StatusBoxes shouldRender={shouldRender}>
<StatBox <StatBox
@@ -20,7 +23,7 @@ const PageSpeedStatusBoxes = ({ shouldRender, monitor }) => {
<> <>
{uptimeDuration} {uptimeDuration}
<Typography component="span">{uptimeUnits}</Typography> <Typography component="span">{uptimeUnits}</Typography>
<Typography component="span">ago</Typography> <Typography component="span">{t("ago")}</Typography>
</> </>
} }
/> />
@@ -30,7 +33,7 @@ const PageSpeedStatusBoxes = ({ shouldRender, monitor }) => {
<> <>
{lastCheckTime} {lastCheckTime}
<Typography component="span">{lastCheckUnits}</Typography> <Typography component="span">{lastCheckUnits}</Typography>
<Typography component="span">ago</Typography> <Typography component="span">{t("ago")}</Typography>
</> </>
} }
/> />
@@ -5,9 +5,11 @@ import { Typography } from "@mui/material";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import PieChartLegend from "../Charts/PieChartLegend"; import PieChartLegend from "../Charts/PieChartLegend";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import { useTranslation } from "react-i18next";
const PerformanceReport = ({ shouldRender, audits }) => { const PerformanceReport = ({ shouldRender, audits }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
if (!shouldRender) { if (!shouldRender) {
return <SkeletonLayout />; return <SkeletonLayout />;
@@ -25,7 +27,7 @@ const PerformanceReport = ({ shouldRender, audits }) => {
variant="body1" variant="body1"
mt="auto" mt="auto"
> >
Values are estimated and may vary.{" "} {t("pageSpeedDetailsPerformanceReport")}{" "}
<Typography <Typography
component="span" component="span"
fontSize="inherit" fontSize="inherit"
@@ -41,7 +43,7 @@ const PerformanceReport = ({ shouldRender, audits }) => {
}, },
}} }}
> >
See calculator {t("pageSpeedDetailsPerformanceReportCalculator")}
</Typography> </Typography>
</Typography> </Typography>
</ChartBox> </ChartBox>
+5 -3
View File
@@ -14,6 +14,7 @@ import { useParams } from "react-router-dom";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { useMonitorFetch } from "./Hooks/useMonitorFetch"; import { useMonitorFetch } from "./Hooks/useMonitorFetch";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next";
// Constants // Constants
const BREADCRUMBS = [ const BREADCRUMBS = [
{ name: "pagespeed", path: "/pagespeed" }, { name: "pagespeed", path: "/pagespeed" },
@@ -23,6 +24,7 @@ const BREADCRUMBS = [
const PageSpeedDetails = () => { const PageSpeedDetails = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const isAdmin = useIsAdmin(); const isAdmin = useIsAdmin();
const { monitorId } = useParams(); const { monitorId } = useParams();
@@ -50,9 +52,9 @@ const PageSpeedDetails = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
@@ -68,7 +70,7 @@ const PageSpeedDetails = () => {
monitor={monitor} monitor={monitor}
/> />
<GenericFallback> <GenericFallback>
<Typography>There is no check history for this monitor yet.</Typography> <Typography>{t("distributedUptimeDetailsNoMonitorHistory")}</Typography>
</GenericFallback> </GenericFallback>
</Stack> </Stack>
); );
@@ -10,6 +10,7 @@ import { useSelector } from "react-redux";
import { formatDateWithTz, formatDurationSplit } from "../../../../../Utils/timeUtils"; import { formatDateWithTz, formatDurationSplit } from "../../../../../Utils/timeUtils";
import useUtils from "../../../../Uptime/Monitors/Hooks/useUtils"; import useUtils from "../../../../Uptime/Monitors/Hooks/useUtils";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next";
import IconBox from "../../../../../Components/IconBox"; import IconBox from "../../../../../Components/IconBox";
/** /**
* CustomToolTip displays a tooltip with formatted date and score information. * CustomToolTip displays a tooltip with formatted date and score information.
@@ -207,6 +208,7 @@ PagespeedAreaChart.propTypes = {
const Card = ({ monitor }) => { const Card = ({ monitor }) => {
const { determineState, pagespeedStatusMsg } = useUtils(); const { determineState, pagespeedStatusMsg } = useUtils();
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const navigate = useNavigate(); const navigate = useNavigate();
const monitorState = determineState(monitor); const monitorState = determineState(monitor);
@@ -297,7 +299,7 @@ const Card = ({ monitor }) => {
fontSize={11} fontSize={11}
color={theme.palette.primary.contrastTextSecondary} color={theme.palette.primary.contrastTextSecondary}
> >
Checking every{" "} {t("checkingEvery")}{" "}
{(() => { {(() => {
const { time, format } = formatDurationSplit(monitor?.interval); const { time, format } = formatDurationSplit(monitor?.interval);
return ( return (
+4 -3
View File
@@ -12,12 +12,13 @@ import { useSelector } from "react-redux";
import { useIsAdmin } from "../../../Hooks/useIsAdmin"; import { useIsAdmin } from "../../../Hooks/useIsAdmin";
import useMonitorsFetch from "./Hooks/useMonitorsFetch"; import useMonitorsFetch from "./Hooks/useMonitorsFetch";
import GenericFallback from "../../../Components/GenericFallback"; import GenericFallback from "../../../Components/GenericFallback";
import { useTranslation } from "react-i18next";
// Constants // Constants
const BREADCRUMBS = [{ name: `pagespeed`, path: "/pagespeed" }]; const BREADCRUMBS = [{ name: `pagespeed`, path: "/pagespeed" }];
const PageSpeed = () => { const PageSpeed = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const isAdmin = useIsAdmin(); const isAdmin = useIsAdmin();
const { user } = useSelector((state) => state.auth); const { user } = useSelector((state) => state.auth);
@@ -33,9 +34,9 @@ const PageSpeed = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
@@ -1,9 +1,10 @@
import { Button, Box } from "@mui/material"; import { Button, Box } from "@mui/material";
import ProgressUpload from "../../../../../Components/ProgressBars"; import ProgressUpload from "../../../../../Components/ProgressBars";
import ImageIcon from "@mui/icons-material/Image"; import ImageIcon from "@mui/icons-material/Image";
import { useTranslation } from "react-i18next";
import { formatBytes } from "../../../../../Utils/fileUtils"; import { formatBytes } from "../../../../../Utils/fileUtils";
const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo, errors }) => { const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo, errors }) => {
const { t } = useTranslation();
if (isLoading) { if (isLoading) {
return ( return (
<ProgressUpload <ProgressUpload
@@ -27,7 +28,7 @@ const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo, errors
color="secondary" color="secondary"
onClick={removeLogo} onClick={removeLogo}
> >
Remove Logo {t("removeLogo")}
</Button> </Button>
</Box> </Box>
); );
@@ -7,6 +7,7 @@ import Checkbox from "../../../../../Components/Inputs/Checkbox";
// Utils // Utils
import { useState } from "react"; import { useState } from "react";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import ConfigStack from "./ConfigStack"; import ConfigStack from "./ConfigStack";
const Content = ({ const Content = ({
tabValue, tabValue,
@@ -30,13 +31,14 @@ const Content = ({
// Utils // Utils
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
return ( return (
<TabPanel value={tabValue}> <TabPanel value={tabValue}>
<Stack gap={theme.spacing(10)}> <Stack gap={theme.spacing(10)}>
<ConfigStack <ConfigStack
title="Status page servers" title={t("statusPageCreateTabsContent")}
description="You can add any number of servers that you monitor to your status page. You can also reorder them for the best viewing experience." description={t("statusPageCreateTabsContentDescription")}
> >
<Stack> <Stack>
<Stack <Stack
@@ -70,21 +72,21 @@ const Content = ({
</Stack> </Stack>
</ConfigStack> </ConfigStack>
<ConfigStack <ConfigStack
title="Features" title={t("features")}
description="Show more details on the status page" description={t("statusPageCreateTabsContentFeaturesDescription")}
> >
<Stack> <Stack>
<Checkbox <Checkbox
id="showCharts" id="showCharts"
name="showCharts" name="showCharts"
label={`Show charts`} label={t("showCharts")}
isChecked={form.showCharts} isChecked={form.showCharts}
onChange={handleFormChange} onChange={handleFormChange}
/> />
<Checkbox <Checkbox
id="showUptimePercentage" id="showUptimePercentage"
name="showUptimePercentage" name="showUptimePercentage"
label={`Show uptime percentage`} label={t("showUptimePercentage")}
isChecked={form.showUptimePercentage} isChecked={form.showUptimePercentage}
onChange={handleFormChange} onChange={handleFormChange}
/> />
@@ -13,6 +13,7 @@ import Progress from "../Progress";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import timezones from "../../../../../Utils/timezones.json"; import timezones from "../../../../../Utils/timezones.json";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
const TabSettings = ({ const TabSettings = ({
isCreate, isCreate,
@@ -26,22 +27,23 @@ const TabSettings = ({
}) => { }) => {
// Utils // Utils
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
return ( return (
<TabPanel value={tabValue}> <TabPanel value={tabValue}>
<Stack gap={theme.spacing(10)}> <Stack gap={theme.spacing(10)}>
<ConfigBox> <ConfigBox>
<Stack> <Stack>
<Typography component="h2">Access</Typography> <Typography component="h2">{t("access")}</Typography>
<Typography component="p"> <Typography component="p">
If your status page is ready, you can mark it as published. {t("statusPageCreateSettings")}
</Typography> </Typography>
</Stack> </Stack>
<Stack gap={theme.spacing(18)}> <Stack gap={theme.spacing(18)}>
<Checkbox <Checkbox
id="publish" id="publish"
name="isPublished" name="isPublished"
label={`Published and visible to the public`} label={t("statusPageCreateSettingsCheckboxLabel")}
isChecked={form.isPublished} isChecked={form.isPublished}
onChange={handleFormChange} onChange={handleFormChange}
/> />
@@ -49,9 +51,9 @@ const TabSettings = ({
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2">Basic Information</Typography> <Typography component="h2">{t("basicInformation")}</Typography>
<Typography component="p"> <Typography component="p">
Define company name and the subdomain that your status page points to. {t("statusPageCreateBasicInfoDescription")}
</Typography> </Typography>
</Stack> </Stack>
<Stack gap={theme.spacing(18)}> <Stack gap={theme.spacing(18)}>
@@ -59,7 +61,7 @@ const TabSettings = ({
id="companyName" id="companyName"
name="companyName" name="companyName"
type="text" type="text"
label="Company name" label={t("companyName")}
value={form.companyName} value={form.companyName}
onChange={handleFormChange} onChange={handleFormChange}
helperText={errors["companyName"]} helperText={errors["companyName"]}
@@ -70,7 +72,7 @@ const TabSettings = ({
name="url" name="url"
type="url" type="url"
disabled={!isCreate} disabled={!isCreate}
label="Your status page address" label={t("statusPageCreateBasicInfoStatusPageAddress")}
value={form.url} value={form.url}
onChange={handleFormChange} onChange={handleFormChange}
helperText={errors["url"]} helperText={errors["url"]}
@@ -80,16 +82,16 @@ const TabSettings = ({
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2">Timezone</Typography> <Typography component="h2">{t("timezone")}</Typography>
<Typography component="p"> <Typography component="p">
Select the timezone that your status page will be displayed in. {t("statusPageCreateSelectTimeZoneDescription")}
</Typography> </Typography>
</Stack> </Stack>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Select <Select
id="timezone" id="timezone"
name="timezone" name="timezone"
label="Display timezone" label={t("settingsDisplayTimezone")}
items={timezones} items={timezones}
value={form.timezone} value={form.timezone}
onChange={handleFormChange} onChange={handleFormChange}
@@ -98,9 +100,9 @@ const TabSettings = ({
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2">Appearance</Typography> <Typography component="h2">{t("settingsAppearance")}</Typography>
<Typography component="p"> <Typography component="p">
Define the default look and feel of your public status page. {t("statusPageCreateAppearanceDescription")}
</Typography> </Typography>
</Stack> </Stack>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
+5 -4
View File
@@ -14,7 +14,7 @@ import { createToast } from "../../../Utils/toastUtils";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useStatusPageFetch } from "../Status/Hooks/useStatusPageFetch"; import { useStatusPageFetch } from "../Status/Hooks/useStatusPageFetch";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useTranslation } from "react-i18next";
//Constants //Constants
const TAB_LIST = ["General settings", "Contents"]; const TAB_LIST = ["General settings", "Contents"];
@@ -54,6 +54,7 @@ const CreateStatusPage = () => {
const [createStatusPage, createStatusIsLoading, createStatusPageNetworkError] = const [createStatusPage, createStatusIsLoading, createStatusPageNetworkError] =
useCreateStatusPage(isCreate); useCreateStatusPage(isCreate);
const navigate = useNavigate(); const navigate = useNavigate();
const { t } = useTranslation();
const [statusPage, statusPageMonitors, statusPageIsLoading, statusPageNetworkError] = const [statusPage, statusPageMonitors, statusPageIsLoading, statusPageNetworkError] =
useStatusPageFetch(isCreate, url); useStatusPageFetch(isCreate, url);
@@ -205,9 +206,9 @@ const CreateStatusPage = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
@@ -241,7 +242,7 @@ const CreateStatusPage = () => {
color="accent" color="accent"
onClick={handleSubmit} onClick={handleSubmit}
> >
Save {t("settingsSave")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
@@ -4,9 +4,11 @@ import { Box, Typography } from "@mui/material";
// Utils // Utils
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
const AdminLink = () => { const AdminLink = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const navigate = useNavigate(); const navigate = useNavigate();
return ( return (
@@ -16,7 +18,7 @@ const AdminLink = () => {
display="inline-block" display="inline-block"
color={theme.palette.primary.contrastText} color={theme.palette.primary.contrastText}
> >
Administrator? {t("administrator")}
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
@@ -25,7 +27,7 @@ const AdminLink = () => {
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
onClick={() => navigate("/login")} onClick={() => navigate("/login")}
> >
Login here {t("loginHere")}
</Typography> </Typography>
</Box> </Box>
); );
@@ -8,9 +8,11 @@ import { useTheme } from "@mui/material/styles";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting, url, type }) => { const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting, url, type }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const location = useLocation(); const location = useLocation();
const currentPath = location.pathname; const currentPath = location.pathname;
const navigate = useNavigate(); const navigate = useNavigate();
@@ -35,7 +37,7 @@ const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting, url, type }) => {
onClick={() => setIsDeleteOpen(!isDeleteOpen)} onClick={() => setIsDeleteOpen(!isDeleteOpen)}
loading={isDeleting} loading={isDeleting}
> >
Delete {t("delete")}
</Button> </Button>
</Box> </Box>
<Box> <Box>
@@ -59,7 +61,7 @@ const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting, url, type }) => {
}, },
}} }}
> >
<SettingsIcon /> Configure <SettingsIcon /> {t("configure")}
</Button> </Button>
</Box> </Box>
</Stack> </Stack>
+14 -12
View File
@@ -17,6 +17,7 @@ import { useStatusPageDelete } from "./Hooks/useStatusPageDelete";
import { useState } from "react"; import { useState } from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
const PublicStatus = () => { const PublicStatus = () => {
const { url } = useParams(); const { url } = useParams();
@@ -24,6 +25,7 @@ const PublicStatus = () => {
const [isDeleteOpen, setIsDeleteOpen] = useState(false); const [isDeleteOpen, setIsDeleteOpen] = useState(false);
// Utils // Utils
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const location = useLocation(); const location = useLocation();
const navigate = useNavigate(); const navigate = useNavigate();
@@ -59,9 +61,9 @@ const PublicStatus = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
@@ -76,9 +78,9 @@ const PublicStatus = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
A public status page is not set up. {t("statusPageStatus")}
</Typography> </Typography>
<Typography>Please contact to your administrator</Typography> <Typography>{t("statusPageStatusContactAdmin")}</Typography>
</GenericFallback> </GenericFallback>
</Stack> </Stack>
); );
@@ -94,9 +96,9 @@ const PublicStatus = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
This status page is not public. {t("statusPageStatusNotPublic")}
</Typography> </Typography>
<Typography>Please contact to your administrator</Typography> <Typography>{t("statusPageStatusContactAdmin")}</Typography>
</GenericFallback> </GenericFallback>
</Stack> </Stack>
); );
@@ -111,9 +113,9 @@ const PublicStatus = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
There's no status page here. {t("statusPageStatusNoPage")}
</Typography> </Typography>
<Typography>Please contact to your administrator</Typography> <Typography>{t("statusPageStatusContactAdmin")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
@@ -131,12 +133,12 @@ const PublicStatus = () => {
setIsDeleteOpen={setIsDeleteOpen} setIsDeleteOpen={setIsDeleteOpen}
url={url} url={url}
/> />
<Typography variant="h2">Service status</Typography> <Typography variant="h2">{t("statusPageStatusServiceStatus")}</Typography>
<StatusBar monitors={monitors} /> <StatusBar monitors={monitors} />
<MonitorsList monitors={monitors} /> <MonitorsList monitors={monitors} />
{link} {link}
<Dialog <Dialog
title="Do you want to delete this status page?" title={t("deleteStatusPage")}
onConfirm={() => { onConfirm={() => {
deleteStatusPage(); deleteStatusPage();
setIsDeleteOpen(false); setIsDeleteOpen(false);
@@ -146,8 +148,8 @@ const PublicStatus = () => {
setIsDeleteOpen(false); setIsDeleteOpen(false);
}} }}
open={isDeleteOpen} open={isDeleteOpen}
confirmationButtonLabel="Yes, delete status page" confirmationButtonLabel={t("deleteStatusPageConfirm")}
description="Once deleted, your status page cannot be retrieved." description={t("deleteStatusPageDescription")}
isLoading={isDeleting || isLoading} isLoading={isDeleting || isLoading}
/> />
</Stack> </Stack>
@@ -4,20 +4,22 @@ import { useNavigate } from "react-router-dom";
import { StatusLabel } from "../../../../../Components/Label"; import { StatusLabel } from "../../../../../Components/Label";
import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward"; import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward";
import { Stack, Typography } from "@mui/material"; import { Stack, Typography } from "@mui/material";
import { useTranslation } from "react-i18next";
const StatusPagesTable = ({ data }) => { const StatusPagesTable = ({ data }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const navigate = useNavigate(); const navigate = useNavigate();
const headers = [ const headers = [
{ {
id: "name", id: "name",
content: "Status page name", content: t("statusPageName"),
render: (row) => { render: (row) => {
return row.companyName; return row.companyName;
}, },
}, },
{ {
id: "url", id: "url",
content: "Public URL", content: t("publicURL"),
onClick: (e, row) => { onClick: (e, row) => {
if (row.isPublished) { if (row.isPublished) {
e.stopPropagation(); e.stopPropagation();
@@ -57,14 +59,14 @@ const StatusPagesTable = ({ data }) => {
}, },
{ {
id: "type", id: "type",
content: "Type", content: t("type"),
render: (row) => { render: (row) => {
return row.type; return row.type;
}, },
}, },
{ {
id: "status", id: "status",
content: "Status", content: t("status"),
render: (row) => { render: (row) => {
const status = row.isPublished ? "published" : "unpublished"; const status = row.isPublished ? "published" : "unpublished";
return ( return (
+4 -2
View File
@@ -8,6 +8,7 @@ import StatusPagesTable from "./Components/StatusPagesTable";
import SkeletonLayout from "../../../Components/Skeletons/FullPage"; import SkeletonLayout from "../../../Components/Skeletons/FullPage";
// Utils // Utils
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch"; import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
import { useIsAdmin } from "../../../Hooks/useIsAdmin"; import { useIsAdmin } from "../../../Hooks/useIsAdmin";
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }]; const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
@@ -15,6 +16,7 @@ const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
const StatusPages = () => { const StatusPages = () => {
// Utils // Utils
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const isAdmin = useIsAdmin(); const isAdmin = useIsAdmin();
const [isLoading, networkError, statusPages] = useStatusPagesFetch(); const [isLoading, networkError, statusPages] = useStatusPagesFetch();
@@ -30,9 +32,9 @@ const StatusPages = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
+22 -23
View File
@@ -6,6 +6,7 @@ import { Box, Stack, Tooltip, Typography, Button } from "@mui/material";
import { monitorValidation } from "../../../Validation/validation"; import { monitorValidation } from "../../../Validation/validation";
import { createToast } from "../../../Utils/toastUtils"; import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger"; import { logger } from "../../../Utils/Logger";
import { useTranslation } from "react-i18next";
import ConfigBox from "../../../Components/ConfigBox"; import ConfigBox from "../../../Components/ConfigBox";
import { import {
updateUptimeMonitor, updateUptimeMonitor,
@@ -207,6 +208,8 @@ const Configure = () => {
undefined: "Pending...", undefined: "Pending...",
}; };
const { t } = useTranslation();
return ( return (
<Stack <Stack
className="configure-monitor" className="configure-monitor"
@@ -293,7 +296,7 @@ const Configure = () => {
}, },
}} }}
> >
Editing... {t("editing")}
</Typography> </Typography>
</Stack> </Stack>
</Box> </Box>
@@ -326,12 +329,12 @@ const Configure = () => {
{monitor?.isActive ? ( {monitor?.isActive ? (
<> <>
<PauseIcon /> <PauseIcon />
Pause {t("pause")}
</> </>
) : ( ) : (
<> <>
<ResumeIcon /> <ResumeIcon />
Resume {t("resume")}
</> </>
)} )}
</Button> </Button>
@@ -342,16 +345,15 @@ const Configure = () => {
sx={{ px: theme.spacing(8) }} sx={{ px: theme.spacing(8) }}
onClick={() => setIsOpen(true)} onClick={() => setIsOpen(true)}
> >
Remove {t("remove")}
</Button> </Button>
</Box> </Box>
</Stack> </Stack>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">General settings</Typography> <Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p"> <Typography component="p">
Here you can select the URL of the host, together with the type of {t("distributedUptimeCreateSelectURL")}
monitor.
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(20)}> <Stack gap={theme.spacing(20)}>
@@ -364,7 +366,7 @@ const Configure = () => {
) )
} }
id="monitor-url" id="monitor-url"
label="URL to monitor" label={t("urlMonitor")}
placeholder="google.com" placeholder="google.com"
value={parsedUrl?.host || monitor?.url || ""} value={parsedUrl?.host || monitor?.url || ""}
disabled={true} disabled={true}
@@ -372,7 +374,7 @@ const Configure = () => {
<TextInput <TextInput
type="text" type="text"
id="monitor-name" id="monitor-name"
label="Display name" label={t("displayName")}
isOptional={true} isOptional={true}
placeholder="Google" placeholder="Google"
value={monitor?.name || ""} value={monitor?.name || ""}
@@ -384,13 +386,13 @@ const Configure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Incident notifications</Typography> <Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p"> <Typography component="p">
When there is an incident, notify users. {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="p">When there is a new incident,</Typography> <Typography component="p">{t("whenNewIncident")}</Typography>
{/* {Leaving components commented for future funtionality implimentation} */} {/* {Leaving components commented for future funtionality implimentation} */}
{/* <Checkbox {/* <Checkbox
id="notify-sms" id="notify-sms"
@@ -441,12 +443,12 @@ const Configure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Advanced settings</Typography> <Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(20)}> <Stack gap={theme.spacing(20)}>
<Select <Select
id="monitor-interval-configure" id="monitor-interval-configure"
label="Check frequency" label={t("checkFrequency")}
value={monitor?.interval / MS_PER_MINUTE || 1} value={monitor?.interval / MS_PER_MINUTE || 1}
onChange={(event) => handleChange(event, "interval")} onChange={(event) => handleChange(event, "interval")}
items={frequencies} items={frequencies}
@@ -455,7 +457,7 @@ const Configure = () => {
<> <>
<Select <Select
id="match-method" id="match-method"
label="Match Method" label={t("matchMethod")}
value={monitor.matchMethod || "equal"} value={monitor.matchMethod || "equal"}
onChange={(event) => handleChange(event, "matchMethod")} onChange={(event) => handleChange(event, "matchMethod")}
items={matchMethodOptions} items={matchMethodOptions}
@@ -464,7 +466,7 @@ const Configure = () => {
<TextInput <TextInput
type="text" type="text"
id="expected-value" id="expected-value"
label="Expected value" label={t("expectedValue")}
isOptional={true} isOptional={true}
placeholder={ placeholder={
expectedValuePlaceholders[monitor.matchMethod || "equal"] expectedValuePlaceholders[monitor.matchMethod || "equal"]
@@ -479,8 +481,7 @@ const Configure = () => {
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
opacity={0.8} opacity={0.8}
> >
The expected value is used to match against response result, and {t("uptimeCreate")}
the match determines the status.
</Typography> </Typography>
</Stack> </Stack>
<Stack> <Stack>
@@ -500,9 +501,7 @@ const Configure = () => {
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
opacity={0.8} opacity={0.8}
> >
This expression will be evaluated against the reponse JSON data {t("uptimeCreateJsonPath")}&nbsp;
and the result will be used to match against the expected value.
See&nbsp;
<Typography <Typography
component="a" component="a"
href="https://jmespath.org/" href="https://jmespath.org/"
@@ -511,7 +510,7 @@ const Configure = () => {
> >
jmespath.org jmespath.org
</Typography> </Typography>
&nbsp;for query language documentation. &nbsp;{t("uptimeCreateJsonPathQuery")}
</Typography> </Typography>
</Stack> </Stack>
</> </>
@@ -530,7 +529,7 @@ const Configure = () => {
sx={{ px: theme.spacing(12) }} sx={{ px: theme.spacing(12) }}
onClick={handleSubmit} onClick={handleSubmit}
> >
Save {t("settingsSave")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
+28 -28
View File
@@ -10,7 +10,7 @@ import { checkEndpointResolution } from "../../../Features/UptimeMonitors/uptime
import { monitorValidation } from "../../../Validation/validation"; import { monitorValidation } from "../../../Validation/validation";
import { getUptimeMonitorById } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; import { getUptimeMonitorById } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
import { useTranslation } from "react-i18next";
// MUI // MUI
import { Box, Stack, Typography, Button, ButtonGroup } from "@mui/material"; import { Box, Stack, Typography, Button, ButtonGroup } from "@mui/material";
@@ -240,6 +240,8 @@ const CreateMonitor = () => {
fetchMonitor(); fetchMonitor();
}, [monitorId, dispatch, navigate]); }, [monitorId, dispatch, navigate]);
const { t } = useTranslation();
return ( return (
<Box className="create-monitor"> <Box className="create-monitor">
<Breadcrumbs list={crumbs} /> <Breadcrumbs list={crumbs} />
@@ -257,7 +259,7 @@ const CreateMonitor = () => {
component="span" component="span"
fontSize="inherit" fontSize="inherit"
> >
Create your{" "} {t("createYour")}{" "}
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
@@ -265,22 +267,22 @@ const CreateMonitor = () => {
fontSize="inherit" fontSize="inherit"
fontWeight="inherit" fontWeight="inherit"
> >
monitor {t("monitor")}
</Typography> </Typography>
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Checks to perform</Typography> <Typography component="h2">{t("distributedUptimeCreateChecks")}</Typography>
<Typography component="p"> <Typography component="p">
You can always add or remove checks after adding your site. {t("distributedUptimeCreateChecksDescription")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Radio <Radio
id="monitor-checks-http" id="monitor-checks-http"
title="Website monitoring" title={t("websiteMonitoring")}
desc="Use HTTP(s) to monitor your website or API endpoint." desc={t("websiteMonitoringDescription")}
size="small" size="small"
value="http" value="http"
checked={monitor.type === "http"} checked={monitor.type === "http"}
@@ -293,14 +295,14 @@ const CreateMonitor = () => {
filled={https.toString()} filled={https.toString()}
onClick={() => setHttps(true)} onClick={() => setHttps(true)}
> >
HTTPS {t("https")}
</Button> </Button>
<Button <Button
variant="group" variant="group"
filled={(!https).toString()} filled={(!https).toString()}
onClick={() => setHttps(false)} onClick={() => setHttps(false)}
> >
HTTP {t("http")}
</Button> </Button>
</ButtonGroup> </ButtonGroup>
) : ( ) : (
@@ -309,8 +311,8 @@ const CreateMonitor = () => {
</Stack> </Stack>
<Radio <Radio
id="monitor-checks-ping" id="monitor-checks-ping"
title="Ping monitoring" title={t("pingMonitoring")}
desc="Check whether your server is available or not." desc={t("pingMonitoringDescription")}
size="small" size="small"
value="ping" value="ping"
checked={monitor.type === "ping"} checked={monitor.type === "ping"}
@@ -318,8 +320,8 @@ const CreateMonitor = () => {
/> />
<Radio <Radio
id="monitor-checks-docker" id="monitor-checks-docker"
title="Docker container monitoring" title={t("dockerContainerMonitoring")}
desc="Check whether your container is running or not." desc={t("dockerContainerMonitoringDescription")}
size="small" size="small"
value="docker" value="docker"
checked={monitor.type === "docker"} checked={monitor.type === "docker"}
@@ -327,8 +329,8 @@ const CreateMonitor = () => {
/> />
<Radio <Radio
id="monitor-checks-port" id="monitor-checks-port"
title="Port monitoring" title={t("portMonitoring")}
desc="Check whether your port is open or not." desc={t("portMonitoringDescription")}
size="small" size="small"
value="port" value="port"
checked={monitor.type === "port"} checked={monitor.type === "port"}
@@ -351,9 +353,9 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">General settings</Typography> <Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p"> <Typography component="p">
Here you can select the URL of the host, together with the type of monitor. {t("distributedUptimeCreateSelectURL")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
@@ -374,7 +376,7 @@ const CreateMonitor = () => {
<TextInput <TextInput
type="number" type="number"
id="monitor-port" id="monitor-port"
label="Port to monitor" label={t("portToMonitor")}
placeholder="5173" placeholder="5173"
value={monitor.port} value={monitor.port}
onChange={(event) => handleChange(event, "port")} onChange={(event) => handleChange(event, "port")}
@@ -385,7 +387,7 @@ const CreateMonitor = () => {
<TextInput <TextInput
type="text" type="text"
id="monitor-name" id="monitor-name"
label="Display name" label={t("displayName")}
isOptional={true} isOptional={true}
placeholder={monitorTypeMaps[monitor.type].namePlaceholder || ""} placeholder={monitorTypeMaps[monitor.type].namePlaceholder || ""}
value={monitor.name} value={monitor.name}
@@ -397,9 +399,9 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Incident notifications</Typography> <Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p"> <Typography component="p">
When there is an incident, notify users. {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
</Box> </Box>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
@@ -427,7 +429,7 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">Advanced settings</Typography> <Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
@@ -465,8 +467,7 @@ const CreateMonitor = () => {
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
opacity={0.8} opacity={0.8}
> >
The expected value is used to match against response result, and the {t("uptimeCreate")}
match determines the status.
</Typography> </Typography>
</Stack> </Stack>
<Stack> <Stack>
@@ -486,8 +487,7 @@ const CreateMonitor = () => {
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
opacity={0.8} opacity={0.8}
> >
This expression will be evaluated against the reponse JSON data and {t("uptimeCreateJsonPath")}&nbsp;
the result will be used to match against the expected value. See&nbsp;
<Typography <Typography
component="a" component="a"
href="https://jmespath.org/" href="https://jmespath.org/"
@@ -496,7 +496,7 @@ const CreateMonitor = () => {
> >
jmespath.org jmespath.org
</Typography> </Typography>
&nbsp;for query language documentation. &nbsp;{t("uptimeCreateJsonPathQuery")}
</Typography> </Typography>
</Stack> </Stack>
</> </>
@@ -514,7 +514,7 @@ const CreateMonitor = () => {
disabled={!Object.values(errors).every((value) => value === undefined)} disabled={!Object.values(errors).every((value) => value === undefined)}
loading={isLoading} loading={isLoading}
> >
Create monitor {t("createMonitor")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
@@ -1,10 +1,11 @@
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTheme } from "@mui/material"; import { useTheme } from "@mui/material";
import { ResponsiveContainer, RadialBarChart, RadialBar, Cell } from "recharts"; import { ResponsiveContainer, RadialBarChart, RadialBar, Cell } from "recharts";
import { useTranslation } from "react-i18next";
const ResponseGaugeChart = ({ avgResponseTime }) => { const ResponseGaugeChart = ({ avgResponseTime }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
let max = 1000; // max ms let max = 1000; // max ms
const data = [ const data = [
@@ -61,7 +62,7 @@ const ResponseGaugeChart = ({ avgResponseTime }) => {
textAnchor="start" textAnchor="start"
fontSize={11} fontSize={11}
> >
low {t("low")}
</text> </text>
<text <text
x="100%" x="100%"
@@ -71,7 +72,7 @@ const ResponseGaugeChart = ({ avgResponseTime }) => {
textAnchor="end" textAnchor="end"
fontSize={11} fontSize={11}
> >
high {t("high")}
</text> </text>
<text <text
x="50%" x="50%"
@@ -4,6 +4,7 @@ import HistoryIcon from "../../../../../assets/icons/history-icon.svg?react";
import Table from "../../../../../Components/Table"; import Table from "../../../../../Components/Table";
import TablePagination from "../../../../../Components/Table/TablePagination"; import TablePagination from "../../../../../Components/Table/TablePagination";
import { StatusLabel } from "../../../../../Components/Label"; import { StatusLabel } from "../../../../../Components/Label";
import { useTranslation } from "react-i18next";
import { formatDateWithTz } from "../../../../../Utils/timeUtils"; import { formatDateWithTz } from "../../../../../Utils/timeUtils";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
const ResponseTable = ({ const ResponseTable = ({
@@ -16,6 +17,7 @@ const ResponseTable = ({
rowsPerPage, rowsPerPage,
setRowsPerPage, setRowsPerPage,
}) => { }) => {
const { t } = useTranslation();
if (!shouldRender) { if (!shouldRender) {
return <SkeletonLayout />; return <SkeletonLayout />;
} }
@@ -23,7 +25,7 @@ const ResponseTable = ({
const headers = [ const headers = [
{ {
id: "status", id: "status",
content: "Status", content: t("status"),
render: (row) => { render: (row) => {
const status = row.status === true ? "up" : "down"; const status = row.status === true ? "up" : "down";
@@ -38,18 +40,18 @@ const ResponseTable = ({
}, },
{ {
id: "date", id: "date",
content: "Date & Time", content: t("date&Time"),
render: (row) => render: (row) =>
formatDateWithTz(row.createdAt, "ddd, MMMM D, YYYY, HH:mm A", uiTimezone), formatDateWithTz(row.createdAt, "ddd, MMMM D, YYYY, HH:mm A", uiTimezone),
}, },
{ {
id: "statusCode", id: "statusCode",
content: "Status code", content: t("statusCode"),
render: (row) => (row.statusCode ? row.statusCode : "N/A"), render: (row) => (row.statusCode ? row.statusCode : "N/A"),
}, },
{ {
id: "message", id: "message",
content: "Message", content: t("message"),
render: (row) => row.message, render: (row) => row.message,
}, },
]; ];
+5 -3
View File
@@ -19,6 +19,7 @@ import { useIsAdmin } from "../../../Hooks/useIsAdmin";
import useMonitorFetch from "./Hooks/useMonitorFetch"; import useMonitorFetch from "./Hooks/useMonitorFetch";
import useCertificateFetch from "./Hooks/useCertificateFetch"; import useCertificateFetch from "./Hooks/useCertificateFetch";
import useChecksFetch from "./Hooks/useChecksFetch"; import useChecksFetch from "./Hooks/useChecksFetch";
import { useTranslation } from "react-i18next";
// Constants // Constants
const BREADCRUMBS = [ const BREADCRUMBS = [
@@ -46,6 +47,7 @@ const UptimeDetails = () => {
const { monitorId } = useParams(); const { monitorId } = useParams();
const theme = useTheme(); const theme = useTheme();
const isAdmin = useIsAdmin(); const isAdmin = useIsAdmin();
const { t } = useTranslation();
const [monitor, monitorIsLoading, monitorNetworkError] = useMonitorFetch({ const [monitor, monitorIsLoading, monitorNetworkError] = useMonitorFetch({
monitorId, monitorId,
@@ -86,9 +88,9 @@ const UptimeDetails = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
@@ -105,7 +107,7 @@ const UptimeDetails = () => {
monitor={monitor} monitor={monitor}
/> />
<GenericFallback> <GenericFallback>
<Typography>There is no check history for this monitor yet.</Typography> <Typography>{t("distributedUptimeDetailsNoMonitorHistory")}</Typography>
</GenericFallback> </GenericFallback>
</Stack> </Stack>
); );
@@ -16,6 +16,7 @@ import { useTheme } from "@emotion/react";
import useUtils from "../../Hooks/useUtils"; import useUtils from "../../Hooks/useUtils";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
/** /**
* UptimeDataTable displays a table of uptime monitors with sorting, searching, and action capabilities * UptimeDataTable displays a table of uptime monitors with sorting, searching, and action capabilities
@@ -59,6 +60,7 @@ const UptimeDataTable = ({
const navigate = useNavigate(); const navigate = useNavigate();
const { determineState } = useUtils(); const { determineState } = useUtils();
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
// Local state // Local state
// Handlers // Handlers
@@ -82,7 +84,7 @@ const UptimeDataTable = ({
direction="row" direction="row"
onClick={() => handleSort("name")} onClick={() => handleSort("name")}
> >
Host {t("host")}
<Stack <Stack
justifyContent="center" justifyContent="center"
style={{ style={{
@@ -118,7 +120,7 @@ const UptimeDataTable = ({
onClick={() => handleSort("status")} onClick={() => handleSort("status")}
> >
{" "} {" "}
Status {t("status")}
<Stack <Stack
justifyContent="center" justifyContent="center"
style={{ style={{
@@ -146,12 +148,12 @@ const UptimeDataTable = ({
}, },
{ {
id: "responseTime", id: "responseTime",
content: "Response Time", content: t("responseTime"),
render: (row) => <BarChart checks={row.monitor.checks.slice().reverse()} />, render: (row) => <BarChart checks={row.monitor.checks.slice().reverse()} />,
}, },
{ {
id: "type", id: "type",
content: "Type", content: t("type"),
render: (row) => ( render: (row) => (
<span style={{ textTransform: "uppercase" }}> <span style={{ textTransform: "uppercase" }}>
{row.monitor.type === "http" ? "HTTP(s)" : row.monitor.type} {row.monitor.type === "http" ? "HTTP(s)" : row.monitor.type}
@@ -160,7 +162,7 @@ const UptimeDataTable = ({
}, },
{ {
id: "actions", id: "actions",
content: "Actions", content: t("actions"),
render: (row) => ( render: (row) => (
<ActionsMenu <ActionsMenu
monitor={row.monitor} monitor={row.monitor}
+4 -2
View File
@@ -30,6 +30,7 @@ import { setRowsPerPage } from "../../../Features/UI/uiSlice";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import useFetchMonitorsWithSummary from "../../../Hooks/useFetchMonitorsWithSummary"; import useFetchMonitorsWithSummary from "../../../Hooks/useFetchMonitorsWithSummary";
import useFetchMonitorsWithChecks from "../../../Hooks/useFetchMonitorsWithChecks"; import useFetchMonitorsWithChecks from "../../../Hooks/useFetchMonitorsWithChecks";
import { useTranslation } from "react-i18next";
const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }]; const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }];
const TYPES = ["http", "ping", "docker", "port"]; const TYPES = ["http", "ping", "docker", "port"];
@@ -75,6 +76,7 @@ const UptimeMonitors = () => {
const theme = useTheme(); const theme = useTheme();
const isAdmin = useIsAdmin(); const isAdmin = useIsAdmin();
const dispatch = useDispatch(); const dispatch = useDispatch();
const { t } = useTranslation();
// Handlers // Handlers
const handleChangePage = (event, newPage) => { const handleChangePage = (event, newPage) => {
@@ -130,9 +132,9 @@ const UptimeMonitors = () => {
marginY={theme.spacing(4)} marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
Network error {t("networkError")}
</Typography> </Typography>
<Typography>Please check your connection</Typography> <Typography>{t("checkConnection")}</Typography>
</GenericFallback> </GenericFallback>
); );
} }
+97
View File
@@ -107,6 +107,29 @@
"aboutus": "About Us", "aboutus": "About Us",
"signUP": "Sign Up", "signUP": "Sign Up",
"now": "Now", "now": "Now",
"createYour": "Create your",
"createMonitor": "Create monitor",
"actions": "Actions",
"pause": "Pause",
"resume": "Resume",
"editing": "Editing...",
"url": "URL",
"access": "Access",
"timezone": "Timezone",
"features": "Features",
"administrator": "Administrator?",
"loginHere": "Login here",
"displayName": "Display name",
"urlMonitor": "URL to monitor",
"portToMonitor": "Port to monitor",
"websiteMonitoring": "Website monitoring",
"websiteMonitoringDescription": "Use HTTP(s) to monitor your website or API endpoint.",
"pingMonitoring": "Ping monitoring",
"pingMonitoringDescription": "Check whether your server is available or not.",
"dockerContainerMonitoring": "Docker container monitoring",
"dockerContainerMonitoringDescription": "Check whether your Docker container is running or not.",
"portMonitoring": "Port monitoring",
"portMonitoringDescription": "Check whether your port is open or not.",
"delete": "Delete", "delete": "Delete",
"configure": "Configure", "configure": "Configure",
"networkError": "Network error", "networkError": "Network error",
@@ -143,6 +166,80 @@
"distributedUptimeDetailsMonitorHeader": "Distributed Uptime Monitoring powered by DePIN", "distributedUptimeDetailsMonitorHeader": "Distributed Uptime Monitoring powered by DePIN",
"distributedUptimeDetailsStatusHeaderUptime": "Uptime:", "distributedUptimeDetailsStatusHeaderUptime": "Uptime:",
"distributedUptimeDetailsStatusHeaderLastUpdate": "Last updated", "distributedUptimeDetailsStatusHeaderLastUpdate": "Last updated",
"createMaintenanceWindow": "Create maintenance window",
"createMaintenance": "Create maintenance",
"editMaintenance": "Edit maintenance",
"maintenanceWindowName": "Maintenance Window Name",
"friendlyNameInput": "Friendly name",
"friendlyNamePlaceholder": "Maintenance at __ : __ for ___ minutes",
"maintenanceRepeat": "Maintenance Repeat",
"maintenance": "maintenance",
"duration": "Duration",
"addMonitors": "Add monitors",
"window": "window",
"cancel": "Cancel",
"status": "Status",
"message": "Message",
"low": "low",
"high": "high",
"host": "Host",
"statusCode": "Status code",
"date&Time": "Date & Time",
"type": "Type",
"statusPageName": "Status page name",
"publicURL": "Public URL",
"repeat": "Repeat",
"edit": "Edit",
"createA": "Create a",
"remove": "Remove",
"maintenanceWindowDescription": "Your pings won't be sent during this time frame",
"startTime": "Start time",
"timeZoneInfo": "All dates and times are in GMT+0 time zone.",
"monitorsToApply": "Monitors to apply maintenance window to",
"nextWindow": "Next window",
"notFoundButton": "Go to the main dashboard",
"pageSpeedConfigureSettingsDescription": "Here you can select the URL of the host, together with the type of monitor.",
"monitorDisplayName": "Monitor display name",
"whenNewIncident,": "When there is a new incident,",
"notifySMS": "Notify via SMS (coming soon)",
"notifyEmails": "Also notify via email to multiple addresses (coming soon)",
"seperateEmails": "You can separate multiple emails with a comma",
"checkFrequency": "Check frequency",
"matchMethod": "Match Method",
"expectedValue": "Expected value",
"deleteDialogTitle": "Do you really want to delete this monitor?",
"deleteDialogDescription": "Once deleted, this monitor cannot be retrieved.",
"pageSpeedMonitor": "PageSpeed monitor",
"shown": "Shown",
"ago": "ago",
"companyName": "Company name",
"pageSpeedDetailsPerformanceReport": "Values are estimated and may vary.",
"pageSpeedDetailsPerformanceReportCalculator": "See calculator",
"checkingEvery": "Checking every",
"statusPageCreateSettings": "If your status page is ready, you can mark it as published.",
"basicInformation": "Basic Information",
"statusPageCreateBasicInfoDescription": "Define company name and the subdomain that your status page points to.",
"statusPageCreateSelectTimeZoneDescription": "Select the timezone that your status page will be displayed in.",
"statusPageCreateAppearanceDescription": "Define the default look and feel of your public status page.",
"statusPageCreateSettingsCheckboxLabel": "Published and visible to the public",
"statusPageCreateBasicInfoStatusPageAddress": "Your status page address",
"statusPageCreateTabsContent": "Status page servers",
"statusPageCreateTabsContentDescription": "You can add any number of servers that you monitor to your status page. You can also reorder them for the best viewing experience.",
"statusPageCreateTabsContentFeaturesDescription": "Show more details on the status page",
"showCharts": "Show charts",
"showUptimePercentage": "Show uptime percentage",
"removeLogo": "Remove Logo",
"statusPageStatus": "A public status page is not set up.",
"statusPageStatusContactAdmin": "Please contact to your administrator",
"statusPageStatusNotPublic": "This status page is not public.",
"statusPageStatusNoPage": "There's no status page here.",
"statusPageStatusServiceStatus": "Service status",
"deleteStatusPage": "Do you want to delete this status page?",
"deleteStatusPageConfirm": "Yes, delete status page",
"deleteStatusPageDescription": "Once deleted, your status page cannot be retrieved.",
"uptimeCreate": "The expected value is used to match against response result, and the match determines the status.",
"uptimeCreateJsonPath": "This expression will be evaluated against the reponse JSON data and the result will be used to match against the expected value. See",
"uptimeCreateJsonPathQuery": "for query language documentation.",
"notifications": { "notifications": {
"enableNotifications": "Enable {{platform}} notifications", "enableNotifications": "Enable {{platform}} notifications",
"testNotification": "Test notification", "testNotification": "Test notification",