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.

This commit is contained in:
Mauricio Siu
2025-04-26 16:35:02 -06:00
parent 1911b5b674
commit ceb16ae9f7
22 changed files with 11000 additions and 97 deletions

View File

@@ -23,6 +23,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { Switch } from "@/components/ui/switch";
import { api } from "@/utils/api";
import { zodResolver } from "@hookform/resolvers/zod";
import { KeyRoundIcon, LockIcon, X } from "lucide-react";
@@ -44,7 +45,7 @@ const GitProviderSchema = z.object({
branch: z.string().min(1, "Branch required"),
sshKey: z.string().optional(),
watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true),
enableSubmodules: z.boolean().default(false),
});
type GitProvider = z.infer<typeof GitProviderSchema>;
@@ -68,7 +69,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
repositoryURL: "",
sshKey: undefined,
watchPaths: [],
recurseSubmodules: true,
enableSubmodules: false,
},
resolver: zodResolver(GitProviderSchema),
});
@@ -81,7 +82,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
buildPath: data.customGitBuildPath || "/",
repositoryURL: data.customGitUrl || "",
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true,
enableSubmodules: data.enableSubmodules ?? false,
});
}
}, [form.reset, data, form]);
@@ -94,7 +95,7 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
customGitSSHKeyId: values.sshKey === "none" ? null : values.sshKey,
applicationId,
watchPaths: values.watchPaths || [],
recurseSubmodules: values.recurseSubmodules,
enableSubmodules: values.enableSubmodules,
})
.then(async () => {
toast.success("Git Provider Saved");
@@ -298,20 +299,19 @@ export const SaveGitProvider = ({ applicationId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="recurseSubmodules"
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<input
type="checkbox"
<Switch
checked={field.value}
onChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel>Recurse Submodules</FormLabel>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>

View File

@@ -30,6 +30,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import {
Tooltip,
TooltipContent,
@@ -57,7 +58,7 @@ const GithubProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"),
githubId: z.string().min(1, "Github Provider is required"),
watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true),
enableSubmodules: z.boolean().default(false),
});
type GithubProvider = z.infer<typeof GithubProviderSchema>;
@@ -82,7 +83,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
},
githubId: "",
branch: "",
recurseSubmodules: true,
enableSubmodules: false,
},
resolver: zodResolver(GithubProviderSchema),
});
@@ -126,7 +127,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
buildPath: data.buildPath || "/",
githubId: data.githubId || "",
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true,
enableSubmodules: data.enableSubmodules ?? false,
});
}
}, [form.reset, data, form]);
@@ -140,7 +141,7 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
buildPath: data.buildPath,
githubId: data.githubId,
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules,
enableSubmodules: data.enableSubmodules,
})
.then(async () => {
toast.success("Service Provided Saved");
@@ -462,20 +463,19 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="recurseSubmodules"
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<input
type="checkbox"
<Switch
checked={field.value}
onChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel>Recurse Submodules</FormLabel>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>

View File

@@ -31,6 +31,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import {
Tooltip,
TooltipContent,
@@ -60,7 +61,7 @@ const GitlabProviderSchema = z.object({
branch: z.string().min(1, "Branch is required"),
gitlabId: z.string().min(1, "Gitlab Provider is required"),
watchPaths: z.array(z.string()).optional(),
recurseSubmodules: z.boolean().default(true),
enableSubmodules: z.boolean().default(false),
});
type GitlabProvider = z.infer<typeof GitlabProviderSchema>;
@@ -87,7 +88,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
},
gitlabId: "",
branch: "",
recurseSubmodules: true,
enableSubmodules: false,
},
resolver: zodResolver(GitlabProviderSchema),
});
@@ -137,7 +138,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
buildPath: data.gitlabBuildPath || "/",
gitlabId: data.gitlabId || "",
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules ?? true,
enableSubmodules: data.enableSubmodules ?? false,
});
}
}, [form.reset, data, form]);
@@ -153,7 +154,7 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
gitlabProjectId: data.repository.id,
gitlabPathNamespace: data.repository.gitlabPathNamespace,
watchPaths: data.watchPaths || [],
recurseSubmodules: data.recurseSubmodules,
enableSubmodules: data.enableSubmodules,
})
.then(async () => {
toast.success("Service Provided Saved");
@@ -489,18 +490,16 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
/>
<FormField
control={form.control}
name="recurseSubmodules"
name="enableSubmodules"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<input
type="checkbox"
<Switch
checked={field.value}
onChange={field.onChange}
className="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
onCheckedChange={field.onChange}
/>
</FormControl>
<FormLabel>Recurse Submodules</FormLabel>
<FormLabel className="!mt-0">Enable Submodules</FormLabel>
</FormItem>
)}
/>