Working on ui

This commit is contained in:
Owen
2026-05-31 17:25:03 -07:00
parent cb2ee9c489
commit b99e9a6468
9 changed files with 40 additions and 33 deletions

View File

@@ -434,7 +434,16 @@ export async function listResources(
.from(targets) .from(targets)
.innerJoin(sites, eq(targets.siteId, sites.siteId)) .innerJoin(sites, eq(targets.siteId, sites.siteId))
.where(and(eq(sites.orgId, orgId), eq(sites.siteId, siteId))); .where(and(eq(sites.orgId, orgId), eq(sites.siteId, siteId)));
conditions.push(inArray(resources.resourceId, resourcesWithSite)); const resourcesWithBrowserGateway = db
.select({ resourceId: browserGatewayTarget.resourceId })
.from(browserGatewayTarget)
.where(eq(browserGatewayTarget.siteId, siteId));
conditions.push(
or(
inArray(resources.resourceId, resourcesWithSite),
inArray(resources.resourceId, resourcesWithBrowserGateway)
)
);
} }
if (isLabelFeatureEnabled && labelFilter && labelFilter.length > 0) { if (isLabelFeatureEnabled && labelFilter && labelFilter.length > 0) {

View File

@@ -144,14 +144,13 @@ const updateSiteResourceSchema = z
data.destinationPort <= 65535 data.destinationPort <= 65535
); );
} else if (data.mode === "ssh") { } else if (data.mode === "ssh") {
// just check the destinationPort // destinationPort is optional for native mode; allow null/undefined
return ( return (
data.destinationPort === undefined || data.destinationPort == null ||
(data.destinationPort !== null && (data.destinationPort >= 1 && data.destinationPort <= 65535)
data.destinationPort >= 1 &&
data.destinationPort <= 65535)
); );
} }
return true;
}, },
{ {
message: message:

View File

@@ -1,5 +1,5 @@
import type { InternalResourceRow } from "@app/components/ClientResourcesTable"; import type { InternalResourceRow } from "@app/components/ClientResourcesTable";
import ClientResourcesTable from "@app/components/ClientResourcesTable"; import PrivateResourcesTable from "@app/components/ClientResourcesTable";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle"; import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import PrivateResourcesBanner from "@app/components/PrivateResourcesBanner"; import PrivateResourcesBanner from "@app/components/PrivateResourcesBanner";
import { internal } from "@app/lib/api"; import { internal } from "@app/lib/api";
@@ -148,7 +148,7 @@ export default async function ClientResourcesPage(
<PrivateResourcesBanner orgId={params.orgId} /> <PrivateResourcesBanner orgId={params.orgId} />
<OrgProvider org={org}> <OrgProvider org={org}>
<ClientResourcesTable <PrivateResourcesTable
internalResources={internalResourceRows} internalResources={internalResourceRows}
orgId={params.orgId} orgId={params.orgId}
rowCount={pagination.total} rowCount={pagination.total}

View File

@@ -130,7 +130,7 @@ const DockerContainersTable: FC<{
useState(true); useState(true);
const [hideStoppedContainers, setHideStoppedContainers] = useState(false); const [hideStoppedContainers, setHideStoppedContainers] = useState(false);
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({ const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({
labels: false labels: true
}); });
const t = useTranslations(); const t = useTranslations();

View File

@@ -24,17 +24,12 @@ import {
ArrowUp10Icon, ArrowUp10Icon,
ChevronsUpDownIcon, ChevronsUpDownIcon,
CircleSlash, CircleSlash,
MoreHorizontal, MoreHorizontal
} from "lucide-react"; } from "lucide-react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { import { startTransition, useMemo, useState, useTransition } from "react";
startTransition,
useMemo,
useState,
useTransition
} from "react";
import { useDebouncedCallback } from "use-debounce"; import { useDebouncedCallback } from "use-debounce";
import z from "zod"; import z from "zod";
import { ColumnFilterButton } from "./ColumnFilterButton"; import { ColumnFilterButton } from "./ColumnFilterButton";
@@ -110,7 +105,7 @@ export default function MachineClientsTable({
subnet: false, subnet: false,
userId: false, userId: false,
niceId: false, niceId: false,
labels: false labels: true
}; };
const refreshData = () => { const refreshData = () => {
@@ -614,7 +609,10 @@ function MachineClientLabelCell({
}: MachineClientLabelCellProps) { }: MachineClientLabelCellProps) {
const t = useTranslations(); const t = useTranslations();
const api = createApiClient(useEnvContext()); const api = createApiClient(useEnvContext());
const [localLabels, setLocalLabels] = useLocalLabels(client.labels, client.id); const [localLabels, setLocalLabels] = useLocalLabels(
client.labels,
client.id
);
function toggleClientLabel( function toggleClientLabel(
label: SelectedLabel, label: SelectedLabel,

View File

@@ -1128,9 +1128,7 @@ export function PrivateResourceForm({
/> />
</div> </div>
)} )}
{(mode === "host" || {(mode === "host" || mode === "ssh") && (
(mode === "ssh" &&
sshServerMode !== "native")) && (
<div className="min-w-0"> <div className="min-w-0">
<FormField <FormField
control={form.control} control={form.control}

View File

@@ -129,7 +129,7 @@ type ClientResourcesTableProps = {
initialFilterSite?: Selectedsite | null; initialFilterSite?: Selectedsite | null;
}; };
export default function ClientResourcesTable({ export default function PrivateResourcesTable({
internalResources, internalResources,
orgId, orgId,
pagination, pagination,
@@ -400,6 +400,7 @@ export default function ClientResourcesTable({
cell: ({ row }) => { cell: ({ row }) => {
const resourceRow = row.original; const resourceRow = row.original;
const display = formatDestinationDisplay(resourceRow); const display = formatDestinationDisplay(resourceRow);
if (resourceRow.destination) {
return ( return (
<CopyToClipboard <CopyToClipboard
text={display} text={display}
@@ -408,6 +409,8 @@ export default function ClientResourcesTable({
/> />
); );
} }
return <span>-</span>;
}
}, },
{ {
accessorKey: "alias", accessorKey: "alias",
@@ -656,7 +659,7 @@ export default function ClientResourcesTable({
columnVisibility={{ columnVisibility={{
niceId: false, niceId: false,
aliasAddress: false, aliasAddress: false,
labels: false labels: true
}} }}
stickyLeftColumn="name" stickyLeftColumn="name"
stickyRightColumn="actions" stickyRightColumn="actions"

View File

@@ -755,7 +755,7 @@ export default function ProxyResourcesTable({
columnVisibility={{ columnVisibility={{
niceId: false, niceId: false,
protocol: false, protocol: false,
labels: false labels: true
}} }}
stickyLeftColumn="name" stickyLeftColumn="name"
stickyRightColumn="actions" stickyRightColumn="actions"

View File

@@ -36,7 +36,7 @@ import {
ArrowUpRight, ArrowUpRight,
ChevronDown, ChevronDown,
ChevronsUpDownIcon, ChevronsUpDownIcon,
MoreHorizontal, MoreHorizontal
} from "lucide-react"; } from "lucide-react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Link from "next/link"; import Link from "next/link";
@@ -670,7 +670,7 @@ export default function SitesTable({
nice: false, nice: false,
exitNode: false, exitNode: false,
address: false, address: false,
labels: false labels: true
}} }}
enableColumnVisibility enableColumnVisibility
stickyLeftColumn="name" stickyLeftColumn="name"