diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx index 465b9d15d..96b05be71 100644 --- a/client/src/Pages/CreateMonitor/index.tsx +++ b/client/src/Pages/CreateMonitor/index.tsx @@ -42,8 +42,11 @@ import { type Monitor, type MonitorType, type GamesMap, + type HttpMethod, supportsGeoCheck, DefaultPageSpeedStrategy, + DefaultHttpMethod, + HttpMethods, } from "@/Types/Monitor"; import type { Notification } from "@/Types/Notification"; import type { Tag } from "@/Types/Tag"; @@ -259,7 +262,7 @@ const CreateMonitorPage = () => { resolver: zodResolver(schema), defaultValues: defaults, }); - const { control, watch, handleSubmit, clearErrors, trigger, reset } = form; + const { control, watch, handleSubmit, clearErrors, trigger, reset, setValue } = form; useEffect(() => { reset(defaults); @@ -271,6 +274,7 @@ const CreateMonitorPage = () => { const showStep = (step: number) => isEditMode || currentStep === step; const watchedType = watch("type") as MonitorType; + const watchedMethod = watch("method") as HttpMethod | undefined; const watchedUseAdvancedMatching = watch("useAdvancedMatching") as boolean; const watchGeoCheckEnabled = watch("geoCheckEnabled") as boolean; @@ -1091,6 +1095,50 @@ const CreateMonitorPage = () => { subtitle={t("pages.createMonitor.form.advanced.description")} rightContent={ + ( + + + + {t( + `pages.createMonitor.form.advanced.option.method.description.${field.value ?? DefaultHttpMethod}` + )} + + + )} + /> { ); }} /> - ( - - field.onChange(e.target.checked)} - /> - - {t( - "pages.createMonitor.form.advanced.option.advancedMatching.label" - )} - - - )} - /> - {watchedUseAdvancedMatching && ( + {watchedMethod !== "HEAD" && ( + ( + + field.onChange(e.target.checked)} + /> + + {t( + "pages.createMonitor.form.advanced.option.advancedMatching.label" + )} + + + )} + /> + )} + {watchedUseAdvancedMatching && watchedMethod !== "HEAD" && ( ), render: (row) => { - return row.type; + return row.type === "http" && row.method + ? `${row.type} (${row.method})` + : row.type; }, }, { diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 6e65aea62..2e6c7db2c 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -490,6 +490,13 @@ "advanced": { "description": "Optional settings for advanced use cases", "option": { + "method": { + "label": "Request method", + "description": { + "GET": "GET fetches the full response including the body. Advanced matching fully supported", + "HEAD": "HEAD fetches only response headers for reducing load on the target. Supports status code matching but not advanced matching as there is no body." + } + }, "advancedMatching": { "label": "Use advanced matching" },