mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-05 23:28:44 +00:00
Fix some ui form issues
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
Reference in New Issue
Block a user