diff --git a/application/src/components/services/add-service/ServiceConfigFields.tsx b/application/src/components/services/add-service/ServiceConfigFields.tsx index d172f5e..7145df3 100644 --- a/application/src/components/services/add-service/ServiceConfigFields.tsx +++ b/application/src/components/services/add-service/ServiceConfigFields.tsx @@ -1,49 +1,119 @@ -import { FormControl, FormField, FormItem, FormLabel } from "@/components/ui/form"; +import { FormControl, FormField, FormItem, FormLabel, FormMessage, FormDescription } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { UseFormReturn } from "react-hook-form"; import { ServiceFormData } from "./types"; +import { ServiceUrlField } from "./ServiceUrlField"; +import { useState } from "react"; interface ServiceConfigFieldsProps { form: UseFormReturn; } export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) { + const [isCustomInterval, setIsCustomInterval] = useState(false); + const intervalValue = form.watch("interval"); + + const handleIntervalChange = (value: string) => { + if (value === "custom") { + setIsCustomInterval(true); + form.setValue("interval", ""); + } else { + setIsCustomInterval(false); + form.setValue("interval", value); + } + }; + return ( - <> - ( - - Heartbeat Interval - - - - - )} - /> - - ( - - Maximum Retries - - - - - )} - /> - +
+ + +
+ ( + + Check Interval + {!isCustomInterval ? ( + + + + ) : ( +
+ + + + +
+ )} + + {isCustomInterval + ? "Enter custom interval in seconds (minimum 10 seconds)" + : "How often to check the service status" + } + + +
+ )} + /> + + ( + + Retry Attempts + + + + + Number of retry attempts before marking as down + + + + )} + /> +
+
); } \ No newline at end of file