mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-09 21:45:17 +00:00
refactor(certificate): remove auto-renew field from certificate handling
- Eliminated the `autoRenew` field from the certificate schema, API router, and related components to streamline certificate management. - Updated form handling and validation logic accordingly to reflect the removal of the auto-renew feature.
This commit is contained in:
@@ -6,7 +6,6 @@ import { toast } from "sonner";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { AlertBlock } from "@/components/shared/alert-block";
|
import { AlertBlock } from "@/components/shared/alert-block";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -52,7 +51,6 @@ const handleCertificateSchema = z.object({
|
|||||||
name: z.string().min(1, "Name is required"),
|
name: z.string().min(1, "Name is required"),
|
||||||
certificateData: z.string().min(1, "Certificate data is required"),
|
certificateData: z.string().min(1, "Certificate data is required"),
|
||||||
privateKey: z.string().min(1, "Private key is required"),
|
privateKey: z.string().min(1, "Private key is required"),
|
||||||
autoRenew: z.boolean().optional(),
|
|
||||||
serverId: z.string().optional(),
|
serverId: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -86,7 +84,6 @@ export const HandleCertificate = ({ certificateId }: Props) => {
|
|||||||
name: "",
|
name: "",
|
||||||
certificateData: "",
|
certificateData: "",
|
||||||
privateKey: "",
|
privateKey: "",
|
||||||
autoRenew: false,
|
|
||||||
},
|
},
|
||||||
resolver: zodResolver(handleCertificateSchema),
|
resolver: zodResolver(handleCertificateSchema),
|
||||||
});
|
});
|
||||||
@@ -97,14 +94,12 @@ export const HandleCertificate = ({ certificateId }: Props) => {
|
|||||||
name: existingCert.name,
|
name: existingCert.name,
|
||||||
certificateData: existingCert.certificateData,
|
certificateData: existingCert.certificateData,
|
||||||
privateKey: existingCert.privateKey,
|
privateKey: existingCert.privateKey,
|
||||||
autoRenew: existingCert.autoRenew ?? false,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
form.reset({
|
form.reset({
|
||||||
name: "",
|
name: "",
|
||||||
certificateData: "",
|
certificateData: "",
|
||||||
privateKey: "",
|
privateKey: "",
|
||||||
autoRenew: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [existingCert, form, open]);
|
}, [existingCert, form, open]);
|
||||||
@@ -114,7 +109,6 @@ export const HandleCertificate = ({ certificateId }: Props) => {
|
|||||||
name: data.name,
|
name: data.name,
|
||||||
certificateData: data.certificateData,
|
certificateData: data.certificateData,
|
||||||
privateKey: data.privateKey,
|
privateKey: data.privateKey,
|
||||||
autoRenew: data.autoRenew,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const promise = certificateId
|
const promise = certificateId
|
||||||
@@ -232,22 +226,6 @@ export const HandleCertificate = ({ certificateId }: Props) => {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="autoRenew"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem className="flex items-center gap-2">
|
|
||||||
<FormControl>
|
|
||||||
<Checkbox
|
|
||||||
checked={field.value}
|
|
||||||
onCheckedChange={field.onChange}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
<FormLabel className="!mt-0">Auto-renew</FormLabel>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
{shouldShowServerDropdown && (
|
{shouldShowServerDropdown && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ export const certificateRouter = createTRPCRouter({
|
|||||||
name: input.name,
|
name: input.name,
|
||||||
certificateData: input.certificateData,
|
certificateData: input.certificateData,
|
||||||
privateKey: input.privateKey,
|
privateKey: input.privateKey,
|
||||||
autoRenew: input.autoRenew,
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export const apiUpdateCertificate = z.object({
|
|||||||
name: z.string().min(1).optional(),
|
name: z.string().min(1).optional(),
|
||||||
certificateData: z.string().min(1).optional(),
|
certificateData: z.string().min(1).optional(),
|
||||||
privateKey: z.string().min(1).optional(),
|
privateKey: z.string().min(1).optional(),
|
||||||
autoRenew: z.boolean().optional(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const apiDeleteCertificate = z.object({
|
export const apiDeleteCertificate = z.object({
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ export const updateCertificate = async (
|
|||||||
name?: string;
|
name?: string;
|
||||||
certificateData?: string;
|
certificateData?: string;
|
||||||
privateKey?: string;
|
privateKey?: string;
|
||||||
autoRenew?: boolean;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const updated = await db
|
const updated = await db
|
||||||
|
|||||||
Reference in New Issue
Block a user