From 0263c17618b96ffa89f96c5b2ce45af1b5a6bd61 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 30 Jan 2026 19:54:44 +0000 Subject: [PATCH] advance dmatching section --- client/src/Pages/CreateMonitor/index.tsx | 102 +++++++++++++++++++++-- client/src/locales/en.json | 17 ++++ 2 files changed, 112 insertions(+), 7 deletions(-) diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx index 6c7aa1768..313b744cd 100644 --- a/client/src/Pages/CreateMonitor/index.tsx +++ b/client/src/Pages/CreateMonitor/index.tsx @@ -1,5 +1,5 @@ import { useMemo } from "react"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useParams, useLocation, useNavigate } from "react-router"; import { useForm, Controller } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -12,6 +12,7 @@ import MenuItem from "@mui/material/MenuItem"; import Typography from "@mui/material/Typography"; import Divider from "@mui/material/Divider"; import IconButton from "@mui/material/IconButton"; +import FormControlLabel from "@mui/material/FormControlLabel"; import { Trash2 } from "lucide-react"; import { BasePage, ConfigBox } from "@/Components/v2/design-elements"; @@ -23,6 +24,7 @@ import { Autocomplete, SwitchComponent as Switch, SliderWithLabel, + Checkbox, } from "@/Components/v2/inputs"; import { useGet, usePost, usePatch } from "@/Hooks/UseApi"; import { useMonitorForm } from "@/Hooks/useMonitorForm"; @@ -130,7 +132,12 @@ const CreateMonitorPage = () => { }, [location.pathname]); const showTypeSelector = pageType === "uptime" && !isEditMode; - const defaultType: MonitorType = pageType === "pagespeed" ? "pagespeed" : pageType === "hardware" ? "hardware" : "http"; + const defaultType: MonitorType = + pageType === "pagespeed" + ? "pagespeed" + : pageType === "hardware" + ? "hardware" + : "http"; const { data: existingMonitor } = useGet( isEditMode ? `/monitors/${monitorId}` : null @@ -139,7 +146,10 @@ const CreateMonitorPage = () => { // Fetch notifications for the team const { data: notifications } = useGet("/notifications/team"); - const { schema, defaults } = useMonitorForm({ data: existingMonitor ?? null, defaultType }); + const { schema, defaults } = useMonitorForm({ + data: existingMonitor ?? null, + defaultType, + }); const form = useForm({ resolver: zodResolver(schema), @@ -153,6 +163,8 @@ const CreateMonitorPage = () => { const watchedType = watch("type") as MonitorType; + const [showAdvancedSettings, setShowAdvancedSettings] = useState(false); + useEffect(() => { clearErrors(); }, [watchedType, clearErrors]); @@ -213,12 +225,16 @@ const CreateMonitorPage = () => { { @@ -523,6 +543,74 @@ const CreateMonitorPage = () => { /> )} + {/* Advanced Settings ConfigBox - only for HTTP monitors */} + {watchedType === "http" && ( + + setShowAdvancedSettings(e.target.checked)} + /> + } + label={t("advancedMatching")} + /> + {showAdvancedSettings && ( + + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> + + )} + + } + /> + )} + {/* Submit Button */}