add link to docs for tcp/udp

This commit is contained in:
Milo Schwartz 2025-01-30 10:55:57 -05:00
parent 61e6fb3126
commit 1bad0c538b
No known key found for this signature in database

View file

@ -60,6 +60,8 @@ import {
SelectValue SelectValue
} from "@app/components/ui/select"; } from "@app/components/ui/select";
import { subdomainSchema } from "@server/schemas/subdomainSchema"; import { subdomainSchema } from "@server/schemas/subdomainSchema";
import Link from "next/link";
import { SquareArrowOutUpRight } from "lucide-react";
const createResourceFormSchema = z const createResourceFormSchema = z
.object({ .object({
@ -68,18 +70,23 @@ const createResourceFormSchema = z
siteId: z.number(), siteId: z.number(),
http: z.boolean(), http: z.boolean(),
protocol: z.string(), protocol: z.string(),
proxyPort: z.number().optional(), proxyPort: z.number().optional()
}) })
.refine( .refine(
(data) => { (data) => {
if (!data.http) { if (!data.http) {
return z.number().int().min(1).max(65535).safeParse(data.proxyPort).success; return z
.number()
.int()
.min(1)
.max(65535)
.safeParse(data.proxyPort).success;
} }
return true; return true;
}, },
{ {
message: "Invalid port number", message: "Invalid port number",
path: ["proxyPort"], path: ["proxyPort"]
} }
) )
.refine( .refine(
@ -91,7 +98,7 @@ const createResourceFormSchema = z
}, },
{ {
message: "Invalid subdomain", message: "Invalid subdomain",
path: ["subdomain"], path: ["subdomain"]
} }
); );
@ -295,6 +302,20 @@ export default function CreateResourceForm({
/> />
)} )}
{!form.watch("http") && (
<Link
className="text-sm text-primary flex items-center gap-1"
href="https://docs.fossorial.io/Getting%20Started/tcp-udp"
target="_blank"
rel="noopener noreferrer"
>
<span>
Learn how to use set up TCP/UDP resources
</span>
<SquareArrowOutUpRight size={14} />
</Link>
)}
{!form.watch("http") && ( {!form.watch("http") && (
<> <>
<FormField <FormField