From e9a29e7db21db164e48d68ed94e986d684853aef Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Sun, 21 Dec 2025 16:07:32 -0500 Subject: [PATCH] improvements to create private resource modal --- messages/en-US.json | 3 +- .../CreateInternalResourceDialog.tsx | 32 +++---------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index a031cda6..2684646f 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -2391,5 +2391,6 @@ "maintenanceModeDisabledTooltip": "This feature requires a valid license to enable.", "maintenanceScreenTitle": "Service Temporarily Unavailable", "maintenanceScreenMessage": "We are currently experiencing technical difficulties. Please check back soon.", - "maintenanceScreenEstimatedCompletion": "Estimated Completion:" + "maintenanceScreenEstimatedCompletion": "Estimated Completion:", + "createInternalResourceDialogDestinationRequired": "Destination is required" } diff --git a/src/components/CreateInternalResourceDialog.tsx b/src/components/CreateInternalResourceDialog.tsx index 9fe5ba8e..74e936f6 100644 --- a/src/components/CreateInternalResourceDialog.tsx +++ b/src/components/CreateInternalResourceDialog.tsx @@ -170,7 +170,9 @@ export default function CreateInternalResourceDialog({ mode: z.enum(["host", "cidr"]), // protocol: z.enum(["tcp", "udp"]).nullish(), // proxyPort: z.int().positive().min(1, t("createInternalResourceDialogProxyPortMin")).max(65535, t("createInternalResourceDialogProxyPortMax")).nullish(), - destination: z.string().min(1), + destination: z.string().min(1, { + message: t("createInternalResourceDialogDestinationRequired") + }), // destinationPort: z.int().positive().min(1, t("createInternalResourceDialogDestinationPortMin")).max(65535, t("createInternalResourceDialogDestinationPortMax")).nullish(), alias: z.string().nullish(), tcpPortRangeString: createPortRangeStringSchema(t), @@ -341,10 +343,10 @@ export default function CreateInternalResourceDialog({ }; useEffect(() => { - if (open && availableSites.length > 0) { + if (open) { form.reset({ name: "", - siteId: availableSites[0].siteId, + siteId: availableSites[0]?.siteId || 0, mode: "host", // protocol: "tcp", // proxyPort: undefined, @@ -467,30 +469,6 @@ export default function CreateInternalResourceDialog({ } }; - if (availableSites.length === 0) { - return ( - - - - - {t("createInternalResourceDialogNoSitesAvailable")} - - - {t( - "createInternalResourceDialogNoSitesAvailableDescription" - )} - - - - - - - - ); - } - return (