Fix some ui form issues

This commit is contained in:
Owen
2026-05-31 11:57:01 -07:00
parent 3cf6abdf27
commit c1d933259a
9 changed files with 49 additions and 51 deletions

View File

@@ -42,7 +42,7 @@ import {
useState,
useTransition
} from "react";
import CreatePrivateResourceDialog from "@app/components/CreateInternalResourceDialog";
import CreatePrivateResourceDialog from "@app/components/CreatePrivateResourceDialog";
import EditPrivateResourceDialog from "@app/components/EditPrivateResourceDialog";
import type { PaginationState } from "@tanstack/react-table";
import { ControlledDataTable } from "./ui/controlled-data-table";

View File

@@ -62,16 +62,13 @@ export default function CreatePrivateResourceDialog({
}
}
// "ssh" mode maps to "host" in the backend with SSH settings
const backendMode = data.mode === "ssh" ? "host" : data.mode;
await api.put<
AxiosResponse<{ data: { siteResourceId: number } }>
>(`/org/${orgId}/site-resource`, {
name: data.name,
siteIds: data.siteIds,
mode: backendMode,
destination: data.destination,
mode: data.mode,
destination: data.destination ?? undefined,
enabled: true,
...(data.mode === "http" && {
scheme: data.scheme,

View File

@@ -66,15 +66,12 @@ export default function EditPrivateResourceDialog({
}
}
// "ssh" mode maps to "host" in the backend with SSH settings
const backendMode = data.mode === "ssh" ? "host" : data.mode;
await api.post(`/site-resource/${resource.id}`, {
name: data.name,
siteIds: data.siteIds,
mode: backendMode,
mode: data.mode,
niceId: data.niceId,
destination: data.destination,
destination: data.destination ?? undefined,
...(data.mode === "http" && {
scheme: data.scheme,
ssl: data.ssl ?? false,

View File

@@ -478,14 +478,12 @@ export function PrivateResourceForm({
const [sshServerMode, setSshServerMode] = useState<"standard" | "native">(
() => {
if (
variant === "edit" &&
resource &&
resource.authDaemonMode === "native"
) {
return "native";
if (variant === "edit" && resource) {
return resource.authDaemonMode === "native"
? "native"
: "standard";
}
return "standard";
return "native";
}
);
@@ -559,7 +557,7 @@ export function PrivateResourceForm({
tcpPortRangeString: "*",
udpPortRangeString: "*",
disableIcmp: false,
authDaemonMode: "site",
authDaemonMode: "native",
authDaemonPort: null,
pamMode: "passthrough",
roles: [],
@@ -624,7 +622,7 @@ export function PrivateResourceForm({
tcpPortRangeString: "*",
udpPortRangeString: "*",
disableIcmp: false,
authDaemonMode: "site",
authDaemonMode: "native",
authDaemonPort: null,
pamMode: "passthrough",
roles: [],