From beaa5735ce0e9f3d878e914afdac2b438b7bf4b0 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Tue, 7 Jul 2026 14:51:15 -0400 Subject: [PATCH] move cert to info box and add network access to create wizard --- messages/en-US.json | 1 + .../private/PrivateResourceHttpFields.tsx | 30 --------------- .../resources/private/[niceId]/http/page.tsx | 6 --- .../resources/private/create/page.tsx | 23 ++++++++++++ src/components/LayoutMobileMenu.tsx | 2 +- src/components/LayoutSidebar.tsx | 4 +- src/components/SiteResourceInfoBox.tsx | 37 ++++++++++++++++++- src/lib/privateResourceForm.ts | 2 + 8 files changed, 65 insertions(+), 40 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index 003fd74a4..196fdf4b9 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -3585,6 +3585,7 @@ "memberPortalResourceDisabled": "Resource Disabled", "memberPortalShowingResources": "Showing {start}-{end} of {total} resources", "resourceLauncherTitle": "Resource Launcher", + "resourceSidebarLauncherTitle": "Launcher", "resourceLauncherDescription": "View all available resources and launch them from one central hub", "resourceLauncherSearchPlaceholder": "Search your resources...", "resourceLauncherDefaultView": "Default", diff --git a/src/app/[orgId]/settings/resources/private/PrivateResourceHttpFields.tsx b/src/app/[orgId]/settings/resources/private/PrivateResourceHttpFields.tsx index 814adecb1..43fb49c08 100644 --- a/src/app/[orgId]/settings/resources/private/PrivateResourceHttpFields.tsx +++ b/src/app/[orgId]/settings/resources/private/PrivateResourceHttpFields.tsx @@ -1,6 +1,5 @@ "use client"; -import CertificateStatus from "@app/components/CertificateStatus"; import DomainPicker from "@app/components/DomainPicker"; import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert"; import { @@ -27,7 +26,6 @@ import { SelectValue } from "@app/components/ui/select"; import { tierMatrix } from "@server/lib/billing/tierMatrix"; -import { build } from "@server/build"; import { useTranslations } from "next-intl"; import type { Control, UseFormSetValue, UseFormWatch } from "react-hook-form"; @@ -38,8 +36,6 @@ type PrivateResourceHttpFieldsProps = { watch: UseFormWatch; disabled?: boolean; siteResourceId?: number; - resourceDomainId?: string | null; - resourceFullDomain?: string | null; labelPrefix?: "create" | "edit"; hideDomainPicker?: boolean; hidePaidFeaturesAlert?: boolean; @@ -52,8 +48,6 @@ export function PrivateResourceHttpFields({ watch, disabled = false, siteResourceId, - resourceDomainId, - resourceFullDomain, labelPrefix = "edit", hideDomainPicker = false, hidePaidFeaturesAlert = false @@ -91,7 +85,6 @@ export function PrivateResourceHttpFields({ const httpConfigSubdomain = watch("httpConfigSubdomain"); const httpConfigDomainId = watch("httpConfigDomainId"); const httpConfigFullDomain = watch("httpConfigFullDomain"); - const ssl = watch("ssl"); return ( @@ -274,29 +267,6 @@ export function PrivateResourceHttpFields({ )} /> - {siteResourceId && - resourceDomainId && - httpConfigFullDomain && - httpConfigDomainId === resourceDomainId && - httpConfigFullDomain === resourceFullDomain && - build != "oss" && - ssl && ( - -
- - {t("certificateStatus")}: - - -
-
- )} )} diff --git a/src/app/[orgId]/settings/resources/private/[niceId]/http/page.tsx b/src/app/[orgId]/settings/resources/private/[niceId]/http/page.tsx index d69210ef5..2bbd776e5 100644 --- a/src/app/[orgId]/settings/resources/private/[niceId]/http/page.tsx +++ b/src/app/[orgId]/settings/resources/private/[niceId]/http/page.tsx @@ -122,12 +122,6 @@ export default function PrivateResourceHttpPage() { watch={asAnyWatch(form.watch)} disabled={httpSectionDisabled} siteResourceId={siteResource.id} - resourceDomainId={ - siteResource.domainId - } - resourceFullDomain={ - siteResource.fullDomain - } />
diff --git a/src/app/[orgId]/settings/resources/private/create/page.tsx b/src/app/[orgId]/settings/resources/private/create/page.tsx index f8109fd66..49b40e3c9 100644 --- a/src/app/[orgId]/settings/resources/private/create/page.tsx +++ b/src/app/[orgId]/settings/resources/private/create/page.tsx @@ -53,6 +53,7 @@ import { z } from "zod"; import { PrivateResourceSitesField } from "../PrivateResourceSitesField"; import { PrivateResourceHttpFields } from "../PrivateResourceHttpFields"; import { PrivateResourceSshFields } from "../PrivateResourceSshFields"; +import { PrivateResourcePortRanges } from "../PrivateResourcePortRanges"; import { PrivateResourceAliasField, PrivateResourceCidrDestinationField, @@ -105,6 +106,8 @@ export default function CreatePrivateResourcePage() { standardDaemonLocation: "site", authDaemonPort: null, pamMode: "passthrough", + tcpPortRangeString: "*", + udpPortRangeString: "*", disableIcmp: false } }); @@ -426,6 +429,16 @@ export default function CreatePrivateResourcePage() { hideAlias /> + + + @@ -466,6 +479,16 @@ export default function CreatePrivateResourcePage() { labelPrefix="create" /> + + + diff --git a/src/components/LayoutMobileMenu.tsx b/src/components/LayoutMobileMenu.tsx index b549d1f2e..7d7ebb902 100644 --- a/src/components/LayoutMobileMenu.tsx +++ b/src/components/LayoutMobileMenu.tsx @@ -155,7 +155,7 @@ export function LayoutMobileMenu({ {t( - "resourceLauncherTitle" + "resourceSidebarLauncherTitle" )} diff --git a/src/components/LayoutSidebar.tsx b/src/components/LayoutSidebar.tsx index 9175cedc4..c42e2c1fa 100644 --- a/src/components/LayoutSidebar.tsx +++ b/src/components/LayoutSidebar.tsx @@ -195,7 +195,7 @@ export function LayoutSidebar({ sideOffset={8} >

- {t("resourceLauncherTitle")} + {t("resourceSidebarLauncherTitle")}

@@ -211,7 +211,7 @@ export function LayoutSidebar({ - {t("resourceLauncherTitle")} + {t("resourceSidebarLauncherTitle")} )} diff --git a/src/components/SiteResourceInfoBox.tsx b/src/components/SiteResourceInfoBox.tsx index 36b7f29ad..f57acbe99 100644 --- a/src/components/SiteResourceInfoBox.tsx +++ b/src/components/SiteResourceInfoBox.tsx @@ -1,5 +1,6 @@ "use client"; +import CertificateStatus from "@app/components/CertificateStatus"; import CopyToClipboard from "@app/components/CopyToClipboard"; import { InfoSection, @@ -17,14 +18,17 @@ import { type LauncherAccessFields } from "@app/lib/launcherResourceAccess"; import type { PrivateResourceMode } from "@app/lib/privateResourceForm"; +import { build } from "@server/build"; import { useTranslations } from "next-intl"; type SiteResourceInfoInput = { + orgId: string; mode: PrivateResourceMode; destination: string | null; destinationPort: number | null; scheme: "http" | "https" | null; ssl: boolean; + domainId?: string | null; fullDomain?: string | null; alias?: string | null; aliasAddress?: string | null; @@ -108,9 +112,20 @@ export function SiteResourceInfoSections({ const showDestination = !( siteResource.mode === "ssh" && siteResource.authDaemonMode === "native" ); + const showCertificate = !!( + siteResource.mode === "http" && + siteResource.ssl && + siteResource.domainId && + siteResource.fullDomain && + build != "oss" + ); const numSections = - 2 + (showDestination ? 1 : 0) + (showAlias ? 1 : 0) + (isPanel ? 1 : 0); + 2 + + (showDestination ? 1 : 0) + + (showAlias ? 1 : 0) + + (showCertificate ? 1 : 0) + + (isPanel ? 1 : 0); const sections = ( @@ -155,6 +170,26 @@ export function SiteResourceInfoSections({ ) : null} + {showCertificate ? ( + + + {t("certificateStatus", { + defaultValue: "Certificate" + })} + + + + + + ) : null} + {isPanel ? ( {t("portRestrictions")} diff --git a/src/lib/privateResourceForm.ts b/src/lib/privateResourceForm.ts index ecac87e88..d9f6fd691 100644 --- a/src/lib/privateResourceForm.ts +++ b/src/lib/privateResourceForm.ts @@ -400,6 +400,8 @@ export function createCreateFormSchema(t: TranslateFn) { .nullable(), authDaemonPort: z.number().int().positive().optional().nullable(), pamMode: z.enum(["passthrough", "push"]).optional().nullable(), + tcpPortRangeString: createPortRangeStringSchema(t), + udpPortRangeString: createPortRangeStringSchema(t), disableIcmp: z.boolean().optional() }) .superRefine((data, ctx) => {