diff --git a/server/routers/resource/listResources.ts b/server/routers/resource/listResources.ts index 9127d74e6..729d24ebe 100644 --- a/server/routers/resource/listResources.ts +++ b/server/routers/resource/listResources.ts @@ -143,6 +143,7 @@ export type ResourceWithTargets = { domainId: string | null; niceId: string; headerAuthId: number | null; + wildcard: boolean; targets: Array<{ targetId: number; ip: string; @@ -176,6 +177,7 @@ function queryResourcesBase() { enabled: resources.enabled, domainId: resources.domainId, niceId: resources.niceId, + wildcard: resources.wildcard, headerAuthId: resourceHeaderAuth.headerAuthId, headerAuthExtendedCompatibilityId: resourceHeaderAuthExtendedCompatibility.headerAuthExtendedCompatibilityId, @@ -456,6 +458,7 @@ export async function listResources( http: row.http, protocol: row.protocol, proxyPort: row.proxyPort, + wildcard: row.wildcard, enabled: row.enabled, domainId: row.domainId, headerAuthId: row.headerAuthId, diff --git a/src/components/CreateShareLinkForm.tsx b/src/components/CreateShareLinkForm.tsx index d0e26a1c2..2e5dbe655 100644 --- a/src/components/CreateShareLinkForm.tsx +++ b/src/components/CreateShareLinkForm.tsx @@ -47,15 +47,7 @@ import { PopoverTrigger } from "@app/components/ui/popover"; import { CaretSortIcon } from "@radix-ui/react-icons"; -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList -} from "@app/components/ui/command"; -import { CheckIcon, ChevronsUpDown } from "lucide-react"; +import { ChevronsUpDown } from "lucide-react"; import { Checkbox } from "@app/components/ui/checkbox"; import { GenerateAccessTokenResponse } from "@server/routers/accessToken"; import { constructShareLink } from "@app/lib/shareLinks"; @@ -275,10 +267,11 @@ export default function CreateShareLinkForm({ ; export type ResourceSelectorProps = { orgId: string; selectedResource?: SelectedResource | null; onSelectResource: (resource: SelectedResource) => void; + excludeWildcard?: boolean; }; export function ResourceSelector({ orgId, selectedResource, - onSelectResource + onSelectResource, + excludeWildcard = false }: ResourceSelectorProps) { const t = useTranslations(); const [resourceSearchQuery, setResourceSearchQuery] = useState(""); @@ -46,10 +48,13 @@ export function ResourceSelector({ // always include the selected resource in the list of resources shown const resourcesShown = useMemo(() => { - const allResources: Array = [...resources]; + const allResources: Array = excludeWildcard + ? resources.filter((r) => !r.wildcard) + : [...resources]; if ( debouncedSearchQuery.trim().length === 0 && selectedResource && + !(excludeWildcard && selectedResource.wildcard) && !allResources.find( (resource) => resource.resourceId === selectedResource?.resourceId @@ -58,7 +63,7 @@ export function ResourceSelector({ allResources.unshift(selectedResource); } return allResources; - }, [debouncedSearchQuery, resources, selectedResource]); + }, [debouncedSearchQuery, resources, selectedResource, excludeWildcard]); return (