Skip to content

Commit 572579a

Browse files
authored
Merge pull request #785 from Dokploy/canary
v0.13.1
2 parents b296b6b + 63998f7 commit 572579a

File tree

79 files changed

+9811
-807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+9811
-807
lines changed

.config/.husky/commit-msg

-4
This file was deleted.

.config/.husky/install.mjs

-6
This file was deleted.

.config/.husky/pre-commit

-1
This file was deleted.

.github/workflows/pull-request.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
pull_request:
55
branches: [main, canary]
66

7-
env:
8-
HUSKY: 0
9-
107
jobs:
118
lint-and-typecheck:
129
runs-on: ubuntu-latest
@@ -18,8 +15,7 @@ jobs:
1815
node-version: 18.18.0
1916
cache: "pnpm"
2017
- run: pnpm install --frozen-lockfile
21-
- run: pnpm run server:build
22-
- run: pnpm biome ci
18+
- run: pnpm run server:build
2319
- run: pnpm typecheck
2420

2521
build-and-test:
@@ -46,5 +42,5 @@ jobs:
4642
node-version: 18.18.0
4743
cache: "pnpm"
4844
- run: pnpm install --frozen-lockfile
49-
- run: pnpm run server:build
45+
- run: pnpm run server:build
5046
- run: pnpm test

.husky/commit-msg

-1
This file was deleted.

.husky/install.mjs

-6
This file was deleted.

.husky/pre-commit

