From 0ea264ea42b1f8b165ff4c69f1c387a7002b9ab8 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Fri, 2 May 2025 03:26:05 -0600 Subject: [PATCH] Enhance schedule management UI - Updated `HandleSchedules` component to include predefined cron expressions and improved form descriptions for better user guidance. - Refactored `ShowSchedules` component to utilize a card layout, enhancing visual presentation and user experience. - Added icons and tooltips for better context on schedule creation and management actions. - Improved accessibility and responsiveness of the schedule management interface. --- .../schedules/handle-schedules.tsx | 105 ++++++++++- .../application/schedules/show-schedules.tsx | 171 +++++++++++------- 2 files changed, 201 insertions(+), 75 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx b/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx index ef42d2c5e..adf03c5b7 100644 --- a/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx +++ b/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx @@ -6,12 +6,37 @@ import { FormItem, FormLabel, FormMessage, + FormDescription, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; +import { Clock, Terminal, Info } from "lucide-react"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; + +const commonCronExpressions = [ + { label: "Every minute", value: "* * * * *" }, + { label: "Every hour", value: "0 * * * *" }, + { label: "Every day at midnight", value: "0 0 * * *" }, + { label: "Every Sunday at midnight", value: "0 0 * * 0" }, + { label: "Every month on the 1st at midnight", value: "0 0 1 * *" }, + { label: "Every 15 minutes", value: "*/15 * * * *" }, + { label: "Every weekday at midnight", value: "0 0 * * 1-5" }, +]; const formSchema = z.object({ name: z.string().min(1, "Name is required"), @@ -82,16 +107,22 @@ export const HandleSchedules = ({ return (
diff --git a/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx b/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx index f008bcb46..d4d2615b1 100644 --- a/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx +++ b/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx @@ -17,6 +17,9 @@ import { import { api } from "@/utils/api"; import { useState } from "react"; import { HandleSchedules } from "./handle-schedules"; +import { PlusCircle, Clock, Terminal, Trash2, Edit2 } from "lucide-react"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; interface Props { applicationId: string; @@ -49,71 +52,107 @@ export const ShowSchedules = ({ applicationId }: Props) => { }; return ( -+ No scheduled tasks found +
+