Skip to content

Commit ceb16ae

Browse files
committed
Implement enableSubmodules feature across various Git provider components and update database schema. This change introduces a new boolean field enableSubmodules to control submodule behavior in Git operations, replacing the previous recurseSubmodules field. Updates include modifications to the UI components, API routers, and database schema to accommodate this new feature.
1 parent 1911b5b commit ceb16ae

22 files changed

+11000
-97
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
TooltipProvider,
2424
TooltipTrigger,
2525
} from "@/components/ui/tooltip";
26+
import { Switch } from "@/components/ui/switch";
2627
import { api } from "@/utils/api";
2728
import { zodResolver } from "@hookform/resolvers/zod";
2829
import { KeyRoundIcon, LockIcon, X } from "lucide-react";
@@ -44,7 +45,7 @@ const GitProviderSchema = z.object({
4445
branch: z.string().min(1, "Branch required"),
4546
sshKey: z.string().optional(),
4647
watchPaths: z.array(z.string()).optional(),
47-
recurseSubmodules: z.boolean().default(true),
48+
enableSubmodules: z.boolean().default(false),
4849
});
4950

5051
type GitProvider = z.infer<typeof GitProviderSchema>;
@@ -68,7 +69,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
6869
repositoryURL: "",
6970
sshKey: undefined,
7071
watchPaths: [],
71-
recurseSubmodules: true,
72+
enableSubmodules: false,
7273
},
7374
resolver: zodResolver(GitProviderSchema),
7475
});
@@ -81,7 +82,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
8182
buildPath: data.customGitBuildPath || "/",
8283
repositoryURL: data.customGitUrl || "",
8384
watchPaths: data.watchPaths || [],
84-
recurseSubmodules: data.recurseSubmodules ?? true,
85+
enableSubmodules: data.enableSubmodules ?? false,
8586
});
8687
}
8788
}, [form.reset, data, form]);
@@ -94,7 +95,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
9495
customGitSSHKeyId: values.sshKey === "none" ? null : values.sshKey,
9596
applicationId,
9697
watchPaths: values.watchPaths || [],
97-
recurseSubmodules: values.recurseSubmodules,
98+
enableSubmodules: values.enableSubmodules,
9899
})
99100
.then(async () => {
100101
toast.success("Git Provider Saved");
@@ -298,20 +299,19 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
298299
</FormItem>
299300
)}
300301
/>
302+
301303
<FormField
302304
control={form.control}
303-
name="recurseSubmodules"
305+
name="enableSubmodules"
304306
render={({ field }) => (
305307
<FormItem className="flex items-center space-x-2">
306308
<FormControl>
307-
<input
308-
type="checkbox"
309+
<Switch
309310
checked={field.value}
310-
onChange={field.onChange}
311-
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
311+
onCheckedChange={field.onChange}
312312
/>
313313
</FormControl>
314-
<FormLabel>Recurse Submodules</FormLabel>
314+
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
315315
</FormItem>
316316
)}
317317
/>

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
SelectTrigger,
3131
SelectValue,
3232
} from "@/components/ui/select";
33+
import { Switch } from "@/components/ui/switch";
3334
import {
3435
Tooltip,
3536
TooltipContent,
@@ -57,7 +58,7 @@ const GithubProviderSchema = z.object({
5758
branch: z.string().min(1, "Branch is required"),
5859
githubId: z.string().min(1, "Github Provider is required"),
5960
watchPaths: z.array(z.string()).optional(),
60-
recurseSubmodules: z.boolean().default(true),
61+
enableSubmodules: z.boolean().default(false),
6162
});
6263

6364
type GithubProvider = z.infer<typeof GithubProviderSchema>;
@@ -82,7 +83,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
8283
},
8384
githubId: "",
8485
branch: "",
85-
recurseSubmodules: true,
86+
enableSubmodules: false,
8687
},
8788
resolver: zodResolver(GithubProviderSchema),
8889
});
@@ -126,7 +127,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
126127
buildPath: data.buildPath || "/",
127128
githubId: data.githubId || "",
128129
watchPaths: data.watchPaths || [],
129-
recurseSubmodules: data.recurseSubmodules ?? true,
130+
enableSubmodules: data.enableSubmodules ?? false,
130131
});
131132
}
132133
}, [form.reset, data, form]);
@@ -140,7 +141,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
140141
buildPath: data.buildPath,
141142
githubId: data.githubId,
142143
watchPaths: data.watchPaths || [],
143-
recurseSubmodules: data.recurseSubmodules,
144+
enableSubmodules: data.enableSubmodules,
144145
})
145146
.then(async () => {
146147
toast.success("Service Provided Saved");
@@ -462,20 +463,19 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
462463
</FormItem>
463464
)}
464465
/>
466+
465467
<FormField
466468
control={form.control}
467-
name="recurseSubmodules"
469+
name="enableSubmodules"
468470
render={({ field }) => (
469471
<FormItem className="flex items-center space-x-2">
470472
<FormControl>
471-
<input
472-
type="checkbox"
473+
<Switch
473474
checked={field.value}
474-
onChange={field.onChange}
475-
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
475+
onCheckedChange={field.onChange}
476476
/>
477477
</FormControl>
478-
<FormLabel>Recurse Submodules</FormLabel>
478+
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
479479
</FormItem>
480480
)}
481481
/>

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
SelectTrigger,
3232
SelectValue,
3333
} from "@/components/ui/select";
34+
import { Switch } from "@/components/ui/switch";
3435
import {
3536
Tooltip,
3637
TooltipContent,
@@ -60,7 +61,7 @@ const GitlabProviderSchema = z.object({
6061
branch: z.string().min(1, "Branch is required"),
6162
gitlabId: z.string().min(1, "Gitlab Provider is required"),
6263
watchPaths: z.array(z.string()).optional(),
63-
recurseSubmodules: z.boolean().default(true),
64+
enableSubmodules: z.boolean().default(false),
6465
});
6566

6667
type GitlabProvider = z.infer<typeof GitlabProviderSchema>;
@@ -87,7 +88,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
8788
},
8889
gitlabId: "",
8990
branch: "",
90-
recurseSubmodules: true,
91+
enableSubmodules: false,
9192
},
9293
resolver: zodResolver(GitlabProviderSchema),
9394
});
@@ -137,7 +138,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
137138
buildPath: data.gitlabBuildPath || "/",
138139
gitlabId: data.gitlabId || "",
139140
watchPaths: data.watchPaths || [],
140-
recurseSubmodules: data.recurseSubmodules ?? true,
141+
enableSubmodules: data.enableSubmodules ?? false,
141142
});
142143
}
143144
}, [form.reset, data, form]);
@@ -153,7 +154,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
153154
gitlabProjectId: data.repository.id,
154155
gitlabPathNamespace: data.repository.gitlabPathNamespace,
155156
watchPaths: data.watchPaths || [],
156-
recurseSubmodules: data.recurseSubmodules,
157+
enableSubmodules: data.enableSubmodules,
157158
})
158159
.then(async () => {
159160
toast.success("Service Provided Saved");
@@ -489,18 +490,16 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
489490
/>
490491
<FormField
491492
control={form.control}
492-
name="recurseSubmodules"
493+
name="enableSubmodules"
493494
render={({ field }) => (
494495
<FormItem className="flex items-center space-x-2">
495496
<FormControl>
496-
<input
497-
type="checkbox"
497+
<Switch
498498
checked={field.value}
499-
onChange={field.onChange}
500-
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
499+
onCheckedChange={field.onChange}
501500
/>
502501
</FormControl>
503-
<FormLabel>Recurse Submodules</FormLabel>
502+
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
504503
</FormItem>
505504
)}
506505
/>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
SelectTrigger,
3232
SelectValue,
3333
} from "@/components/ui/select";
34+
import { Switch } from "@/components/ui/switch";
3435
import {
3536
Tooltip,
3637
TooltipContent,
@@ -58,6 +59,7 @@ const BitbucketProviderSchema = z.object({
5859
branch: z.string().min(1, "Branch is required"),
5960
bitbucketId: z.string().min(1, "Bitbucket Provider is required"),
6061
watchPaths: z.array(z.string()).optional(),
62+
enableSubmodules: z.boolean().default(false),
6163
});
6264

6365
type BitbucketProvider = z.infer<typeof BitbucketProviderSchema>;
@@ -84,6 +86,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
8486
bitbucketId: "",
8587
branch: "",
8688
watchPaths: [],
89+
enableSubmodules: false,
8790
},
8891
resolver: zodResolver(BitbucketProviderSchema),
8992
});
@@ -130,6 +133,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
130133
composePath: data.composePath,
131134
bitbucketId: data.bitbucketId || "",
132135
watchPaths: data.watchPaths || [],
136+
enableSubmodules: data.enableSubmodules ?? false,
133137
});
134138
}
135139
}, [form.reset, data, form]);
@@ -145,6 +149,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
145149
sourceType: "bitbucket",
146150
composeStatus: "idle",
147151
watchPaths: data.watchPaths,
152+
enableSubmodules: data.enableSubmodules,
148153
})
149154
.then(async () => {
150155
toast.success("Service Provided Saved");
@@ -469,6 +474,21 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
469474
</FormItem>
470475
)}
471476
/>
477+
<FormField
478+
control={form.control}
479+
name="enableSubmodules"
480+
render={({ field }) => (
481+
<FormItem className="flex items-center space-x-2">
482+
<FormControl>
483+
<Switch
484+
checked={field.value}
485+
onCheckedChange={field.onChange}
486+
/>
487+
</FormControl>
488+
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
489+
</FormItem>
490+
)}
491+
/>
472492
</div>
473493
<div className="flex w-full justify-end">
474494
<Button

