Skip to content

Commit 4259e25

Browse files
authored
Merge pull request #2309 from Dokploy/1778-railpack-frontend-version-is-hardcoded
1778 railpack frontend version is hardcoded
2 parents b8f27d7 + a138d12 commit 4259e25

File tree

9 files changed

+6221
-35
lines changed

9 files changed

+6221
-35
lines changed

apps/dokploy/__test__/drop/drop.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if (typeof window === "undefined") {
2525
}
2626

2727
const baseApp: ApplicationNested = {
28+
railpackVersion: "0.2.2",
2829
applicationId: "",
2930
herokuVersion: "",
3031
giteaBranch: "",

apps/dokploy/__test__/traefik/traefik.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createRouterConfig } from "@dokploy/server";
33
import { expect, test } from "vitest";
44

55
const baseApp: ApplicationNested = {
6+
railpackVersion: "0.2.2",
67
rollbackActive: false,
78
applicationId: "",
89
herokuVersion: "",

apps/dokploy/components/dashboard/application/build/show.tsx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import { zodResolver } from "@hookform/resolvers/zod";
2+
import { Cog } from "lucide-react";
3+
import { useEffect } from "react";
4+
import { useForm } from "react-hook-form";
5+
import { toast } from "sonner";
6+
import { z } from "zod";
17
import { AlertBlock } from "@/components/shared/alert-block";
28
import { Badge } from "@/components/ui/badge";
39
import { Button } from "@/components/ui/button";
@@ -15,12 +21,6 @@ import {
1521
import { Input } from "@/components/ui/input";
1622
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
1723
import { api } from "@/utils/api";
18-
import { zodResolver } from "@hookform/resolvers/zod";
19-
import { Cog } from "lucide-react";
20-
import { useEffect } from "react";
21-
import { useForm } from "react-hook-form";
22-
import { toast } from "sonner";
23-
import { z } from "zod";
2424

2525
export enum BuildType {
2626
dockerfile = "dockerfile",
@@ -65,6 +65,7 @@ const mySchema = z.discriminatedUnion("buildType", [
6565
}),
6666
z.object({
6767
buildType: z.literal(BuildType.railpack),
68+
railpackVersion: z.string().nullable().default("0.2.2"),
6869
}),
6970
z.object({
7071
buildType: z.literal(BuildType.static),
@@ -86,6 +87,7 @@ interface ApplicationData {
8687
herokuVersion?: string | null;
8788
publishDirectory?: string | null;
8889
isStaticSpa?: boolean | null;
90+
railpackVersion?: string | null | undefined;
8991
}
9092

9193
function isValidBuildType(value: string): value is BuildType {
@@ -123,6 +125,7 @@ const resetData = (data: ApplicationData): AddTemplate => {
123125
case BuildType.railpack:
124126
return {
125127
buildType: BuildType.railpack,
128+
railpackVersion: data.railpackVersion || null,
126129
};
127130
default: {
128131
const buildType = data.buildType as BuildType;
@@ -181,6 +184,10 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
181184
: null,
182185
isStaticSpa:
183186
data.buildType === BuildType.static ? data.isStaticSpa : null,
187+
railpackVersion:
188+
data.buildType === BuildType.railpack
189+
? data.railpackVersion || "0.2.2"
190+
: null,
184191
})
185192
.then(async () => {
186193
toast.success("Build type saved");
@@ -395,6 +402,25 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
395402
)}
396403
/>
397404
)}
405+
{buildType === BuildType.railpack && (
406+
<FormField
407+
control={form.control}
408+
name="railpackVersion"
409+
render={({ field }) => (
410+
<FormItem>
411+
<FormLabel>Railpack Version</FormLabel>
412+
<FormControl>
413+
<Input
414+
placeholder="Railpack Version"
415+
{...field}
416+
value={field.value ?? ""}
417+
/>
418+
</FormControl>
419+
<FormMessage />
420+
</FormItem>
421+
)}
422+
/>
423+
)}
398424
<div className="flex w-full justify-end">
399425
<Button isLoading={isLoading} type="submit">
400426
Save
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "application" ADD COLUMN "railpackVersion" text DEFAULT '0.2.2';

0 commit comments

Comments
 (0)