From 8e16ff07a9b6c25785c966f59acfad7c26213391 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Sat, 25 Apr 2026 15:23:22 -0700 Subject: [PATCH] move switch toggle above tabs on health check dialog --- messages/en-US.json | 1 + src/components/HealthCheckCredenza.tsx | 239 +++++++++++++------------ 2 files changed, 121 insertions(+), 119 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index 5492768f1..13b47d135 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1903,6 +1903,7 @@ "configureHealthCheck": "Configure Health Check", "configureHealthCheckDescription": "Set up health monitoring for {target}", "enableHealthChecks": "Enable Health Checks", + "healthCheckDisabledStateDescription": "When disabled, the site will not perform health checks and the state will be considered unknown.", "enableHealthChecksDescription": "Monitor the health of this target. You can monitor a different endpoint than the target if required.", "healthScheme": "Method", "healthSelectScheme": "Select Method", diff --git a/src/components/HealthCheckCredenza.tsx b/src/components/HealthCheckCredenza.tsx index 671a16e7d..c5ab59064 100644 --- a/src/components/HealthCheckCredenza.tsx +++ b/src/components/HealthCheckCredenza.tsx @@ -46,6 +46,7 @@ import { SitesSelector } from "@app/components/site-selector"; import type { Selectedsite } from "@app/components/site-selector"; import { CaretSortIcon } from "@radix-ui/react-icons"; import { cn } from "@app/lib/cn"; +import { SwitchInput } from "@app/components/SwitchInput"; export type HealthCheckConfig = { hcEnabled: boolean; @@ -407,7 +408,7 @@ export function HealthCheckCredenza(props: HealthCheckCredenzaProps) { }) : t("standaloneHcDescription"); - const showFields = mode === "submit" || watchedEnabled; + const disableTabInputs = mode === "autoSave" && !watchedEnabled; const isSnmpOrIcmp = watchedMode === "snmp" || watchedMode === "icmp"; const isTcp = watchedMode === "tcp"; @@ -491,6 +492,40 @@ export function HealthCheckCredenza(props: HealthCheckCredenzaProps) { )} + {mode === "autoSave" && ( +
+ ( + + + + handleChange( + "hcEnabled", + value, + field.onChange + ) + } + /> + + + )} + /> +
+ )} +
{/* ── Strategy tab ──────────────────────── */} -
- {/* Enable toggle (autoSave mode only) */} - {mode === "autoSave" && ( - ( - -
- - {t( - "enableHealthChecks" - )} - -
- - - handleChange( - "hcEnabled", - value, - field.onChange - ) - } - /> - -
- )} - /> - )} - +
+
{/* Strategy picker */} - {showFields && ( - ( - - - - handleChange( - "hcMode", - value, - field.onChange + ( + + + - - - - )} - /> - )} + ]} + value={field.value} + onChange={(value) => + handleChange( + "hcMode", + value, + field.onChange + ) + } + /> + + + + )} + /> +
{/* ── Connection tab ────────────────────── */} -
- {!showFields && ( -

- {t("enableHealthChecks")} -

- )} - +
+
{/* Contact-sales banner for SNMP / ICMP */} - {showFields && isSnmpOrIcmp && ( - - )} + {isSnmpOrIcmp && } - {showFields && !isSnmpOrIcmp && ( + {!isSnmpOrIcmp && ( <> {/* Scheme / Hostname / Port */} {isTcp ? ( @@ -1021,22 +1020,23 @@ export function HealthCheckCredenza(props: HealthCheckCredenzaProps) { )} )} +
{/* ── Advanced tab ──────────────────────── */} -
- {!showFields && ( -

- {t("enableHealthChecks")} -

- )} - +
+
{/* Contact-sales banner for SNMP / ICMP */} - {showFields && isSnmpOrIcmp && ( - - )} + {isSnmpOrIcmp && } - {showFields && !isSnmpOrIcmp && ( + {!isSnmpOrIcmp && ( <> {/* Healthy interval + threshold */}
@@ -1350,6 +1350,7 @@ export function HealthCheckCredenza(props: HealthCheckCredenzaProps) { )} )} +