This commit is contained in:
Alex Holliday committed 2025-12-11 12:50:30 -08:00
1 parent b94e6052c3
commit 64d1ba08f9
23 files changed
+1657 -170

No files matched your search

@@ -47,7 +47,7 @@ export const HeaderCreate = ({
> >
{limitReached {limitReached
? "Your plan's limit has been reached" ? "Your plan's limit has been reached"
: label || t("createNew")} : label || t("common.buttons.createNew")}
</Button> </Button>
</span> </span>
</Tooltip> </Tooltip>
+7 -5
View File
@@ -3,6 +3,7 @@ import { ButtonGroup, Button } from "@/components/inputs";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
import { useTranslation } from "react-i18next";
export const HeaderRange = ({ export const HeaderRange = ({
range, range,
setRange, setRange,
@@ -14,6 +15,7 @@ export const HeaderRange = ({
loading: boolean; loading: boolean;
all?: boolean; all?: boolean;
}) => { }) => {
const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
return ( return (
@@ -45,7 +47,7 @@ export const HeaderRange = ({
: undefined : undefined
} }
> >
All {t("common.buttons.range.all")}
</Button> </Button>
)} )}
<Button <Button
@@ -61,7 +63,7 @@ export const HeaderRange = ({
: undefined : undefined
} }
> >
Recent {t("common.buttons.range.recent")}
</Button> </Button>
<Button <Button
variant="contained" variant="contained"
@@ -76,7 +78,7 @@ export const HeaderRange = ({
: undefined : undefined
} }
> >
Day {t("common.buttons.range.day")}
</Button> </Button>
<Button <Button
variant="contained" variant="contained"
@@ -91,7 +93,7 @@ export const HeaderRange = ({
: undefined : undefined
} }
> >
7 days {t("common.buttons.range.week")}
</Button> </Button>
<Button <Button
variant="contained" variant="contained"
@@ -106,7 +108,7 @@ export const HeaderRange = ({
: undefined : undefined
} }
> >
30 days {t("common.buttons.range.month")}
</Button> </Button>
</ButtonGroup> </ButtonGroup>
</Stack> </Stack>
@@ -127,9 +127,9 @@ export const MonitorBasePageWithStates: React.FC<
return ( return (
<EmptyMonitorFallback <EmptyMonitorFallback
page={page} page={page}
title={t(`${page}Monitor.fallback.title`)} title={t(`monitors.${page}.fallback.title`)}
bullets={t(`${page}Monitor.fallback.checks`, { returnObjects: true })} bullets={t(`monitors.${page}.fallback.checks`, { returnObjects: true })}
actionButtonText={t(`${page}Monitor.fallback.actionButton`)} actionButtonText={t(`monitors.${page}.fallback.actionButton`)}
actionLink={actionLink || ""} actionLink={actionLink || ""}
monitorLimitReached={monitorLimitReached} monitorLimitReached={monitorLimitReached}
/> />
@@ -41,7 +41,11 @@ const StatusBox = ({
return ( return (
<BGBox> <BGBox>
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(4)}>
<Typography variant={"h2"} textTransform="uppercase" color={theme.palette.text.secondary}> <Typography
variant={"h2"}
textTransform="uppercase"
color={theme.palette.text.secondary}
>
{label} {label}
</Typography> </Typography>
<Typography variant="h1" color={color}> <Typography variant="h1" color={color}>
@@ -55,23 +59,47 @@ const StatusBox = ({
export const UpStatusBox = ({ n }: { n: number }) => { export const UpStatusBox = ({ n }: { n: number }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
return <StatusBox label={t("monitorStatus.up")} n={n} color={theme.palette.success.light} />; return (
<StatusBox
label={t("monitors.common.status.up")}
n={n}
color={theme.palette.success.light}
/>
);
}; };
export const DownStatusBox = ({ n }: { n: number }) => { export const DownStatusBox = ({ n }: { n: number }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
return <StatusBox label={t("monitorStatus.down")} n={n} color={theme.palette.error.light} />; return (
<StatusBox
label={t("monitors.common.status.down")}
n={n}
color={theme.palette.error.light}
/>
);
}; };
export const PausedStatusBox = ({ n }: { n: number }) => { export const PausedStatusBox = ({ n }: { n: number }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
return <StatusBox label={t("monitorStatus.paused")} n={n} color={theme.palette.warning.light} />; return (
<StatusBox
label={t("monitors.common.status.paused")}
n={n}
color={theme.palette.warning.light}
/>
);
}; };
export const InitializingStatusBox = ({ n }: { n: number }) => { export const InitializingStatusBox = ({ n }: { n: number }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
return <StatusBox label={t("monitorStatus.initializing")} n={n} color={theme.palette.warning.light} />; return (
<StatusBox
label={t("monitors.common.status.initializing")}
n={n}
color={theme.palette.warning.light}
/>
);
}; };
@@ -22,6 +22,7 @@ import {
import TablePagination from "@mui/material/TablePagination"; import TablePagination from "@mui/material/TablePagination";
import type { TablePaginationProps } from "@mui/material/TablePagination"; import type { TablePaginationProps } from "@mui/material/TablePagination";
import { useTranslation } from "react-i18next";
import { useState, Fragment } from "react"; import { useState, Fragment } from "react";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
@@ -362,6 +363,7 @@ export const Pagination: React.FC<TablePaginationProps> = ({ ...props }) => {
const EmptyView = () => { const EmptyView = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
return ( return (
<Stack <Stack
alignItems={"center"} alignItems={"center"}
@@ -373,7 +375,7 @@ const EmptyView = () => {
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
}} }}
> >
<Typography>No data</Typography> <Typography>{t("monitors.common.table.empty")}</Typography>
</Stack> </Stack>
); );
}; };
+4 -2
View File
@@ -5,6 +5,7 @@ import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle"; import DialogTitle from "@mui/material/DialogTitle";
import { Button } from "@/components/inputs"; import { Button } from "@/components/inputs";
import { typographyLevels } from "@/theme/palette"; import { typographyLevels } from "@/theme/palette";
import { useTranslation } from "react-i18next";
export const DialogInput = ({ export const DialogInput = ({
open, open,
@@ -25,6 +26,7 @@ export const DialogInput = ({
cancelColor?: "error" | "primary"; cancelColor?: "error" | "primary";
loading?: boolean; loading?: boolean;
}) => { }) => {
const { t } = useTranslation();
return ( return (
<Dialog open={open}> <Dialog open={open}>
<DialogTitle sx={{ fontSize: typographyLevels.l }}>{title}</DialogTitle> <DialogTitle sx={{ fontSize: typographyLevels.l }}>{title}</DialogTitle>
@@ -38,7 +40,7 @@ export const DialogInput = ({
color={cancelColor} color={cancelColor}
onClick={onCancel} onClick={onCancel}
> >
Cancel {t("common.buttons.cancel")}
</Button> </Button>
<Button <Button
loading={loading} loading={loading}
@@ -46,7 +48,7 @@ export const DialogInput = ({
color={confirmColor} color={confirmColor}
onClick={onConfirm} onClick={onConfirm}
> >
Confirm {t("common.buttons.confirm")}
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
@@ -4,6 +4,7 @@ import Typography from "@mui/material/Typography";
import { Gauge } from "lucide-react"; import { Gauge } from "lucide-react";
import { Cell, RadialBarChart, RadialBar, ResponsiveContainer } from "recharts"; import { Cell, RadialBarChart, RadialBar, ResponsiveContainer } from "recharts";
import { useTranslation } from "react-i18next";
import { getResponseTimeColor } from "@/utils/MonitorUtils"; import { getResponseTimeColor } from "@/utils/MonitorUtils";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
@@ -14,6 +15,7 @@ export const ChartAvgResponse = ({
avg: number; avg: number;
max: number; max: number;
}) => { }) => {
const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
const chartData = [ const chartData = [
{ name: "max", value: max - avg, color: "transparent" }, { name: "max", value: max - avg, color: "transparent" },
@@ -28,7 +30,10 @@ export const ChartAvgResponse = ({
}; };
return ( return (
<BaseChart icon={<Gauge size={20} strokeWidth={1.5} />} title={"Average response time"}> <BaseChart
icon={<Gauge size={20} strokeWidth={1.5} />}
title={t("common.charts.avgResponseTime.title")}
>
<Stack height="100%" position={"relative"} justifyContent={"flex-end"}> <Stack height="100%" position={"relative"} justifyContent={"flex-end"}>
<ResponsiveContainer width="100%" height={155}> <ResponsiveContainer width="100%" height={155}>
<RadialBarChart <RadialBarChart
@@ -49,8 +54,12 @@ export const ChartAvgResponse = ({
</RadialBarChart> </RadialBarChart>
</ResponsiveContainer> </ResponsiveContainer>
<Stack direction={"row"} justifyContent={"space-between"}> <Stack direction={"row"} justifyContent={"space-between"}>
<Typography variant="body2">Low</Typography> <Typography variant="body2">
<Typography variant="body2">High</Typography> {t("common.charts.avgResponseTime.lowLabel")}
</Typography>
<Typography variant="body2">
{t("common.charts.avgResponseTime.highLabel")}
</Typography>
</Stack> </Stack>
<Stack <Stack
position="absolute" position="absolute"
@@ -51,7 +51,7 @@ export const HeaderControls = ({
await post(`/monitors/${monitor._id}/notifications/test`, {}); await post(`/monitors/${monitor._id}/notifications/test`, {});
}} }}
> >
{t("sendTestNotifications")} {t("common.buttons.testNotification")}
</Button> </Button>
)} )}
<Button <Button
@@ -60,7 +60,7 @@ export const HeaderControls = ({
navigate(`/incidents?monitorId=${monitor._id}`); navigate(`/incidents?monitorId=${monitor._id}`);
}} }}
> >
{t("menu.incidents")} {t("common.buttons.incidents")}
</Button> </Button>
<Button <Button
loading={isPatching || isPosting} loading={isPatching || isPosting}
@@ -76,7 +76,9 @@ export const HeaderControls = ({
) )
} }
> >
{monitor?.status === "paused" ? t("resume") : t("pause")} {monitor?.status === "paused"
? t("common.buttons.resume")
: t("common.buttons.pause")}
</Button> </Button>
<Button <Button
startIcon={<Settings size={20} strokeWidth={1.5} />} startIcon={<Settings size={20} strokeWidth={1.5} />}
@@ -84,7 +86,7 @@ export const HeaderControls = ({
navigate(`${path}/${monitor._id}/configure`); navigate(`${path}/${monitor._id}/configure`);
}} }}
> >
{t("configure")} {t("common.buttons.configure")}
</Button> </Button>
</ButtonGroup> </ButtonGroup>
</Stack> </Stack>
@@ -5,6 +5,7 @@ import Typography from "@mui/material/Typography";
import { Select, Checkbox, TextInput } from "@/components/inputs"; import { Select, Checkbox, TextInput } from "@/components/inputs";
import { LoadingSpinner } from "@/components/design-elements"; import { LoadingSpinner } from "@/components/design-elements";
import { useTranslation } from "react-i18next";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import type { SelectChangeEvent } from "@mui/material/Select"; import type { SelectChangeEvent } from "@mui/material/Select";
@@ -42,6 +43,7 @@ export const HeaderFilter = ({
loading = false, loading = false,
}: HeaderFilterProps) => { }: HeaderFilterProps) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const [localSearch, setLocalSearch] = useState<string>(searchString); const [localSearch, setLocalSearch] = useState<string>(searchString);
useEffect(() => { useEffect(() => {
@@ -68,7 +70,7 @@ export const HeaderFilter = ({
return ( return (
<Stack spacing={theme.spacing(4)} direction={{ xs: "column", sm: "row" }}> <Stack spacing={theme.spacing(4)} direction={{ xs: "column", sm: "row" }}>
<Select <Select
placeholder="Monitor type" placeholder={t("monitors.uptime.filters.type.placeholder")}
multiple multiple
value={selectedTypes} value={selectedTypes}
onChange={handleTypeChange} onChange={handleTypeChange}
@@ -83,7 +85,7 @@ export const HeaderFilter = ({
))} ))}
</Select> </Select>
<Select <Select
placeholder="Monitor status" placeholder={t("monitors.uptime.filters.status.placeholder")}
multiple multiple
value={selectedStatuses} value={selectedStatuses}
onChange={handleStatusChange} onChange={handleStatusChange}
@@ -100,7 +102,7 @@ export const HeaderFilter = ({
<LoadingSpinner show={loading} sx={{ alignSelf: "center" }} /> <LoadingSpinner show={loading} sx={{ alignSelf: "center" }} />
<Box flex={1} display={{ xs: "none", md: "inherit" }} /> <Box flex={1} display={{ xs: "none", md: "inherit" }} />
<TextInput <TextInput
placeholder="Search monitors" placeholder={t("monitors.uptime.filters.search.placeholder")}
value={localSearch} value={localSearch}
onChange={(event) => { onChange={(event) => {
setLocalSearch(event.target.value); setLocalSearch(event.target.value);
@@ -7,6 +7,7 @@ import { TrendingUp, AlertTriangle } from "lucide-react";
import type { GroupedCheck } from "@/types/check"; import type { GroupedCheck } from "@/types/check";
import type { MonitorStatus } from "@/types/monitor"; import type { MonitorStatus } from "@/types/monitor";
import { useTranslation } from "react-i18next";
import { normalizeResponseTimes } from "@/utils/DataUtils"; import { normalizeResponseTimes } from "@/utils/DataUtils";
import { useState } from "react"; import { useState } from "react";
import { formatDateWithTz } from "@/utils/TimeUtils"; import { formatDateWithTz } from "@/utils/TimeUtils";
@@ -63,9 +64,15 @@ export const HistogramStatus = ({
range: string; range: string;
title: string; title: string;
}) => { }) => {
const { t } = useTranslation();
const uiTimezone = useAppSelector((state: any) => state.ui.timezone); const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
const icon = status === "up" ? <TrendingUp size={20} strokeWidth={1.5} /> : <AlertTriangle size={20} strokeWidth={1.5} />; const icon =
status === "up" ? (
<TrendingUp size={20} strokeWidth={1.5} />
) : (
<AlertTriangle size={20} strokeWidth={1.5} />
);
const theme = useTheme(); const theme = useTheme();
const [idx, setIdx] = useState<number | null>(null); const [idx, setIdx] = useState<number | null>(null);
const dateFormat = range === "1d" || range === "2h" ? "MMM D, h A" : "MMM D"; const dateFormat = range === "1d" || range === "2h" ? "MMM D, h A" : "MMM D";
@@ -76,7 +83,9 @@ export const HistogramStatus = ({
<BaseChart icon={icon} title={title}> <BaseChart icon={icon} title={title}>
<Stack height={"100%"} alignItems={"center"} justifyContent={"center"}> <Stack height={"100%"} alignItems={"center"} justifyContent={"center"}>
<Typography variant="h2"> <Typography variant="h2">
{status === "up" ? "No checks yet" : "Great, no downtime yet!"} {status === "up"
? t("common.charts.uptime.emptyUp")
: t("common.charts.uptime.emptyDown")}
</Typography> </Typography>
</Stack> </Stack>
</BaseChart> </BaseChart>
+206 -5
View File
@@ -1,6 +1,46 @@
{ {
"common": { "common": {
"appName": "Checkmate" "appName": "Checkmate",
"buttons": {
"incidents": "Incidents",
"delete": "Delete",
"confirm": "Confirm",
"cancel": "Cancel",
"save": "Save",
"pause": "Pause",
"resume": "Resume",
"configure": "Configure",
"createNew": "Create new",
"toggleTheme": "Toggle theme",
"testNotification": "Send test notification",
"range": {
"all": "All",
"recent": "Recent",
"day": "Day",
"week": "7 days",
"month": "30 days"
}
},
"dialog": {
"delete": {
"title": "Are you sure you want to delete this?",
"description": "This action cannot be undone."
}
},
"charts": {
"uptime": {
"upTitle": "Uptime",
"downTitle": "Downtime",
"detail": "Total checks",
"emptyUp": "No checks yet",
"emptyDown": "Great, no downtime!"
},
"avgResponseTime": {
"title": "Average Response Time",
"lowLabel": "Low",
"highLabel": "High"
}
}
}, },
"menu": { "menu": {
"uptime": "Uptime", "uptime": "Uptime",
@@ -18,10 +58,171 @@
}, },
"monitors": { "monitors": {
"common": {}, "common": {
"uptime": {}, "status": {
"pagespeed": {}, "down": "down",
"infrastructure": {} "paused": "paused",
"initializing": "initializing",
"up": "up"
},
"stats": {
"activeFor": "Active for",
"lastCheck": "Last checked",
"lastResponseTime": "Last response time",
"certificate": "Certificate expiry"
},
"table": {
"headers": {
"name": "Name",
"type": "Type",
"status": "Status",
"statusCode": "Status code",
"message": "Message",
"dateTime": "Date & Time",
"responseTime": "Response time",
"pageSpeedScore": "PageSpeed Score",
"actions": "Actions",
"cpu": "CPU",
"memory": "Memory",
"disk": "Disk"
},
"empty": "No data"
},
"actions": {
"openSite": "Open site",
"details": "Details",
"incidents": "Incidents",
"configure": "Configure"
},
"form": {
"general": {
"title": "General settings"
},
"incidents": {
"title": "Incidents",
"description": "Number of consecutive checks needed to change monitor status. Maximum 25",
"optionIncidentCount": "How many checks before status change?"
},
"notifications": {
"title": "Notifications",
"description": "Select the notifications channels you want to use",
"optionNotificationChannels": "Choose a notification channel ({{count}} available)"
},
"interval": {
"title": "Check interval",
"description": "How often should we check the monitor?",
"optionInterval": "Check interval"
},
"optionHttp": "HTTP",
"optionHttps": "HTTPS",
"optionUrl": "URL",
"optionDisplayName": "Display name"
}
},
"uptime": {
"infoBox": {
"title": "Website & API Uptime Monitoring",
"description": "Monitor your websites and APIs to ensure they're always accessible. Get instant alerts when your services go down and track uptime history over time."
},
"fallback": {
"title": "An uptime monitor is used to:",
"actionButton": "Create a monitor!",
"checks": [
"Check if websites or servers are online & responsive",
"Alert teams about downtime or performance issues",
"Monitor HTTP endpoints, pings, containers & ports",
"Track historical uptime and reliability trends"
]
},
"form": {
"type": {
"title": "Type of check",
"description": "Select the type of uptime monitor to create.",
"optionHttpsDescription": "Use HTTPS to monitor your website or API endpoint.",
"optionHttpDescription": "Use HTTP to monitor your website or API endpoint.",
"optionPing": "Ping",
"optionPingDescription": "Use ICMP Ping to monitor if a server is online.",
"optionPort": "Port",
"optionPortDescription": "Monitor if a specific port on a server is open."
},
"general": {
"description": {
"https": "Enter the URL or IP to monitor (e.g., https://example.com/ or 192.168.1.100) and add a clear display name that appears on the dashboard.",
"http": "Enter the URL or IP to monitor (e.g., https://example.com/ or 192.168.1.100) and add a clear display name that appears on the dashboard.",
"ping": "Enter the IP address or hostname to ping (e.g., 192.168.1.100 or example.com) and add a clear display name that appears on the dashboard.",
"port": "Enter the URL or IP of the server, the port number and a clear display name that appears on the dashboard."
},
"optionPort": "Port"
},
"rejectUnauthorized": {
"title": "Reject unauthorized",
"description": "Disable to allow self-signed SSL certificates",
"optionEnabled": "Enabled (recommended)",
"optionDisabled": "Disabled"
}
},
"filters": {
"type": {
"placeholder": "Monitor type"
},
"status": {
"placeholder": "Monitor status"
},
"search": {
"placeholder": "Search monitors..."
}
}
},
"pageSpeed": {
"infoBox": {
"title": "Website Performance Tracking",
"description": "Measure how fast your websites load and identify performance bottlenecks. Track Core Web Vitals and get actionable insights to improve user experience."
},
"fallback": {
"title": "A PageSpeed monitor is used to:",
"actionButton": "Create a monitor!",
"checks": [
"Report on the user experience of a page",
"Help analyze webpage speed",
"Give suggestions on how the page can be improved"
]
},
"form": {
"general": {
"description": "Enter the URL of the website you want to carry out PageSpeed tests on"
}
}
},
"infrastructure": {
"infoBox": {
"title": "Infrastructure Monitoring",
"description": "Keep track of your servers' vital statistics including CPU usage, memory, disk space, and network performance. Receive alerts when resources run low."
},
"fallback": {
"actionButton": "Create a monitor!",
"checks": [
"Track the performance of your servers",
"Identify bottlenecks and optimize usage",
"Ensure reliability with real-time monitoring"
],
"title": "An infrastructure monitor is used to:"
},
"form": {
"general": {
"description": "Enter the IP address or hostname of the server you want to monitor, along with a clear display name that appears on the dashboard.",
"optionSecret": "Authorization secret"
},
"thresholds": {
"title": "Thresholds for alerts",
"description": "Set percentage thresholds to trigger incidents",
"optionCpuUsage": "CPU usage (%)",
"optionMemoryUsage": "Memory usage (%)",
"optionDiskUsage": "Disk usage (%)",
"optionTemperature": "Temperature (°C)"
}
}
}
}, },
"notifications": {}, "notifications": {},
"incidents": {}, "incidents": {},
File diff suppressed because it is too large. Load diff
+32 -22
View File
@@ -100,8 +100,8 @@ export const InfraForm = ({
return ( return (
<BasePage component={"form"} onSubmit={handleSubmit(onSubmit)}> <BasePage component={"form"} onSubmit={handleSubmit(onSubmit)}>
<ConfigBox <ConfigBox
title={t("settingsGeneralSettings")} title={t("monitors.common.form.general.title")}
subtitle={t(`pageSpeedConfigureSettingsDescription`)} subtitle={t(`monitors.infrastructure.form.general.description`)}
rightContent={ rightContent={
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(8)}>
<RadioGroup <RadioGroup
@@ -113,12 +113,12 @@ export const InfraForm = ({
> >
<RadioWithDescription <RadioWithDescription
value="https" value="https"
label="HTTPS" label={t("monitors.common.form.optionHttps")}
description="" description=""
/> />
<RadioWithDescription <RadioWithDescription
value="http" value="http"
label={"HTTP"} label={t("monitors.common.form.optionHttp")}
description={""} description={""}
/> />
</RadioGroup> </RadioGroup>
@@ -140,7 +140,7 @@ export const InfraForm = ({
}, 0); }, 0);
}} }}
type="text" type="text"
fieldLabel={t("url")} fieldLabel={t("monitors.common.form.optionUrl")}
fullWidth fullWidth
error={!!errors.url} error={!!errors.url}
helperText={errors.url ? errors.url.message : ""} helperText={errors.url ? errors.url.message : ""}
@@ -155,7 +155,7 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("displayName")} fieldLabel={t("monitors.common.form.optionDisplayName")}
fullWidth fullWidth
error={!!errors.name} error={!!errors.name}
helperText={errors.name ? errors.name.message : ""} helperText={errors.name ? errors.name.message : ""}
@@ -169,7 +169,9 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("infrastructureAuthorizationSecretLabel")} fieldLabel={t(
"monitors.infrastructure.form.general.optionSecret"
)}
fullWidth fullWidth
error={!!errors.secret} error={!!errors.secret}
helperText={errors.secret ? errors.secret.message : ""} helperText={errors.secret ? errors.secret.message : ""}
@@ -180,8 +182,8 @@ export const InfraForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.incidentConfigTitle")} title={t("monitors.common.form.incidents.title")}
subtitle={t("createMonitorPage.incidentConfigDescriptionV2")} subtitle={t("monitors.common.form.incidents.description")}
rightContent={ rightContent={
<Controller <Controller
name="n" name="n"
@@ -191,7 +193,7 @@ export const InfraForm = ({
{...field} {...field}
type="number" type="number"
fieldLabel={t( fieldLabel={t(
"createMonitorPage.incidentConfigStatusCheckNumber" "monitors.common.form.incidents.optionIncidentCount"
)} )}
fullWidth fullWidth
error={!!errors.n} error={!!errors.n}
@@ -206,8 +208,8 @@ export const InfraForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("Threshold Alerts")} title={t("monitors.infrastructure.form.thresholds.title")}
subtitle={t("Set percentage thresholds to trigger incidents.")} subtitle={t("monitors.infrastructure.form.thresholds.description")}
rightContent={ rightContent={
<Stack gap={theme.spacing(4)}> <Stack gap={theme.spacing(4)}>
<Controller <Controller
@@ -217,7 +219,9 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="number" type="number"
fieldLabel={t("CPU %")} fieldLabel={t(
"monitors.infrastructure.form.thresholds.optionCpuUsage"
)}
fullWidth fullWidth
error={!!errors.thresholds?.cpu} error={!!errors.thresholds?.cpu}
helperText={errors.thresholds?.cpu?.message ?? ""} helperText={errors.thresholds?.cpu?.message ?? ""}
@@ -231,7 +235,9 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="number" type="number"
fieldLabel={t("Memory %")} fieldLabel={t(
"monitors.infrastructure.form.thresholds.optionMemoryUsage"
)}
fullWidth fullWidth
error={!!errors.thresholds?.memory} error={!!errors.thresholds?.memory}
helperText={errors.thresholds?.memory?.message ?? ""} helperText={errors.thresholds?.memory?.message ?? ""}
@@ -245,7 +251,9 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="number" type="number"
fieldLabel={t("Disk %")} fieldLabel={t(
"monitors.infrastructure.form.thresholds.optionDiskUsage"
)}
fullWidth fullWidth
error={!!errors.thresholds?.disk} error={!!errors.thresholds?.disk}
helperText={errors.thresholds?.disk?.message ?? ""} helperText={errors.thresholds?.disk?.message ?? ""}
@@ -259,7 +267,9 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="number" type="number"
fieldLabel={t("Temperature °C")} fieldLabel={t(
"monitors.infrastructure.form.thresholds.optionTemperature"
)}
fullWidth fullWidth
error={!!errors.thresholds?.temperature} error={!!errors.thresholds?.temperature}
helperText={errors.thresholds?.temperature?.message ?? ""} helperText={errors.thresholds?.temperature?.message ?? ""}
@@ -270,8 +280,8 @@ export const InfraForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("notificationConfig.title")} title={t("monitors.common.form.notifications.title")}
subtitle={t("notificationConfig.description")} subtitle={t("monitors.common.form.notifications.description")}
rightContent={ rightContent={
<Stack> <Stack>
<Controller <Controller
@@ -325,8 +335,8 @@ export const InfraForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.intervalTitle")} title={t("monitors.common.form.interval.title")}
subtitle="How often to check the URL" subtitle={t("monitors.common.form.interval.description")}
rightContent={ rightContent={
<Controller <Controller
name="interval" name="interval"
@@ -335,7 +345,7 @@ export const InfraForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("createMonitorPage.intervalDescription")} fieldLabel={t("monitors.common.form.interval.optionInterval")}
fullWidth fullWidth
error={!!errors.interval} error={!!errors.interval}
helperText={errors.interval ? errors.interval.message : ""} helperText={errors.interval ? errors.interval.message : ""}
@@ -351,7 +361,7 @@ export const InfraForm = ({
variant="contained" variant="contained"
color="primary" color="primary"
> >
{t("settingsSave")} {t("common.buttons.save")}
</Button> </Button>
</Stack> </Stack>
</BasePage> </BasePage>
@@ -90,8 +90,8 @@ const PageSpeedMonitorsPage = () => {
actionLink="/infrastructure/create" actionLink="/infrastructure/create"
> >
<InfoBox <InfoBox
title="Server Health Monitoring" title={t("monitors.infrastructure.infoBox.title")}
description="Keep track of your servers' vital statistics including CPU usage, memory, disk space, and network performance. Receive alerts when resources run low." description={t("monitors.infrastructure.infoBox.description")}
/> />
<HeaderCreate <HeaderCreate
isLoading={loading} isLoading={loading}
@@ -123,8 +123,8 @@ const PageSpeedMonitorsPage = () => {
/> />
<Dialog <Dialog
open={isDialogOpen} open={isDialogOpen}
title={t("deleteDialogTitle")} title={t("common.dialog.delete.title")}
content={t("deleteDialogDescription")} content={t("common.dialog.delete.description")}
onConfirm={handleConfirm} onConfirm={handleConfirm}
onCancel={handleCancel} onCancel={handleCancel}
loading={isDeleting} loading={isDeleting}
@@ -84,7 +84,7 @@ export const InfraMonitorsTable = ({
return [ return [
{ {
id: 1, id: 1,
label: "Open site", label: t("monitors.common.actions.openSite"),
action: () => { action: () => {
window.open(monitor.url, "_blank", "noreferrer"); window.open(monitor.url, "_blank", "noreferrer");
}, },
@@ -92,21 +92,21 @@ export const InfraMonitorsTable = ({
}, },
{ {
id: 2, id: 2,
label: "Details", label: t("monitors.common.actions.details"),
action: () => { action: () => {
navigate(`${monitor._id}`); navigate(`${monitor._id}`);
}, },
}, },
{ {
id: 3, id: 3,
label: "Incidents", label: t("monitors.common.actions.incidents"),
action: () => { action: () => {
navigate(`/incidents?monitorId=${monitor._id}`); navigate(`/incidents?monitorId=${monitor._id}`);
}, },
}, },
{ {
id: 4, id: 4,
label: "Configure", label: t("monitors.common.actions.configure"),
action: () => { action: () => {
navigate(`/infrastructure/${monitor._id}/configure`); navigate(`/infrastructure/${monitor._id}/configure`);
}, },
@@ -115,12 +115,15 @@ export const InfraMonitorsTable = ({
// id: 5, // id: 5,
// label: "Clone", // label: "Clone",
// action: () => { // action: () => {
// }, // },
// }, // },
{ {
id: 6, id: 6,
label: monitor.status === "paused" ? "Resume" : "Pause", label:
monitor.status === "paused"
? t("common.buttons.resume")
: t("common.buttons.pause"),
action: async () => { action: async () => {
await patch(`/monitors/${monitor._id}/active`); await patch(`/monitors/${monitor._id}/active`);
refetch(); refetch();
@@ -129,7 +132,11 @@ export const InfraMonitorsTable = ({
}, },
{ {
id: 7, id: 7,
label: <Typography color={theme.palette.error.main}>Remove</Typography>, label: (
<Typography color={theme.palette.error.main}>
{t("common.buttons.delete")}
</Typography>
),
action: () => { action: () => {
setSelectedMonitor(monitor); setSelectedMonitor(monitor);
}, },
@@ -161,7 +168,7 @@ export const InfraMonitorsTable = ({
onClick={(e) => handleSort(e, "name")} onClick={(e) => handleSort(e, "name")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("host")} {t("monitors.common.table.headers.name")}
{renderSortIcon(sortField === "name")} {renderSortIcon(sortField === "name")}
</Typography> </Typography>
), ),
@@ -179,7 +186,7 @@ export const InfraMonitorsTable = ({
onClick={(e) => handleSort(e, "status")} onClick={(e) => handleSort(e, "status")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("status")} {t("monitors.common.table.headers.status")}
{renderSortIcon(sortField === "status")} {renderSortIcon(sortField === "status")}
</Typography> </Typography>
), ),
@@ -189,7 +196,7 @@ export const InfraMonitorsTable = ({
}, },
{ {
id: "cpu", id: "cpu",
content: t("cpu"), content: t("monitors.common.table.headers.cpu"),
render: (row) => { render: (row) => {
const cpuUsage = const cpuUsage =
(row.latestChecks?.[0]?.system?.cpu?.usage_percent || 0) * 100; (row.latestChecks?.[0]?.system?.cpu?.usage_percent || 0) * 100;
@@ -198,7 +205,7 @@ export const InfraMonitorsTable = ({
}, },
{ {
id: "memory", id: "memory",
content: t("memory"), content: t("monitors.common.table.headers.memory"),
render: (row) => { render: (row) => {
const memoryUsage = const memoryUsage =
(row.latestChecks?.[0]?.system?.memory?.usage_percent || 0) * 100; (row.latestChecks?.[0]?.system?.memory?.usage_percent || 0) * 100;
@@ -207,7 +214,7 @@ export const InfraMonitorsTable = ({
}, },
{ {
id: "disk", id: "disk",
content: t("disk"), content: t("monitors.common.table.headers.disk"),
render: (row) => { render: (row) => {
const totalDiskUsage = row.latestChecks?.[0]?.system?.disk?.reduce( const totalDiskUsage = row.latestChecks?.[0]?.system?.disk?.reduce(
(acc, disk) => acc + disk.usage_percent, (acc, disk) => acc + disk.usage_percent,
@@ -221,7 +228,7 @@ export const InfraMonitorsTable = ({
{ {
id: "actions", id: "actions",
content: t("actions"), content: t("monitors.common.table.headers.actions"),
render: (row) => { render: (row) => {
return <ActionsMenu items={getActions(row)} />; return <ActionsMenu items={getActions(row)} />;
}, },
+17 -15
View File
@@ -100,8 +100,8 @@ export const PageSpeedForm = ({
return ( return (
<BasePage component={"form"} onSubmit={handleSubmit(onSubmit)}> <BasePage component={"form"} onSubmit={handleSubmit(onSubmit)}>
<ConfigBox <ConfigBox
title={t("settingsGeneralSettings")} title={t("monitors.common.form.general.title")}
subtitle={t(`pageSpeedConfigureSettingsDescription`)} subtitle={t("monitors.pageSpeed.form.general.description")}
rightContent={ rightContent={
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(8)}>
<RadioGroup <RadioGroup
@@ -113,12 +113,12 @@ export const PageSpeedForm = ({
> >
<RadioWithDescription <RadioWithDescription
value="https" value="https"
label="HTTPS" label={t("monitors.common.form.optionHttps")}
description="" description=""
/> />
<RadioWithDescription <RadioWithDescription
value="http" value="http"
label={"HTTP"} label={t("monitors.common.form.optionHttp")}
description={""} description={""}
/> />
</RadioGroup> </RadioGroup>
@@ -140,7 +140,7 @@ export const PageSpeedForm = ({
}, 0); }, 0);
}} }}
type="text" type="text"
fieldLabel={t("url")} fieldLabel={t("monitors.common.form.optionUrl")}
fullWidth fullWidth
error={!!errors.url} error={!!errors.url}
helperText={errors.url ? errors.url.message : ""} helperText={errors.url ? errors.url.message : ""}
@@ -155,7 +155,7 @@ export const PageSpeedForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("displayName")} fieldLabel={t("monitors.common.form.optionDisplayName")}
fullWidth fullWidth
error={!!errors.name} error={!!errors.name}
helperText={errors.name ? errors.name.message : ""} helperText={errors.name ? errors.name.message : ""}
@@ -166,8 +166,8 @@ export const PageSpeedForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.incidentConfigTitle")} title={t("monitors.common.form.incidents.title")}
subtitle={t("createMonitorPage.incidentConfigDescriptionV2")} subtitle={t("monitors.common.form.incidents.description")}
rightContent={ rightContent={
<Controller <Controller
name="n" name="n"
@@ -176,7 +176,9 @@ export const PageSpeedForm = ({
<TextInput <TextInput
{...field} {...field}
type="number" type="number"
fieldLabel={t("createMonitorPage.incidentConfigStatusCheckNumber")} fieldLabel={t(
"monitors.common.form.incidents.optionIncidentCount"
)}
fullWidth fullWidth
error={!!errors.n} error={!!errors.n}
helperText={errors.n ? errors.n.message : ""} helperText={errors.n ? errors.n.message : ""}
@@ -190,8 +192,8 @@ export const PageSpeedForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("notificationConfig.title")} title={t("monitors.common.form.notifications.title")}
subtitle={t("notificationConfig.description")} subtitle={t("monitors.common.form.notifications.description")}
rightContent={ rightContent={
<Stack> <Stack>
<Controller <Controller
@@ -245,8 +247,8 @@ export const PageSpeedForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.intervalTitle")} title={t("monitors.common.form.interval.title")}
subtitle="How often to check the URL" subtitle={t("monitors.common.form.interval.description")}
rightContent={ rightContent={
<Controller <Controller
name="interval" name="interval"
@@ -255,7 +257,7 @@ export const PageSpeedForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("createMonitorPage.intervalDescription")} fieldLabel={t("monitors.common.form.interval.optionInterval")}
fullWidth fullWidth
error={!!errors.interval} error={!!errors.interval}
helperText={errors.interval ? errors.interval.message : ""} helperText={errors.interval ? errors.interval.message : ""}
@@ -271,7 +273,7 @@ export const PageSpeedForm = ({
variant="contained" variant="contained"
color="primary" color="primary"
> >
{t("settingsSave")} {t("common.buttons.save")}
</Button> </Button>
</Stack> </Stack>
</BasePage> </BasePage>
@@ -85,7 +85,7 @@ export const PageSpeedMonitorTable = ({
return [ return [
{ {
id: 1, id: 1,
label: "Open site", label: t("monitors.common.actions.openSite"),
action: () => { action: () => {
window.open(monitor.url, "_blank", "noreferrer"); window.open(monitor.url, "_blank", "noreferrer");
}, },
@@ -93,21 +93,21 @@ export const PageSpeedMonitorTable = ({
}, },
{ {
id: 2, id: 2,
label: "Details", label: t("monitors.common.actions.details"),
action: () => { action: () => {
navigate(`${monitor._id}`); navigate(`${monitor._id}`);
}, },
}, },
{ {
id: 3, id: 3,
label: "Incidents", label: t("monitors.common.actions.incidents"),
action: () => { action: () => {
navigate(`/incidents?monitorId=${monitor._id}`); navigate(`/incidents?monitorId=${monitor._id}`);
}, },
}, },
{ {
id: 4, id: 4,
label: "Configure", label: t("monitors.common.actions.configure"),
action: () => { action: () => {
navigate(`/pagespeed/${monitor._id}/configure`); navigate(`/pagespeed/${monitor._id}/configure`);
}, },
@@ -116,12 +116,15 @@ export const PageSpeedMonitorTable = ({
// id: 5, // id: 5,
// label: "Clone", // label: "Clone",
// action: () => { // action: () => {
// }, // },
// }, // },
{ {
id: 6, id: 6,
label: monitor.status === "paused" ? "Resume" : "Pause", label:
monitor.status === "paused"
? t("common.buttons.resume")
: t("common.buttons.pause"),
action: async () => { action: async () => {
await patch(`/monitors/${monitor._id}/active`); await patch(`/monitors/${monitor._id}/active`);
refetch(); refetch();
@@ -130,7 +133,11 @@ export const PageSpeedMonitorTable = ({
}, },
{ {
id: 7, id: 7,
label: <Typography color={theme.palette.error.main}>Remove</Typography>, label: (
<Typography color={theme.palette.error.main}>
{t("common.buttons.delete")}
</Typography>
),
action: () => { action: () => {
setSelectedMonitor(monitor); setSelectedMonitor(monitor);
}, },
@@ -163,7 +170,7 @@ export const PageSpeedMonitorTable = ({
onClick={(e) => handleSort(e, "name")} onClick={(e) => handleSort(e, "name")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("host")} {t("monitors.common.table.headers.name")}
{renderSortIcon(sortField === "name")} {renderSortIcon(sortField === "name")}
</Stack> </Stack>
), ),
@@ -182,7 +189,7 @@ export const PageSpeedMonitorTable = ({
onClick={(e) => handleSort(e, "status")} onClick={(e) => handleSort(e, "status")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("status")} {t("monitors.common.table.headers.status")}
{renderSortIcon(sortField === "status")} {renderSortIcon(sortField === "status")}
</Stack> </Stack>
), ),
@@ -192,7 +199,7 @@ export const PageSpeedMonitorTable = ({
}, },
{ {
id: "histogram", id: "histogram",
content: "PageSpeed score", content: t("monitors.common.table.headers.pageSpeedScore"),
render: (row) => { render: (row) => {
return ( return (
<Stack alignItems={"center"}> <Stack alignItems={"center"}>
@@ -207,7 +214,7 @@ export const PageSpeedMonitorTable = ({
{ {
id: "actions", id: "actions",
content: t("actions"), content: t("monitors.common.table.headers.actions"),
render: (row) => { render: (row) => {
return <ActionsMenu items={getActions(row)} />; return <ActionsMenu items={getActions(row)} />;
}, },
@@ -19,7 +19,6 @@ import useMediaQuery from "@mui/material/useMediaQuery";
import { useState } from "react"; import { useState } from "react";
import { useDelete } from "@/hooks/UseApi"; import { useDelete } from "@/hooks/UseApi";
import { InitializingStatusBox } from "@/components/design-elements/StatusBox"; import { InitializingStatusBox } from "@/components/design-elements/StatusBox";
import { useAppSelector } from "@/hooks/AppHooks";
import { config } from "@/config/index"; import { config } from "@/config/index";
import { useLimitReached } from "@/hooks/UsePlanEntitlements"; import { useLimitReached } from "@/hooks/UsePlanEntitlements";
@@ -27,7 +26,6 @@ const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
const PageSpeedMonitorsPage = () => { const PageSpeedMonitorsPage = () => {
const theme = useTheme(); const theme = useTheme();
const { user } = useAppSelector((state) => state.auth);
const { t } = useTranslation(); const { t } = useTranslation();
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
@@ -91,8 +89,8 @@ const PageSpeedMonitorsPage = () => {
monitorLimitReached={monitorLimitReached} monitorLimitReached={monitorLimitReached}
> >
<InfoBox <InfoBox
title="Website Performance Tracking" title={t("monitors.pageSpeed.infoBox.title")}
description="Measure how fast your websites load and identify performance bottlenecks. Track Core Web Vitals and get actionable insights to improve user experience." description={t("monitors.pageSpeed.infoBox.description")}
/> />
<HeaderCreate <HeaderCreate
isLoading={loading} isLoading={loading}
@@ -124,8 +122,8 @@ const PageSpeedMonitorsPage = () => {
/> />
<Dialog <Dialog
open={isDialogOpen} open={isDialogOpen}
title={t("deleteDialogTitle")} title={t("common.dialog.delete.title")}
content={t("deleteDialogDescription")} content={t("common.dialog.delete.description")}
onConfirm={handleConfirm} onConfirm={handleConfirm}
onCancel={handleCancel} onCancel={handleCancel}
loading={isDeleting} loading={isDeleting}
+4 -4
View File
@@ -16,14 +16,14 @@ const getHeaders = (t: Function, uiTimezone: string) => {
const headers: Header<ICheck>[] = [ const headers: Header<ICheck>[] = [
{ {
id: "status", id: "status",
content: t("status"), content: t("monitors.common.table.headers.status"),
render: (row) => { render: (row) => {
return <StatusLabel status={row.status as MonitorStatus} />; return <StatusLabel status={row.status as MonitorStatus} />;
}, },
}, },
{ {
id: "date", id: "date",
content: t("date&Time"), content: t("monitors.common.table.headers.dateTime"),
render: (row) => { render: (row) => {
return formatDateWithTz( return formatDateWithTz(
row.createdAt, row.createdAt,
@@ -34,14 +34,14 @@ const getHeaders = (t: Function, uiTimezone: string) => {
}, },
{ {
id: "message", id: "message",
content: t("message"), content: t("monitors.common.table.headers.message"),
render: (row) => { render: (row) => {
return row.message || "N/A"; return row.message || "N/A";
}, },
}, },
{ {
id: "statusCode", id: "statusCode",
content: t("statusCode"), content: t("monitors.common.table.headers.statusCode"),
render: (row) => { render: (row) => {
return row.httpStatusCode || "N/A"; return row.httpStatusCode || "N/A";
}, },
+8 -7
View File
@@ -9,6 +9,7 @@ import {
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import { CheckTable } from "@/pages/uptime/CheckTable"; import { CheckTable } from "@/pages/uptime/CheckTable";
import { useTranslation } from "react-i18next";
import type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor"; import type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
@@ -25,7 +26,7 @@ const UptimeDetailsPage = () => {
const { id } = useParams(); const { id } = useParams();
const theme = useTheme(); const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const { t } = useTranslation();
// Local state // Local state
const [range, setRange] = useState("2h"); const [range, setRange] = useState("2h");
@@ -113,13 +114,13 @@ const UptimeDetailsPage = () => {
<Stack direction={isSmall ? "column" : "row"} gap={theme.spacing(8)}> <Stack direction={isSmall ? "column" : "row"} gap={theme.spacing(8)}>
<StatBox <StatBox
palette={palette} palette={palette}
title="Active for" title={t("monitors.common.stats.activeFor")}
subtitle={prettyMilliseconds(streakDuration, { subtitle={prettyMilliseconds(streakDuration, {
secondsDecimalDigits: 0, secondsDecimalDigits: 0,
})} })}
/> />
<StatBox <StatBox
title="Last check" title={t("monitors.common.stats.lastCheck")}
subtitle={ subtitle={
lastChecked >= 0 lastChecked >= 0
? `${prettyMilliseconds(lastChecked, { ? `${prettyMilliseconds(lastChecked, {
@@ -129,13 +130,13 @@ const UptimeDetailsPage = () => {
} }
/> />
<StatBox <StatBox
title="Last response time" title={t("monitors.common.stats.lastResponseTime")}
subtitle={ subtitle={
stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A" stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"
} }
/> />
<StatBox <StatBox
title="Certificate Expiry" title={t("monitors.common.stats.certificate")}
subtitle={ subtitle={
stats?.certificateExpiry stats?.certificateExpiry
? new Date(stats.certificateExpiry).toLocaleString() ? new Date(stats.certificateExpiry).toLocaleString()
@@ -150,13 +151,13 @@ const UptimeDetailsPage = () => {
/> />
<Stack direction={isSmall ? "column" : "row"} gap={theme.spacing(8)}> <Stack direction={isSmall ? "column" : "row"} gap={theme.spacing(8)}>
<HistogramStatus <HistogramStatus
title="Uptime" title={t("common.charts.uptime.upTitle")}
status={"up"} status={"up"}
checks={upChecks} checks={upChecks}
range={range} range={range}
/> />
<HistogramStatus <HistogramStatus
title="Incidents" title={t("common.charts.uptime.downTitle")}
checks={downChecks} checks={downChecks}
status={"down"} status={"down"}
range={range} range={range}
+45 -31
View File
@@ -111,8 +111,8 @@ export const UptimeForm = ({
<BasePage component={"form"} onSubmit={handleSubmit(onSubmit)}> <BasePage component={"form"} onSubmit={handleSubmit(onSubmit)}>
{mode === "create" && ( {mode === "create" && (
<ConfigBox <ConfigBox
title={t("distributedUptimeCreateChecks")} title={t("monitors.uptime.form.type.title")}
subtitle={t("distributedUptimeCreateChecksDescription")} subtitle={t("monitors.uptime.form.type.description")}
rightContent={ rightContent={
<Controller <Controller
name="type" name="type"
@@ -122,26 +122,31 @@ export const UptimeForm = ({
<RadioGroup {...field} sx={{ gap: theme.spacing(6) }}> <RadioGroup {...field} sx={{ gap: theme.spacing(6) }}>
<RadioWithDescription <RadioWithDescription
value="https" value="https"
label="HTTPS" label={t("monitors.common.form.optionHttps")}
description="Use HTTPS to monitor your website or API endpoint. description={t(
" "monitors.uptime.form.type.optionHttpsDescription"
)}
/> />
<RadioWithDescription <RadioWithDescription
value="http" value="http"
label={"HTTP"} label={t("monitors.common.form.optionHttp")}
description={ description={t(
"Use HTTP to monitor your website or API endpoint." "monitors.uptime.form.type.optionHttpDescription"
} )}
/> />
<RadioWithDescription <RadioWithDescription
value="port" value="port"
label={"Port"} label={t("monitors.uptime.form.type.optionPort")}
description={"Check whether your port is open or not."} description={t(
"monitors.uptime.form.type.optionPortDescription"
)}
/> />
<RadioWithDescription <RadioWithDescription
value="ping" value="ping"
label={t("pingMonitoring")} label={t("monitors.uptime.form.type.optionPing")}
description={t("pingMonitoringDescription")} description={t(
"monitors.uptime.form.type.optionPingDescription"
)}
/> />
</RadioGroup> </RadioGroup>
</FormControl> </FormControl>
@@ -151,8 +156,8 @@ export const UptimeForm = ({
/> />
)} )}
<ConfigBox <ConfigBox
title={t("settingsGeneralSettings")} title={t("monitors.common.form.general.title")}
subtitle={t(`uptimeGeneralInstructions.${selectedType}`)} subtitle={t(`monitors.uptime.form.general.description.${selectedType}`)}
rightContent={ rightContent={
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(8)}>
<Controller <Controller
@@ -173,7 +178,7 @@ export const UptimeForm = ({
}, 0); }, 0);
}} }}
type="text" type="text"
fieldLabel={t("url")} fieldLabel={t("monitors.common.form.optionUrl")}
fullWidth fullWidth
error={!!errors.url} error={!!errors.url}
helperText={errors.url ? errors.url.message : ""} helperText={errors.url ? errors.url.message : ""}
@@ -188,7 +193,7 @@ export const UptimeForm = ({
<TextInput <TextInput
{...field} {...field}
type="number" type="number"
fieldLabel={"Port"} fieldLabel={t("monitors.uptime.form.general.optionPort")}
fullWidth fullWidth
error={!!errors.port} error={!!errors.port}
helperText={errors.port ? errors.port.message : ""} helperText={errors.port ? errors.port.message : ""}
@@ -203,7 +208,7 @@ export const UptimeForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("displayName")} fieldLabel={t("monitors.common.form.optionDisplayName")}
fullWidth fullWidth
error={!!errors.name} error={!!errors.name}
helperText={errors.name ? errors.name.message : ""} helperText={errors.name ? errors.name.message : ""}
@@ -214,8 +219,8 @@ export const UptimeForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.incidentConfigTitle")} title={t("monitors.common.form.incidents.title")}
subtitle={t("createMonitorPage.incidentConfigDescriptionV2")} subtitle={t("monitors.common.form.incidents.description")}
rightContent={ rightContent={
<Controller <Controller
name="n" name="n"
@@ -225,7 +230,7 @@ export const UptimeForm = ({
{...field} {...field}
type="number" type="number"
fieldLabel={t( fieldLabel={t(
"createMonitorPage.incidentConfigStatusCheckNumber" "monitors.common.form.incidents.optionIncidentCount"
)} )}
fullWidth fullWidth
error={!!errors.n} error={!!errors.n}
@@ -240,8 +245,8 @@ export const UptimeForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("notificationConfig.title")} title={t("monitors.common.form.notifications.title")}
subtitle={t("notificationConfig.description")} subtitle={t("monitors.common.form.notifications.description")}
rightContent={ rightContent={
<Stack> <Stack>
<Controller <Controller
@@ -251,7 +256,12 @@ export const UptimeForm = ({
render={({ field }) => ( render={({ field }) => (
<AutoComplete <AutoComplete
multiple multiple
fieldLabel={`You have ${notificationOptions.length} available notification ${notificationOptions.length === 1 ? "channel" : "channels"}`} fieldLabel={t(
"monitors.common.form.notifications.optionNotificationChannels",
{
count: notificationOptions.length,
}
)}
options={notificationOptions} options={notificationOptions}
getOptionLabel={(option) => option.name} getOptionLabel={(option) => option.name}
value={notificationOptions.filter((o: any) => value={notificationOptions.filter((o: any) =>
@@ -296,8 +306,8 @@ export const UptimeForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.intervalTitle")} title={t("monitors.common.form.interval.title")}
subtitle="How often to check the URL" subtitle={t("monitors.common.form.interval.description")}
rightContent={ rightContent={
<Controller <Controller
name="interval" name="interval"
@@ -306,7 +316,7 @@ export const UptimeForm = ({
<TextInput <TextInput
{...field} {...field}
type="text" type="text"
fieldLabel={t("createMonitorPage.intervalDescription")} fieldLabel={t("monitors.common.form.interval.optionInterval")}
fullWidth fullWidth
error={!!errors.interval} error={!!errors.interval}
helperText={errors.interval ? errors.interval.message : ""} helperText={errors.interval ? errors.interval.message : ""}
@@ -316,8 +326,8 @@ export const UptimeForm = ({
} }
/> />
<ConfigBox <ConfigBox
title={t("createMonitorPage.rejectUnauthorizedTitle")} title={t("monitors.uptime.form.rejectUnauthorized.title")}
subtitle={t("createMonitorPage.rejectUnauthorizedDescription")} subtitle={t("monitors.uptime.form.rejectUnauthorized.description")}
rightContent={ rightContent={
<Controller <Controller
name="rejectUnauthorized" name="rejectUnauthorized"
@@ -326,7 +336,11 @@ export const UptimeForm = ({
<Stack direction="row" alignItems={"center"}> <Stack direction="row" alignItems={"center"}>
<Switch {...field} checked={field.value} /> <Switch {...field} checked={field.value} />
<Typography> <Typography>
{field.value ? "Enabled (recommended)" : "Disabled"} {field.value
? t("monitors.uptime.form.rejectUnauthorized.optionEnabled")
: t(
"monitors.uptime.form.rejectUnauthorized.optionDisabled"
)}
</Typography> </Typography>
</Stack> </Stack>
)} )}
@@ -340,7 +354,7 @@ export const UptimeForm = ({
variant="contained" variant="contained"
color="primary" color="primary"
> >
{t("settingsSave")} {t("common.buttons.save")}
</Button> </Button>
</Stack> </Stack>
</BasePage> </BasePage>
+4 -6
View File
@@ -27,7 +27,6 @@ import {
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
import { useState } from "react"; import { useState } from "react";
import { useDelete } from "@/hooks/UseApi"; import { useDelete } from "@/hooks/UseApi";
import { useAppSelector } from "@/hooks/AppHooks";
import { config } from "@/config/index"; import { config } from "@/config/index";
import { useLimitReached } from "@/hooks/UsePlanEntitlements"; import { useLimitReached } from "@/hooks/UsePlanEntitlements";
@@ -35,7 +34,6 @@ const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
const UptimeMonitors = () => { const UptimeMonitors = () => {
const theme = useTheme(); const theme = useTheme();
const { user } = useAppSelector((state) => state.auth);
const { t } = useTranslation(); const { t } = useTranslation();
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const [selectedMonitor, setSelectedMonitor] = useState<IMonitor | null>(null); const [selectedMonitor, setSelectedMonitor] = useState<IMonitor | null>(null);
@@ -129,8 +127,8 @@ const UptimeMonitors = () => {
monitorLimitReached={monitorLimitReached} monitorLimitReached={monitorLimitReached}
> >
<InfoBox <InfoBox
title="Website & API Uptime Monitoring" title={t("monitors.uptime.infoBox.title")}
description="Monitor your websites and APIs to ensure they're always accessible. Get instant alerts when your services go down and track uptime history over time." description={t("monitors.uptime.infoBox.description")}
/> />
<HeaderCreate <HeaderCreate
isLoading={loading} isLoading={loading}
@@ -172,8 +170,8 @@ const UptimeMonitors = () => {
/> />
<Dialog <Dialog
open={isDialogOpen} open={isDialogOpen}
title={t("deleteDialogTitle")} title={t("common.dialog.delete.title")}
content={t("deleteDialogDescription")} content={t("common.dialog.delete.description")}
onConfirm={handleConfirm} onConfirm={handleConfirm}
onCancel={handleCancel} onCancel={handleCancel}
loading={isDeleting} loading={isDeleting}
+25 -17
View File
@@ -16,6 +16,7 @@ import { usePatch } from "@/hooks/UseApi";
import type { IMonitor } from "@/types/monitor"; import type { IMonitor } from "@/types/monitor";
import type { ActionMenuItem } from "@/components/actions-menu"; import type { ActionMenuItem } from "@/components/actions-menu";
import type { ChartType } from "@/features/uiSlice";
export const MonitorTable = ({ export const MonitorTable = ({
monitors, monitors,
@@ -47,6 +48,9 @@ export const MonitorTable = ({
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
const navigate = useNavigate(); const navigate = useNavigate();
const chartType = useAppSelector(
(state) => state?.ui?.chartType || "heatmap"
);
const { const {
patch, patch,
// loading: isPatching, // loading: isPatching,
@@ -85,7 +89,7 @@ export const MonitorTable = ({
return [ return [
{ {
id: 1, id: 1,
label: "Open site", label: t("monitors.common.actions.openSite"),
action: () => { action: () => {
window.open(monitor.url, "_blank", "noreferrer"); window.open(monitor.url, "_blank", "noreferrer");
}, },
@@ -93,21 +97,21 @@ export const MonitorTable = ({
}, },
{ {
id: 2, id: 2,
label: "Details", label: t("monitors.common.actions.details"),
action: () => { action: () => {
navigate(`${monitor._id}`); navigate(`${monitor._id}`);
}, },
}, },
{ {
id: 3, id: 3,
label: "Incidents", label: t("monitors.common.actions.incidents"),
action: () => { action: () => {
navigate(`/incidents?monitorId=${monitor._id}`); navigate(`/incidents?monitorId=${monitor._id}`);
}, },
}, },
{ {
id: 4, id: 4,
label: "Configure", label: t("monitors.common.actions.configure"),
action: () => { action: () => {
navigate(`/uptime/${monitor._id}/configure`); navigate(`/uptime/${monitor._id}/configure`);
}, },
@@ -116,12 +120,15 @@ export const MonitorTable = ({
// id: 5, // id: 5,
// label: "Clone", // label: "Clone",
// action: () => { // action: () => {
// }, // },
// }, // },
{ {
id: 6, id: 6,
label: monitor.status === "paused" ? "Resume" : "Pause", label:
monitor.status === "paused"
? t("common.buttons.resume")
: t("common.buttons.pause"),
action: async () => { action: async () => {
await patch(`/monitors/${monitor._id}/active`); await patch(`/monitors/${monitor._id}/active`);
refetch(); refetch();
@@ -130,7 +137,11 @@ export const MonitorTable = ({
}, },
{ {
id: 7, id: 7,
label: <Typography color={theme.palette.error.main}>Remove</Typography>, label: (
<Typography color={theme.palette.error.main}>
{t("common.buttons.delete")}
</Typography>
),
action: () => { action: () => {
setSelectedMonitor(monitor); setSelectedMonitor(monitor);
}, },
@@ -139,10 +150,7 @@ export const MonitorTable = ({
]; ];
}; };
const getHeaders = () => { const getHeaders = (chartType: ChartType) => {
const chartType = useAppSelector(
(state) => state?.ui?.chartType || "heatmap"
);
const renderSortIcon = (isActive: boolean) => ( const renderSortIcon = (isActive: boolean) => (
<Box width={16} display="inline-flex" justifyContent="center"> <Box width={16} display="inline-flex" justifyContent="center">
{isActive ? ( {isActive ? (
@@ -165,7 +173,7 @@ export const MonitorTable = ({
onClick={(e) => handleSort(e, "name")} onClick={(e) => handleSort(e, "name")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("name")} {t("monitors.common.table.headers.name")}
{renderSortIcon(sortField === "name")} {renderSortIcon(sortField === "name")}
</Stack> </Stack>
), ),
@@ -185,7 +193,7 @@ export const MonitorTable = ({
onClick={(e) => handleSort(e, "status")} onClick={(e) => handleSort(e, "status")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("status")} {t("monitors.common.table.headers.status")}
{renderSortIcon(sortField === "status")} {renderSortIcon(sortField === "status")}
</Stack> </Stack>
), ),
@@ -195,7 +203,7 @@ export const MonitorTable = ({
}, },
{ {
id: "histogram", id: "histogram",
content: t("responseTime"), content: t("monitors.common.table.headers.responseTime"),
render: (row) => { render: (row) => {
if (chartType === "histogram") { if (chartType === "histogram") {
return <HistogramResponseTime checks={row.latestChecks} />; return <HistogramResponseTime checks={row.latestChecks} />;
@@ -215,7 +223,7 @@ export const MonitorTable = ({
onClick={(e) => handleSort(e, "type")} onClick={(e) => handleSort(e, "type")}
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
> >
{t("type")} {t("monitors.common.table.headers.type")}
{renderSortIcon(sortField === "type")} {renderSortIcon(sortField === "type")}
</Stack> </Stack>
), ),
@@ -225,7 +233,7 @@ export const MonitorTable = ({
}, },
{ {
id: "actions", id: "actions",
content: t("actions"), content: t("monitors.common.table.headers.actions"),
render: (row) => { render: (row) => {
return <ActionsMenu items={getActions(row)} />; return <ActionsMenu items={getActions(row)} />;
}, },
@@ -234,7 +242,7 @@ export const MonitorTable = ({
return headers; return headers;
}; };
const headers = getHeaders(); const headers = getHeaders(chartType);
return ( return (
<Box> <Box>