Skip to content

Commit 1afceca

Browse files
authored
Merge pull request #2124 from Dokploy/feat/add-ports-publish-mode
Feat/add ports publish mode
2 parents f3703e6 + 80b72dc commit 1afceca

7 files changed

Lines changed: 5901 additions & 2 deletions

File tree

apps/dokploy/components/dashboard/application/advanced/ports/handle-ports.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ import { z } from "zod";
3535

3636
const AddPortSchema = z.object({
3737
publishedPort: z.number().int().min(1).max(65535),
38+
publishMode: z.enum(["ingress", "host"], {
39+
required_error: "Publish mode is required",
40+
}),
3841
targetPort: z.number().int().min(1).max(65535),
3942
protocol: z.enum(["tcp", "udp"], {
4043
required_error: "Protocol is required",
@@ -80,6 +83,7 @@ export const HandlePorts = ({
8083
useEffect(() => {
8184
form.reset({
8285
publishedPort: data?.publishedPort ?? 0,
86+
publishMode: data?.publishMode ?? "ingress",
8387
targetPort: data?.targetPort ?? 0,
8488
protocol: data?.protocol ?? "tcp",
8589
});
@@ -165,6 +169,32 @@ export const HandlePorts = ({
165169
</FormItem>
166170
)}
167171
/>
172+
<FormField
173+
control={form.control}
174+
name="publishMode"
175+
render={({ field }) => {
176+
return (
177+
<FormItem className="md:col-span-2">
178+
<FormLabel>Published Port Mode</FormLabel>
179+
<Select
180+
onValueChange={field.onChange}
181+
value={field.value}
182+
>
183+
<FormControl>
184+
<SelectTrigger>
185+
<SelectValue placeholder="Select a publish mode for the port" />
186+
</SelectTrigger>
187+
</FormControl>
188+
<SelectContent>
189+
<SelectItem value={"ingress"}>Ingress</SelectItem>
190+
<SelectItem value={"host"}>Host</SelectItem>
191+
</SelectContent>
192+
</Select>
193+
<FormMessage />
194+
</FormItem>
195+
);
196+
}}
197+
/>
168198
<FormField
169199
control={form.control}
170200
name="targetPort"

apps/dokploy/components/dashboard/application/advanced/ports/show-port.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,21 @@ export const ShowPorts = ({ applicationId }: Props) => {
6060
{data?.ports.map((port) => (
6161
<div key={port.portId}>
6262
<div className="flex w-full flex-col sm:flex-row sm:items-center justify-between gap-4 sm:gap-10 border rounded-lg p-4">
63-
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 flex-col gap-4 sm:gap-8">
63+
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 flex-col gap-4 sm:gap-8">
6464
<div className="flex flex-col gap-1">
6565
<span className="font-medium">Published Port</span>
6666
<span className="text-sm text-muted-foreground">
6767
{port.publishedPort}
6868
</span>
6969
</div>
7070
<div className="flex flex-col gap-1">
71-
<span className="font-medium"> Target Port</span>
71+
<span className="font-medium">Published Port Mode</span>
72+
<span className="text-sm text-muted-foreground">
73+
{port?.publishMode?.toUpperCase()}
74+
</span>
75+
</div>
76+
<div className="flex flex-col gap-1">
77+
<span className="font-medium">Target Port</span>
7278
<span className="text-sm text-muted-foreground">
7379
{port.targetPort}
7480
</span>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CREATE TYPE "public"."publishModeType" AS ENUM('ingress', 'host');--> statement-breakpoint
2+
ALTER TABLE "port" ADD COLUMN "publishMode" "publishModeType" DEFAULT 'host' NOT NULL;

0 commit comments

Comments
 (0)