From 6b96e3dce6429b9b8ef087842173cf792dfd11c2 Mon Sep 17 00:00:00 2001 From: Owen Date: Thu, 4 Jun 2026 17:57:21 -0700 Subject: [PATCH] Make sure the disableEnterpriseFeatures works --- messages/en-US.json | 2 +- .../settings/resources/public/create/page.tsx | 81 ++++++------------- src/app/navigation.tsx | 2 +- 3 files changed, 27 insertions(+), 58 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index 409a589b1..b7d670789 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1647,7 +1647,7 @@ "standaloneHcFilterResourceIdFallback": "Resource {id}", "blueprints": "Blueprints", "blueprintsLog": "Blueprints Log", - "blueprintsDescription": "View past blueprint applications and their results", + "blueprintsDescription": "View past blueprint applications and their results or apply a new blueprint", "blueprintAdd": "Add Blueprint", "blueprintGoBack": "See all Blueprints", "blueprintCreate": "Create Blueprint", diff --git a/src/app/[orgId]/settings/resources/public/create/page.tsx b/src/app/[orgId]/settings/resources/public/create/page.tsx index 93c8e8934..f4535e935 100644 --- a/src/app/[orgId]/settings/resources/public/create/page.tsx +++ b/src/app/[orgId]/settings/resources/public/create/page.tsx @@ -2,13 +2,6 @@ import CopyTextBox from "@app/components/CopyTextBox"; import DomainPicker from "@app/components/DomainPicker"; -import HealthCheckCredenza from "@app/components/HealthCheckCredenza"; -import { - PathMatchDisplay, - PathMatchModal, - PathRewriteDisplay, - PathRewriteModal -} from "@app/components/PathMatchRenameModal"; import { SettingsContainer, SettingsSection, @@ -48,29 +41,6 @@ import { PopoverContent, PopoverTrigger } from "@app/components/ui/popover"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue -} from "@app/components/ui/select"; -import { Switch } from "@app/components/ui/switch"; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow -} from "@app/components/ui/table"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger -} from "@app/components/ui/tooltip"; -import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert"; import { useEnvContext } from "@app/hooks/useEnvContext"; import { usePaidStatus } from "@app/hooks/usePaidStatus"; import { toast } from "@app/hooks/useToast"; @@ -84,32 +54,16 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { build } from "@server/build"; import { Resource } from "@server/db"; import { isTargetValid } from "@server/lib/validators"; -import { ListTargetsResponse } from "@server/routers/target"; import { ListRemoteExitNodesResponse } from "@server/routers/remoteExitNode/types"; -import { ArrayElement } from "@server/types/ArrayElement"; import { useQuery } from "@tanstack/react-query"; import { LocalTarget, ProxyResourceTargetsForm } from "@app/app/[orgId]/settings/resources/public/ProxyResourceTargetsForm"; -import { - ColumnDef, - flexRender, - getCoreRowModel, - getFilteredRowModel, - getPaginationRowModel, - getSortedRowModel, - useReactTable -} from "@tanstack/react-table"; import { AxiosResponse } from "axios"; import { ChevronsUpDown, - CircleCheck, - CircleX, ExternalLink, - Info, - Plus, - Settings, SquareArrowOutUpRight } from "lucide-react"; import { useTranslations } from "next-intl"; @@ -119,13 +73,11 @@ import { toASCII } from "punycode"; import { useMemo, useState, - useCallback, useTransition, useEffect } from "react"; -import { Controller, useForm } from "react-hook-form"; +import { useForm } from "react-hook-form"; import { z } from "zod"; -import { cn } from "@app/lib/cn"; const baseResourceFormSchema = z.object({ name: z.string().min(1).max(255), @@ -327,14 +279,25 @@ export default function Page() { const rawResourcesAllowed = env.flags.allowRawResources && (build !== "saas" || remoteExitNodes.length > 0); + const enterpriseModesAllowed = + build === "oss" && !env.flags.disableEnterpriseFeatures; const availableTypes = useMemo((): NewResourceType[] => { - const base: NewResourceType[] = ["http", "ssh", "rdp", "vnc"]; + const base: NewResourceType[] = ["http"]; + if (enterpriseModesAllowed) { + base.push("ssh", "rdp", "vnc"); + } if (rawResourcesAllowed) { base.push("tcp", "udp"); } return base; - }, [rawResourcesAllowed]); + }, [enterpriseModesAllowed, rawResourcesAllowed]); + + useEffect(() => { + if (!availableTypes.includes(resourceType)) { + setResourceType("http"); + } + }, [availableTypes, resourceType]); const baseForm = useForm({ resolver: zodResolver(baseResourceFormSchema), @@ -686,19 +649,25 @@ export default function Page() { } ]; - const typeLabels: Record = { + let typeLabels: Partial> = { http: "HTTP", - ssh: "SSH", - rdp: "RDP", - vnc: "VNC", tcp: "TCP", udp: "UDP" }; + if (enterpriseModesAllowed) { + typeLabels = { + ...typeLabels, + ssh: "SSH", + rdp: "RDP", + vnc: "VNC", + } + } + const typeOptions: OptionSelectOption[] = availableTypes.map((type) => ({ value: type, - label: typeLabels[type] + label: typeLabels[type] ?? type.toUpperCase() })); return ( diff --git a/src/app/navigation.tsx b/src/app/navigation.tsx index 566d17d0d..0fb678ffb 100644 --- a/src/app/navigation.tsx +++ b/src/app/navigation.tsx @@ -137,7 +137,7 @@ export const orgNavSections = ( } ] }, - ...(build !== "oss" + ...(build === "oss" && !env?.flags.disableEnterpriseFeatures ? [ { title: "sidebarPolicies",