diff --git a/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx b/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx index c5c4d47e..1d5cf080 100644 --- a/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx +++ b/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx @@ -51,6 +51,7 @@ const commonCronExpressions = [ const formSchema = z.object({ name: z.string().min(1, "Name is required"), cronExpression: z.string().min(1, "Cron expression is required"), + shellType: z.enum(["bash", "sh"]).default("bash"), command: z.string().min(1, "Command is required"), enabled: z.boolean().default(true), }); @@ -68,6 +69,7 @@ export const HandleSchedules = ({ applicationId, scheduleId }: Props) => { defaultValues: { name: "", cronExpression: "", + shellType: "bash", command: "", enabled: true, }, @@ -79,25 +81,28 @@ export const HandleSchedules = ({ applicationId, scheduleId }: Props) => { ); useEffect(() => { - if (scheduleId) { + if (scheduleId && schedule) { form.reset({ - name: schedule?.name, - cronExpression: schedule?.cronExpression, - command: schedule?.command, - enabled: schedule?.enabled, + name: schedule.name, + cronExpression: schedule.cronExpression, + shellType: schedule.shellType, + command: schedule.command, + enabled: schedule.enabled, }); } - }, [form, form.reset, schedule]); + }, [form, schedule, scheduleId]); const { mutateAsync, isLoading } = scheduleId ? api.schedule.update.useMutation() : api.schedule.create.useMutation(); const onSubmit = async (values: z.infer) => { + if (!applicationId && !scheduleId) return; + await mutateAsync({ ...values, - ...(scheduleId && { scheduleId }), - ...(applicationId && { applicationId }), + scheduleId: scheduleId || "", + applicationId: applicationId || "", }) .then(() => { toast.success( @@ -120,19 +125,18 @@ export const HandleSchedules = ({ applicationId, scheduleId }: Props) => { ) : ( )} - {scheduleId} {scheduleId ? "Edit" : "Create"} Schedule @@ -214,6 +218,37 @@ export const HandleSchedules = ({ applicationId, scheduleId }: Props) => { )} /> + ( + + + + Shell Type + + + + Choose the shell to execute your command + + + + )} + /> + { )} /> +