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>
)}
/>