-2
This file was deleted.

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

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const baseApp: ApplicationNested = {
3030
appName: "",
3131
autoDeploy: true,
3232
serverId: "",
33+
registryUrl: "",
3334
branch: null,
3435
dockerBuildStage: "",
3536
project: {

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

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const baseApp: ApplicationNested = {
1212
serverId: "",
1313
branch: null,
1414
dockerBuildStage: "",
15+
registryUrl: "",
1516
buildArgs: null,
1617
project: {
1718
env: "",
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,143 @@
1-
import {
2-
AlertDialog,
3-
AlertDialogAction,
4-
AlertDialogCancel,
5-
AlertDialogContent,
6-
AlertDialogDescription,
7-
AlertDialogFooter,
8-
AlertDialogHeader,
9-
AlertDialogTitle,
10-
AlertDialogTrigger,
11-
} from "@/components/ui/alert-dialog";
121
import { Button } from "@/components/ui/button";
2+
import {
3+
Dialog,
4+
DialogContent,
5+
DialogDescription,
6+
DialogFooter,
7+
DialogHeader,
8+
DialogTitle,
9+
DialogTrigger,
10+
} from "@/components/ui/dialog";
11+
import {
12+
Form,
13+
FormControl,
14+
FormField,
15+
FormItem,
16+
FormLabel,
17+
FormMessage,
18+
} from "@/components/ui/form";
19+
import { Input } from "@/components/ui/input";
1320
import { api } from "@/utils/api";
21+
import { zodResolver } from "@hookform/resolvers/zod";
1422
import { TrashIcon } from "lucide-react";
1523
import { useRouter } from "next/router";
24+
import { useState } from "react";
25+
import { useForm } from "react-hook-form";
1626
import { toast } from "sonner";
27+
import { z } from "zod";
28+
29+
const deleteApplicationSchema = z.object({
30+
projectName: z.string().min(1, {
31+
message: "Application name is required",
32+
}),
33+
});
34+
35+
type DeleteApplication = z.infer<typeof deleteApplicationSchema>;
1736

1837
interface Props {
1938
applicationId: string;
2039
}
2140

2241
export const DeleteApplication = ({ applicationId }: Props) => {
42+
const [isOpen, setIsOpen] = useState(false);
2343
const { mutateAsync, isLoading } = api.application.delete.useMutation();
44+
const { data } = api.application.one.useQuery(
45+
{ applicationId },
46+
{ enabled: !!applicationId },
47+
);
2448
const { push } = useRouter();
49+
const form = useForm<DeleteApplication>({
50+
defaultValues: {
51+
projectName: "",
52+
},
53+
resolver: zodResolver(deleteApplicationSchema),
54+
});
55+
56+
const onSubmit = async (formData: DeleteApplication) => {
57+
const expectedName = `${data?.name}/${data?.appName}`;
58+
if (formData.projectName === expectedName) {
59+
await mutateAsync({
60+
applicationId,
61+
})
62+
.then((data) => {
63+
push(`/dashboard/project/${data?.projectId}`);
64+
toast.success("Application deleted successfully");
65+
setIsOpen(false);
66+
})
67+
.catch(() => {
68+
toast.error("Error deleting the application");
69+
});
70+
} else {
71+
form.setError("projectName", {
72+
message: "Project name does not match",
73+
});
74+
}
75+
};
76+
2577
return (
26-
<AlertDialog>
27-
<AlertDialogTrigger asChild>
78+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
79+
<DialogTrigger asChild>
2880
<Button variant="ghost" isLoading={isLoading}>
2981
<TrashIcon className="size-4 text-muted-foreground" />
3082
</Button>
31-
</AlertDialogTrigger>
32-
<AlertDialogContent>
33-
<AlertDialogHeader>
34-
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
35-
<AlertDialogDescription>
83+
</DialogTrigger>
84+
<DialogContent className="max-h-screen overflow-y-auto sm:max-w-lg">
85+
<DialogHeader>
86+
<DialogTitle>Are you absolutely sure?</DialogTitle>
87+
<DialogDescription>
3688
This action cannot be undone. This will permanently delete the
37-
application
38-
</AlertDialogDescription>
39-
</AlertDialogHeader>
40-
<AlertDialogFooter>
41-
<AlertDialogCancel>Cancel</AlertDialogCancel>
42-
<AlertDialogAction
43-
onClick={async () => {
44-
await mutateAsync({
45-
applicationId,
46-
})
47-
.then((data) => {
48-
push(`/dashboard/project/${data?.projectId}`);
49-
50-
toast.success("Application delete succesfully");
51-
})
52-
.catch(() => {
53-
toast.error("Error to delete Application");
54-
});
89+
application. If you are sure please enter the application name to
90+
delete this application.
91+
</DialogDescription>
92+
</DialogHeader>
93+
<div className="grid gap-4">
94+
<Form {...form}>
95+
<form
96+
onSubmit={form.handleSubmit(onSubmit)}
97+
id="hook-form-delete-application"
98+
className="grid w-full gap-4"
99+
>
100+
<FormField
101+
control={form.control}
102+
name="projectName"
103+
render={({ field }) => (
104+
<FormItem>
105+
<FormLabel>
106+
To confirm, type "{data?.name}/{data?.appName}" in the box
107+
below
108+
</FormLabel>
109+
<FormControl>
110+
<Input
111+
placeholder="Enter application name to confirm"
112+
{...field}
113+
/>
114+
</FormControl>
115+
<FormMessage />
116+
</FormItem>
117+
)}
118+
/>
119+
</form>
120+
</Form>
121+
</div>
122+
<DialogFooter>
123+
<Button
124+
variant="secondary"
125+
onClick={() => {
126+
setIsOpen(false);
55127
}}
128+
>
129+
Cancel
130+
</Button>
131+
<Button
132+
isLoading={isLoading}
133+
form="hook-form-delete-application"
134+
type="submit"
135+
variant="destructive"
56136
>
57137
Confirm
58-
</AlertDialogAction>
59-
</AlertDialogFooter>
60-
</AlertDialogContent>
61-
</AlertDialog>
138+
</Button>
139+
</DialogFooter>
140+
</DialogContent>
141+
</Dialog>
62142
);
63143
};

apps/dokploy/components/dashboard/application/general/generic/save-bitbucket-provider.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ export const SaveBitbucketProvider = ({ applicationId }: Props) => {
202202
<FormControl>
203203
<Button
204204
variant="outline"
205-
role="combobox"
206205
className={cn(
207206
"w-full justify-between !bg-input",
208207
!field.value && "text-muted-foreground",
@@ -281,7 +280,6 @@ export const SaveBitbucketProvider = ({ applicationId }: Props) => {
281280
<FormControl>
282281
<Button
283282
variant="outline"
284-
role="combobox"
285283
className={cn(
286284
" w-full justify-between !bg-input",
287285
!field.value && "text-muted-foreground",

apps/dokploy/components/dashboard/application/general/generic/save-docker-provider.tsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const DockerProviderSchema = z.object({
2121
}),
2222
username: z.string().optional(),
2323
password: z.string().optional(),
24+
registryURL: z.string().optional(),
2425
});
2526

2627
type DockerProvider = z.infer<typeof DockerProviderSchema>;
@@ -33,12 +34,12 @@ export const SaveDockerProvider = ({ applicationId }: Props) => {
3334
const { data, refetch } = api.application.one.useQuery({ applicationId });
3435

3536
const { mutateAsync } = api.application.saveDockerProvider.useMutation();
36-
3737
const form = useForm<DockerProvider>({
3838
defaultValues: {
3939
dockerImage: "",
4040
password: "",
4141
username: "",
42+
registryURL: "",
4243
},
4344
resolver: zodResolver(DockerProviderSchema),
4445
});
@@ -49,6 +50,7 @@ export const SaveDockerProvider = ({ applicationId }: Props) => {
4950
dockerImage: data.dockerImage || "",
5051
password: data.password || "",
5152
username: data.username || "",
53+
registryURL: data.registryUrl || "",
5254
});
5355
}
5456
}, [form.reset, data, form]);
@@ -59,6 +61,7 @@ export const SaveDockerProvider = ({ applicationId }: Props) => {
5961
password: values.password || null,
6062
applicationId,
6163
username: values.username || null,
64+
registryUrl: values.registryURL || null,
6265
})
6366
.then(async () => {
6467
toast.success("Docker Provider Saved");
@@ -76,7 +79,7 @@ export const SaveDockerProvider = ({ applicationId }: Props) => {
7679
className="flex flex-col gap-4"
7780
>
7881
<div className="grid md:grid-cols-2 gap-4 ">
79-
<div className="md:col-span-2 space-y-4">
82+
<div className="space-y-4">
8083
<FormField
8184
control={form.control}
8285
name="dockerImage"
@@ -91,6 +94,19 @@ export const SaveDockerProvider = ({ applicationId }: Props) => {
9194
)}
9295
/>
9396
</div>
97+
<FormField
98+
control={form.control}
99+
name="registryURL"
100+
render={({ field }) => (
101+
<FormItem>
102+
<FormLabel>Registry URL</FormLabel>
103+
<FormControl>
104+
<Input placeholder="Registry URL" {...field} />
105+
</FormControl>
106+
<FormMessage />
107+
</FormItem>
108+
)}
109+
/>
94110
<div className="space-y-4">
95111
<FormField
96112
control={form.control}

apps/dokploy/components/dashboard/application/general/generic/save-github-provider.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
193193
<FormControl>
194194
<Button
195195
variant="outline"
196-
role="combobox"
197196
className={cn(
198197
"w-full justify-between !bg-input",
199198
!field.value && "text-muted-foreground",
@@ -272,7 +271,6 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
272271
<FormControl>
273272
<Button
274273
variant="outline"
275-
role="combobox"
276274
className={cn(
277275
" w-full justify-between !bg-input",
278276
!field.value && "text-muted-foreground",

apps/dokploy/components/dashboard/application/general/generic/save-gitlab-provider.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
209209
<FormControl>
210210
<Button
211211
variant="outline"
212-
role="combobox"
213212
className={cn(
214213
"w-full justify-between !bg-input",
215214
!field.value && "text-muted-foreground",
@@ -297,7 +296,6 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
297296
<FormControl>
298297
<Button
299298
variant="outline"
300-
role="combobox"
301299
className={cn(
302300
" w-full justify-between !bg-input",
303301
!field.value && "text-muted-foreground",

0 commit comments

Comments
 (0)