diff --git a/src/components/HealthCheckCredenza.tsx b/src/components/HealthCheckCredenza.tsx index 18ba63f6e..597be7c0b 100644 --- a/src/components/HealthCheckCredenza.tsx +++ b/src/components/HealthCheckCredenza.tsx @@ -186,6 +186,9 @@ export function HealthCheckCredenza(props: HealthCheckCredenzaProps) { defaultValues: mode === "submit" ? DEFAULT_VALUES : {} }); + const watchedEnabled = form.watch("hcEnabled"); + const watchedMode = form.watch("hcMode"); + useEffect(() => { if (!open) return; @@ -378,6 +381,8 @@ export function HealthCheckCredenza(props: HealthCheckCredenzaProps) { form={form} showNameField={mode === "submit"} hideEnabledField={mode === "submit"} + watchedEnabled={watchedEnabled} + watchedMode={watchedMode} onFieldChange={ mode === "autoSave" ? handleFieldChange diff --git a/src/components/HealthCheckFormFields.tsx b/src/components/HealthCheckFormFields.tsx index db98948db..249fb2e24 100644 --- a/src/components/HealthCheckFormFields.tsx +++ b/src/components/HealthCheckFormFields.tsx @@ -26,19 +26,21 @@ type HealthCheckFormFieldsProps = { onFieldChange?: (fieldName: string, value: any) => void; showNameField?: boolean; hideEnabledField?: boolean; + watchedEnabled?: boolean; + watchedMode?: string; }; export function HealthCheckFormFields({ form, onFieldChange, showNameField, - hideEnabledField + hideEnabledField, + watchedEnabled, + watchedMode }: HealthCheckFormFieldsProps) { const t = useTranslations(); - const watchedEnabled = form.watch("hcEnabled"); const showFields = hideEnabledField || watchedEnabled; - const watchedMode = form.watch("hcMode"); const handleChange = (fieldName: string, value: any, fieldOnChange: (v: any) => void) => { fieldOnChange(value); diff --git a/src/components/HealthChecksTable.tsx b/src/components/HealthChecksTable.tsx index 1238d9973..08de63927 100644 --- a/src/components/HealthChecksTable.tsx +++ b/src/components/HealthChecksTable.tsx @@ -22,7 +22,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query"; import { ArrowUpDown, MoreHorizontal } from "lucide-react"; import { useTranslations } from "next-intl"; import { useState } from "react"; - +import { Span } from "next/dist/trace"; type StandaloneHealthChecksTableProps = { orgId: string; @@ -57,12 +57,6 @@ const healthVariant: Record< unknown: "secondary" }; -function HealthBadge({ health }: { health: HealthCheckRow["hcHealth"] }) { - return ( - {healthLabel[health]} - ); -} - export default function HealthChecksTable({ orgId }: StandaloneHealthChecksTableProps) { @@ -146,7 +140,7 @@ export default function HealthChecksTable({ ), cell: ({ row }) => ( - {row.original.name} + {row.original.name} ) }, { @@ -156,7 +150,7 @@ export default function HealthChecksTable({ {t("standaloneHcColumnMode")} ), cell: ({ row }) => ( - + {row.original.hcMode?.toUpperCase() ?? "—"} ) @@ -167,11 +161,7 @@ export default function HealthChecksTable({ header: () => ( {t("standaloneHcColumnTarget")} ), - cell: ({ row }) => ( - - {formatTarget(row.original)} - - ) + cell: ({ row }) => {formatTarget(row.original)} }, { id: "health", @@ -179,9 +169,31 @@ export default function HealthChecksTable({ header: () => ( {t("standaloneHcColumnHealth")} ), - cell: ({ row }) => ( - - ) + cell: ({ row }) => { + const health = row.original.hcHealth; + if (health === "healthy") { + return ( + +
+ {healthLabel.healthy} +
+ ); + } else if (health === "unhealthy") { + return ( + +
+ {healthLabel.unhealthy} +
+ ); + } else { + return ( + +
+ {healthLabel.unknown} +
+ ); + } + } }, { accessorKey: "hcEnabled",