From 80aa7502af1abeffdd52d1ec0691b3792713d5d2 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Mon, 28 Jul 2025 12:52:44 -0700 Subject: [PATCH] fix resource domain not required --- messages/en-US.json | 4 +-- .../resources/[resourceId]/general/page.tsx | 1 + .../settings/resources/create/page.tsx | 10 +++--- src/app/navigation.tsx | 2 +- src/components/DomainPicker.tsx | 33 ++++++++++--------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index 4ff1b866..e69e2b46 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1093,7 +1093,7 @@ "sidebarAllUsers": "All Users", "sidebarIdentityProviders": "Identity Providers", "sidebarLicense": "License", - "sidebarClients": "Clients (beta)", + "sidebarClients": "Clients (Beta)", "sidebarDomains": "Domains", "enableDockerSocket": "Enable Docker Socket", "enableDockerSocketDescription": "Enable Docker Socket discovery for populating container information. Socket path must be provided to Newt.", @@ -1319,4 +1319,4 @@ "resourceEnableProxy": "Enable Public Proxy", "resourceEnableProxyDescription": "Enable public proxying to this resource. This allows access to the resource from outside the network through the cloud on an open port. Requires Traefik config.", "externalProxyEnabled": "External Proxy Enabled" -} \ No newline at end of file +} diff --git a/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx index 266911a6..68cc02cc 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx @@ -636,6 +636,7 @@ export default function GeneralForm() { { const selected = { domainId: res.domainId, diff --git a/src/app/[orgId]/settings/resources/create/page.tsx b/src/app/[orgId]/settings/resources/create/page.tsx index a916a700..fc90d26c 100644 --- a/src/app/[orgId]/settings/resources/create/page.tsx +++ b/src/app/[orgId]/settings/resources/create/page.tsx @@ -74,7 +74,7 @@ const baseResourceFormSchema = z.object({ }); const httpResourceFormSchema = z.object({ - domainId: z.string().optional(), + domainId: z.string().nonempty(), subdomain: z.string().optional() }); @@ -277,9 +277,9 @@ export default function Page() { if (res?.status === 200) { const domains = res.data.data.domains; setBaseDomains(domains); - if (domains.length) { - httpForm.setValue("domainId", domains[0].domainId); - } + // if (domains.length) { + // httpForm.setValue("domainId", domains[0].domainId); + // } } }; @@ -684,6 +684,8 @@ export default function Page() { ? await httpForm.trigger() : await tcpUdpForm.trigger(); + console.log(httpForm.getValues()); + if (baseValid && settingsValid) { onSubmit(); } diff --git a/src/app/navigation.tsx b/src/app/navigation.tsx index 9901ee2f..b26b98ec 100644 --- a/src/app/navigation.tsx +++ b/src/app/navigation.tsx @@ -134,4 +134,4 @@ export const adminNavSections: SidebarNavSection[] = [ : []) ] } -]; \ No newline at end of file +]; diff --git a/src/components/DomainPicker.tsx b/src/components/DomainPicker.tsx index 1b96ec8e..28dbcdbd 100644 --- a/src/components/DomainPicker.tsx +++ b/src/components/DomainPicker.tsx @@ -49,6 +49,7 @@ type DomainOption = { interface DomainPickerProps { orgId: string; + cols?: number; onDomainChange?: (domainInfo: { domainId: string; domainNamespaceId?: string; @@ -61,6 +62,7 @@ interface DomainPickerProps { export default function DomainPicker({ orgId, + cols, onDomainChange }: DomainPickerProps) { const { env } = useEnvContext(); @@ -309,6 +311,7 @@ export default function DomainPicker({ { // Only allow letters, numbers, hyphens, and periods const validInput = e.target.value.replace( @@ -393,23 +396,25 @@ export default function DomainPicker({ {/* Organization Domains */} {organizationOptions.length > 0 && (
-
- -

- {t("domainPickerOrganizationDomains")} -

-
-
+ {build !== "oss" && ( +
+ +

+ {t("domainPickerOrganizationDomains")} +

+
+ )} +
{organizationOptions.map((option) => (
@@ -456,10 +461,6 @@ export default function DomainPicker({

)}
- {selectedOption?.id === - option.id && ( - - )}
))} @@ -476,14 +477,14 @@ export default function DomainPicker({ {t("domainPickerProvidedDomains")}
-
+
{providedOptions.map((option) => (