apps/dokploy/components/dashboard/compose/general/generic/save-git-provider-compose.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
SelectTrigger,
2020
SelectValue,
2121
} from "@/components/ui/select";
22+
import { Switch } from "@/components/ui/switch";
2223
import {
2324
Tooltip,
2425
TooltipContent,
@@ -43,6 +44,7 @@ const GitProviderSchema = z.object({
4344
branch: z.string().min(1, "Branch required"),
4445
sshKey: z.string().optional(),
4546
watchPaths: z.array(z.string()).optional(),
47+
enableSubmodules: z.boolean().default(false),
4648
});
4749

4850
type GitProvider = z.infer<typeof GitProviderSchema>;
@@ -65,6 +67,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
6567
composePath: "./docker-compose.yml",
6668
sshKey: undefined,
6769
watchPaths: [],
70+
enableSubmodules: false,
6871
},
6972
resolver: zodResolver(GitProviderSchema),
7073
});
@@ -77,6 +80,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
7780
repositoryURL: data.customGitUrl || "",
7881
composePath: data.composePath,
7982
watchPaths: data.watchPaths || [],
83+
enableSubmodules: data.enableSubmodules ?? false,
8084
});
8185
}
8286
}, [form.reset, data, form]);
@@ -91,6 +95,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
9195
composePath: values.composePath,
9296
composeStatus: "idle",
9397
watchPaths: values.watchPaths || [],
98+
enableSubmodules: values.enableSubmodules,
9499
})
95100
.then(async () => {
96101
toast.success("Git Provider Saved");
@@ -295,6 +300,21 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
295300
</FormItem>
296301
)}
297302
/>
303+
<FormField
304+
control={form.control}
305+
name="enableSubmodules"
306+
render={({ field }) => (
307+
<FormItem className="flex items-center space-x-2">
308+
<FormControl>
309+
<Switch
310+
checked={field.value}
311+
onCheckedChange={field.onChange}
312+
/>
313+
</FormControl>
314+
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
315+
</FormItem>
316+
)}
317+
/>
298318
</div>
299319

