mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: add conditional value
This commit is contained in:
@@ -136,10 +136,12 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newPorts = [...additionalPorts];
|
const newPorts = [...additionalPorts];
|
||||||
|
|
||||||
// @ts-ignore
|
if (newPorts[index]) {
|
||||||
newPorts?.[index].targetPort = Number.parseInt(
|
newPorts[index].targetPort = Number.parseInt(
|
||||||
e.target.value,
|
e.target.value,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
setAdditionalPorts(newPorts);
|
setAdditionalPorts(newPorts);
|
||||||
}}
|
}}
|
||||||
className="w-full rounded border p-2"
|
className="w-full rounded border p-2"
|
||||||
@@ -155,10 +157,11 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
|
|||||||
value={port.publishedPort}
|
value={port.publishedPort}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newPorts = [...additionalPorts];
|
const newPorts = [...additionalPorts];
|
||||||
// @ts-ignore
|
if (newPorts[index]) {
|
||||||
newPorts?.[index].publishedPort = Number.parseInt(
|
newPorts[index].publishedPort = Number.parseInt(
|
||||||
e.target.value,
|
e.target.value,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
setAdditionalPorts(newPorts);
|
setAdditionalPorts(newPorts);
|
||||||
}}
|
}}
|
||||||
className="w-full rounded border p-2"
|
className="w-full rounded border p-2"
|
||||||
@@ -172,8 +175,10 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
|
|||||||
value={port.publishMode}
|
value={port.publishMode}
|
||||||
onValueChange={(value: "ingress" | "host") => {
|
onValueChange={(value: "ingress" | "host") => {
|
||||||
const newPorts = [...additionalPorts];
|
const newPorts = [...additionalPorts];
|
||||||
// @ts-ignore
|
|
||||||
newPorts?.[index].publishMode = value;
|
if (newPorts[index]) {
|
||||||
|
newPorts[index].publishMode = value;
|
||||||
|
}
|
||||||
setAdditionalPorts(newPorts);
|
setAdditionalPorts(newPorts);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user