diff --git a/client/package-lock.json b/client/package-lock.json
index 7d6350f45..7cf0e8631 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -26,6 +26,7 @@
"i18next": "25.4.2",
"joi": "17.13.3",
"mui-color-input": "^6.0.0",
+ "pretty-ms": "9.3.0",
"react": "18.3.1",
"react-dom": "^18.2.0",
"react-hook-form": "7.63.0",
@@ -5184,6 +5185,18 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/parse-ms": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-4.0.0.tgz",
+ "integrity": "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -5311,6 +5324,21 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
+ "node_modules/pretty-ms": {
+ "version": "9.3.0",
+ "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.3.0.tgz",
+ "integrity": "sha512-gjVS5hOP+M3wMm5nmNOucbIrqudzs9v/57bWRHQWLYklXqoXKrVfYW2W9+glfGsqtPgpiz5WwyEEB+ksXIx3gQ==",
+ "license": "MIT",
+ "dependencies": {
+ "parse-ms": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
diff --git a/client/package.json b/client/package.json
index 6d4858027..71f088909 100644
--- a/client/package.json
+++ b/client/package.json
@@ -31,6 +31,7 @@
"i18next": "25.4.2",
"joi": "17.13.3",
"mui-color-input": "^6.0.0",
+ "pretty-ms": "9.3.0",
"react": "18.3.1",
"react-dom": "^18.2.0",
"react-hook-form": "7.63.0",
diff --git a/client/src/Components/v2/DesignElements/Dot.tsx b/client/src/Components/v2/DesignElements/Dot.tsx
new file mode 100644
index 000000000..ca3884cfb
--- /dev/null
+++ b/client/src/Components/v2/DesignElements/Dot.tsx
@@ -0,0 +1,23 @@
+export const Dot = ({
+ color = "gray",
+ size = "4px",
+ style,
+}: {
+ color?: string;
+ size?: string;
+ style?: React.CSSProperties;
+}) => {
+ return (
+
+ );
+};
diff --git a/client/src/Components/v2/DesignElements/PulseDot.tsx b/client/src/Components/v2/DesignElements/PulseDot.tsx
new file mode 100644
index 000000000..a785b5a0d
--- /dev/null
+++ b/client/src/Components/v2/DesignElements/PulseDot.tsx
@@ -0,0 +1,44 @@
+import Stack from "@mui/material/Stack";
+import Box from "@mui/material/Box";
+import { useTheme } from "@mui/material/styles";
+export const PulseDot = ({ color }: { color: string }) => {
+ const theme = useTheme();
+ return (
+
+
+
+ );
+};
diff --git a/client/src/Components/v2/Inputs/ButtonGroup.tsx b/client/src/Components/v2/Inputs/ButtonGroup.tsx
new file mode 100644
index 000000000..6dde0cb3f
--- /dev/null
+++ b/client/src/Components/v2/Inputs/ButtonGroup.tsx
@@ -0,0 +1,27 @@
+import { useTheme } from "@mui/material/styles";
+import ButtonGroup from "@mui/material/ButtonGroup";
+import type { ButtonGroupProps } from "@mui/material/ButtonGroup";
+export const ButtonGroupInput: React.FC = ({
+ orientation,
+ ...props
+}) => {
+ const theme = useTheme();
+
+ return (
+
+ );
+};
diff --git a/client/src/Components/v2/Inputs/index.tsx b/client/src/Components/v2/Inputs/index.tsx
index 9b582f3d7..5f3eb2810 100644
--- a/client/src/Components/v2/Inputs/index.tsx
+++ b/client/src/Components/v2/Inputs/index.tsx
@@ -1 +1,2 @@
export { ButtonInput as Button } from "./Button";
+export { ButtonGroupInput as ButtonGroup } from "./ButtonGroup";
diff --git a/client/src/Components/v2/Monitors/HeaderControls.tsx b/client/src/Components/v2/Monitors/HeaderControls.tsx
new file mode 100644
index 000000000..f7dfcf7c8
--- /dev/null
+++ b/client/src/Components/v2/Monitors/HeaderControls.tsx
@@ -0,0 +1,67 @@
+import Stack from "@mui/material/Stack";
+import { MonitorStatus } from "@/Components/v2/Monitors/MonitorStatus";
+import { ButtonGroup, Button } from "@/Components/v2/Inputs";
+import Tooltip from "@mui/material/Tooltip";
+import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
+import PauseOutlinedIcon from "@mui/icons-material/PauseOutlined";
+import PlayArrowOutlinedIcon from "@mui/icons-material/PlayArrowOutlined";
+import EmailIcon from "@mui/icons-material/Email";
+import BugReportOutlinedIcon from "@mui/icons-material/BugReportOutlined";
+
+import { useMediaQuery } from "@mui/material";
+import { useTranslation } from "react-i18next";
+import { useTheme } from "@mui/material/styles";
+
+import type { IMonitor } from "@/Types/Monitor";
+
+export const HeaderControls = ({
+ monitor,
+ patch,
+ isPatching,
+ refetch,
+}: {
+ monitor: IMonitor;
+ patch: Function;
+ isPatching: boolean;
+ refetch: Function;
+}) => {
+ const { t } = useTranslation();
+ const theme = useTheme();
+ const isSmall = useMediaQuery(theme.breakpoints.down("md"));
+
+ return (
+
+
+
+
+ }>{t("sendTestNotifications")}
+ }>{t("menu.incidents")}
+
+ }>{t("configure")}
+
+
+
+ );
+};
diff --git a/client/src/Components/v2/Monitors/MonitorStatus.tsx b/client/src/Components/v2/Monitors/MonitorStatus.tsx
new file mode 100644
index 000000000..ff4d83352
--- /dev/null
+++ b/client/src/Components/v2/Monitors/MonitorStatus.tsx
@@ -0,0 +1,60 @@
+import type { IMonitor } from "@/Types/Monitor";
+import Stack from "@mui/material/Stack";
+import Typography from "@mui/material/Typography";
+import { PulseDot } from "@/Components/v2/DesignElements/PulseDot";
+import { Dot } from "@/Components/v2/DesignElements/Dot";
+import { getStatusColor, formatUrl } from "@/Utils/MonitorUtils";
+import { useTheme } from "@mui/material/styles";
+import prettyMilliseconds from "pretty-ms";
+import { typographyLevels } from "@/Utils/Theme/v2/palette";
+import { useMediaQuery } from "@mui/material";
+export const MonitorStatus = ({ monitor }: { monitor: IMonitor }) => {
+ const theme = useTheme();
+ const isSmall = useMediaQuery(theme.breakpoints.down("md"));
+
+ if (!monitor) {
+ return null;
+ }
+ return (
+
+
+ {monitor.name}
+
+
+
+
+ {formatUrl(monitor?.url)}
+
+ {!isSmall && (
+ <>
+
+
+ Checking every {prettyMilliseconds(monitor?.interval, { verbose: true })}
+
+ >
+ )}
+
+
+ );
+};
diff --git a/client/src/Hooks/v2/UseApi.tsx b/client/src/Hooks/v2/UseApi.tsx
index eab661793..e588c98c5 100644
--- a/client/src/Hooks/v2/UseApi.tsx
+++ b/client/src/Hooks/v2/UseApi.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import useSWR from "swr";
import type { SWRConfiguration } from "swr";
import type { AxiosRequestConfig } from "axios";
-import { get, post } from "@/Utils/ApiClient"; // your axios wrapper
+import { get, post, patch } from "@/Utils/ApiClient"; // your axios wrapper
export type ApiResponse = {
message: string;
@@ -56,3 +56,26 @@ export const usePost = (endpoint: string) => {
return { post: postFn, loading, error };
};
+
+export const usePatch = (endpoint: string) => {
+ const [loading, setLoading] = useState(false);
+ const [error, setError] = useState(null);
+
+ const patchFn = async (body: B, config?: AxiosRequestConfig): Promise => {
+ setLoading(true);
+ setError(null);
+
+ try {
+ const res = await patch(endpoint, body, config);
+ return res.data;
+ } catch (err: any) {
+ const errMsg = err?.response?.data?.msg || err.message || "An error occurred";
+ setError(errMsg);
+ return null;
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return { patch: patchFn, loading, error };
+};
diff --git a/client/src/Pages/v2/Uptime/Create.tsx b/client/src/Pages/v2/Uptime/Create.tsx
index 3aa73b5fb..cb8df803d 100644
--- a/client/src/Pages/v2/Uptime/Create.tsx
+++ b/client/src/Pages/v2/Uptime/Create.tsx
@@ -19,7 +19,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useGet, usePost } from "@/Hooks/v2/UseApi";
import type { ApiResponse } from "@/Hooks/v2/UseApi";
-const CreateUptimePage = () => {
+const UptimeCreatePage = () => {
const { t } = useTranslation();
const theme = useTheme();
@@ -259,4 +259,4 @@ const CreateUptimePage = () => {
);
};
-export default CreateUptimePage;
+export default UptimeCreatePage;
diff --git a/client/src/Pages/v2/Uptime/Details.tsx b/client/src/Pages/v2/Uptime/Details.tsx
new file mode 100644
index 000000000..5f743913a
--- /dev/null
+++ b/client/src/Pages/v2/Uptime/Details.tsx
@@ -0,0 +1,39 @@
+import { BasePage } from "@/Components/v2/DesignElements";
+import { HeaderControls } from "@/Components/v2/Monitors/HeaderControls";
+
+import { useParams } from "react-router";
+import { useGet, usePatch, type ApiResponse } from "@/Hooks/v2/UseApi";
+import { useState } from "react";
+const UptimeDetailsPage = () => {
+ const { id } = useParams();
+
+ // Local state
+ const [range, setRange] = useState("30m");
+
+ const { response, loading, error, refetch } = useGet(
+ `/monitors/${id}?range=${range}`
+ );
+ const {
+ patch,
+ loading: isPatching,
+ error: postError,
+ } = usePatch(`/monitors/${id}/active`);
+
+ const monitor = response?.data || null;
+ if (!monitor) {
+ return null;
+ }
+
+ return (
+
+
+
+ );
+};
+
+export default UptimeDetailsPage;
diff --git a/client/src/Pages/v2/Uptime/MonitorTable.tsx b/client/src/Pages/v2/Uptime/MonitorTable.tsx
index 93ae498f9..488533d8a 100644
--- a/client/src/Pages/v2/Uptime/MonitorTable.tsx
+++ b/client/src/Pages/v2/Uptime/MonitorTable.tsx
@@ -1,16 +1,22 @@
import Stack from "@mui/material/Stack";
+import Typography from "@mui/material/Typography";
+import { Table } from "@/Components/v2/DesignElements";
import { HistogramResponseTime } from "@/Components/v2/Monitors/HistogramResponseTime";
import type { Header } from "@/Components/v2/DesignElements/Table";
-import type { IMonitor } from "@/Types/Monitor";
-import { Table } from "@/Components/v2/DesignElements";
+import { ActionsMenu } from "@/Components/v2/ActionsMenu";
+
import { useTranslation } from "react-i18next";
import { useMediaQuery } from "@mui/material";
import { useTheme } from "@mui/material/styles";
-import { ActionsMenu } from "@/Components/v2/ActionsMenu";
-import type { ActionMenuItem } from "@/Components/v2/ActionsMenu";
-import Typography from "@mui/material/Typography";
+import { useNavigate } from "react-router-dom";
-const getActions = (theme: any): ActionMenuItem[] => {
+import type { IMonitor } from "@/Types/Monitor";
+import type { ActionMenuItem } from "@/Components/v2/ActionsMenu";
+const getActions = (
+ theme: any,
+ monitor: IMonitor,
+ navigate: Function
+): ActionMenuItem[] => {
return [
{
id: 1,
@@ -24,7 +30,7 @@ const getActions = (theme: any): ActionMenuItem[] => {
id: 2,
label: "Details",
action: () => {
- console.log("Open details");
+ navigate(`${monitor._id}`);
},
},
{
@@ -67,7 +73,7 @@ const getActions = (theme: any): ActionMenuItem[] => {
];
};
-const getHeaders = (theme: any, t: Function) => {
+const getHeaders = (theme: any, t: Function, navigate: Function) => {
const headers: Header[] = [
{
id: "name",
@@ -104,8 +110,8 @@ const getHeaders = (theme: any, t: Function) => {
{
id: "actions",
content: t("actions"),
- render: () => {
- return ;
+ render: (row) => {
+ return ;
},
},
];
@@ -116,8 +122,9 @@ export const MonitorTable = ({ monitors }: { monitors: IMonitor[] }) => {
const { t } = useTranslation();
const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
+ const navigate = useNavigate();
- let headers = getHeaders(theme, t);
+ let headers = getHeaders(theme, t, navigate);
if (isSmall) {
headers = headers.filter((h) => h.id !== "histogram");
diff --git a/client/src/Routes/v2router.tsx b/client/src/Routes/v2router.tsx
index 742302762..0e53deead 100644
--- a/client/src/Routes/v2router.tsx
+++ b/client/src/Routes/v2router.tsx
@@ -5,7 +5,8 @@ import { lightTheme, darkTheme } from "@/Utils/Theme/v2/theme";
import AuthLoginV2 from "@/Pages/v2/Auth/Login";
import AuthRegisterV2 from "@/Pages/v2/Auth/Register";
import UptimeMonitorsPage from "@/Pages/v2/Uptime/UptimeMonitors";
-import CreateUptimePage from "@/Pages/v2/Uptime/Create";
+import UptimeCreatePage from "@/Pages/v2/Uptime/Create";
+import UptimeDetailsPage from "@/Pages/v2/Uptime/Details";
import RootLayout from "@/Components/v2/Layouts/RootLayout";
const V2Routes = ({ mode = "light" }) => {
@@ -34,9 +35,13 @@ const V2Routes = ({ mode = "light" }) => {
path="uptime"
element={}
/>
+ }
+ />
}
+ element={}
/>
diff --git a/client/src/Types/Monitor.ts b/client/src/Types/Monitor.ts
index 8ceb4d009..05f7d7d6f 100644
--- a/client/src/Types/Monitor.ts
+++ b/client/src/Types/Monitor.ts
@@ -1,4 +1,5 @@
import type { Check } from "@/Types/Check";
+export type MonitorStatus = "up" | "down" | "initializing";
export interface IMonitor {
checks: Check[];
@@ -9,7 +10,7 @@ export interface IMonitor {
latestChecks: Check[];
n: number;
name: string;
- status: string;
+ status: MonitorStatus;
type: string;
updatedAt: string;
updatedBy: string;
diff --git a/client/src/Utils/ApiClient.ts b/client/src/Utils/ApiClient.ts
index a44c35905..4f41efe2d 100644
--- a/client/src/Utils/ApiClient.ts
+++ b/client/src/Utils/ApiClient.ts
@@ -18,4 +18,10 @@ export const post = (
config: AxiosRequestConfig = {}
): Promise> => api.post(url, data, config);
+export const patch = (
+ url: string,
+ data: any,
+ config: AxiosRequestConfig = {}
+): Promise> => api.patch(url, data, config);
+
export default api;
diff --git a/client/src/Utils/MonitorUtils.ts b/client/src/Utils/MonitorUtils.ts
new file mode 100644
index 000000000..92afa8371
--- /dev/null
+++ b/client/src/Utils/MonitorUtils.ts
@@ -0,0 +1,19 @@
+import type { MonitorStatus } from "@/Types/Monitor";
+
+export const getStatusColor = (status: MonitorStatus, theme: any): string => {
+ const statusColors: Record = {
+ up: theme.palette.success.lowContrast,
+ down: theme.palette.error.lowContrast,
+ initializing: theme.palette.warning.lowContrast,
+ };
+ return statusColors[status];
+};
+
+export const formatUrl = (url: string, maxLength: number = 55) => {
+ if (!url) return "";
+
+ const strippedUrl = url.replace(/^https?:\/\//, "");
+ return strippedUrl.length > maxLength
+ ? `${strippedUrl.slice(0, maxLength)}…`
+ : strippedUrl;
+};