300320
<div className="flex flex-row justify-end">

apps/dokploy/components/dashboard/compose/general/generic/save-gitea-provider-compose.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
SelectTrigger,
3232
SelectValue,
3333
} from "@/components/ui/select";
34+
import { Switch } from "@/components/ui/switch";
3435
import {
3536
Tooltip,
3637
TooltipContent,
@@ -59,6 +60,7 @@ const GiteaProviderSchema = z.object({
5960
branch: z.string().min(1, "Branch is required"),
6061
giteaId: z.string().min(1, "Gitea Provider is required"),
6162
watchPaths: z.array(z.string()).optional(),
63+
enableSubmodules: z.boolean().default(false),
6264
});
6365

6466
type GiteaProvider = z.infer<typeof GiteaProviderSchema>;
@@ -83,6 +85,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
8385
giteaId: "",
8486
branch: "",
8587
watchPaths: [],
88+
enableSubmodules: false,
8689
},
8790
resolver: zodResolver(GiteaProviderSchema),
8891
});
@@ -136,6 +139,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
136139
composePath: data.composePath || "./docker-compose.yml",
137140
giteaId: data.giteaId || "",
138141
watchPaths: data.watchPaths || [],
142+
enableSubmodules: data.enableSubmodules ?? false,
139143
});
140144
}
141145
}, [form.reset, data, form]);
@@ -151,6 +155,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
151155
sourceType: "gitea",
152156
composeStatus: "idle",
153157
watchPaths: data.watchPaths,
158+
enableSubmodules: data.enableSubmodules,
154159
} as any)
155160
.then(async () => {
156161
toast.success("Service Provider Saved");
@@ -469,6 +474,21 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
469474
</FormItem>
470475
)}
471476
/>
477+
<FormField
478+
control={form.control}
479+
name="enableSubmodules"
480+
render={({ field }) => (
481+
<FormItem className="flex items-center space-x-2">
482+
<FormControl>
483+
<Switch
484+
checked={field.value}
485+
onCheckedChange={field.onChange}
486+
/>
487+
</FormControl>
488+
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
489+
</FormItem>
490+
)}
491+
/>
472492
</div>
473493

474494
<div className="flex justify-end">

0 commit comments

Comments
 (0)