diff --git a/app/client/modules/repositories/components/create-repository-form.tsx b/app/client/modules/repositories/components/create-repository-form.tsx index 08fa6e0..01a2d27 100644 --- a/app/client/modules/repositories/components/create-repository-form.tsx +++ b/app/client/modules/repositories/components/create-repository-form.tsx @@ -72,6 +72,7 @@ export const CreateRepositoryForm = ({ const form = useForm({ resolver: arktypeResolver(cleanSchema as unknown as typeof formSchema), defaultValues: initialValues, + mode: "onTouched", resetOptions: { keepDefaultValues: true, keepDirtyValues: false, diff --git a/app/client/modules/repositories/components/repository-forms/rest-repository-form.tsx b/app/client/modules/repositories/components/repository-forms/rest-repository-form.tsx index e99e44e..d0ff839 100644 --- a/app/client/modules/repositories/components/repository-forms/rest-repository-form.tsx +++ b/app/client/modules/repositories/components/repository-forms/rest-repository-form.tsx @@ -1,3 +1,4 @@ +import { useState, useRef } from "react"; import type { UseFormReturn } from "react-hook-form"; import { FormControl, @@ -11,6 +12,7 @@ import { Input } from "../../../../components/ui/input"; import { SecretInput } from "../../../../components/ui/secret-input"; import { Textarea } from "../../../../components/ui/textarea"; import { Checkbox } from "../../../../components/ui/checkbox"; +import { Tooltip, TooltipContent, TooltipTrigger } from "../../../../components/ui/tooltip"; import type { RepositoryFormValues } from "../create-repository-form"; type Props = { @@ -18,6 +20,13 @@ type Props = { }; export const RestRepositoryForm = ({ form }: Props) => { + const insecureTls = form.watch("insecureTls"); + const cacert = form.watch("cacert"); + const [showCertTooltip, setShowCertTooltip] = useState(false); + const [tooltipPos, setTooltipPos] = useState({ x: 0, y: 0 }); + const tooltipTimeoutRef = useRef(null); + const tooltipHideTimeoutRef = useRef(null); + return ( <> { )} /> + ( + + + + +
+ { + field.onChange(checked); + if (checked) { + form.setValue("cacert", ""); + } + }} + /> +
+
+ {cacert && ( + +

+ This option is disabled because a CA certificate is provided. Remove the CA certificate to skip + TLS validation instead. +

+
+ )} +
+
+
+ Skip TLS Certificate Verification + + Disable TLS certificate verification if rest server is https and uses a self-signed certificate. This is + insecure and should only be used for testing. + +
+
+ )} + /> + ( + + CA Certificate (Optional) + +
+