From 689c689487c8bfce997e83080c118924e9d8efe5 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 30 Nov 2025 12:34:12 -0600 Subject: [PATCH] feat: set default date range to last 3 days in ShowRequests component - Introduced a function to automatically set the date range to the last 3 days upon component initialization. - Updated the reset button to restore the default date range instead of clearing the dates. --- .../dashboard/requests/show-requests.tsx | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/dokploy/components/dashboard/requests/show-requests.tsx b/apps/dokploy/components/dashboard/requests/show-requests.tsx index ab602f463..3b5315c3e 100644 --- a/apps/dokploy/components/dashboard/requests/show-requests.tsx +++ b/apps/dokploy/components/dashboard/requests/show-requests.tsx @@ -51,13 +51,19 @@ export const ShowRequests = () => { const { mutateAsync: updateLogCleanup } = api.settings.updateLogCleanup.useMutation(); const [cronExpression, setCronExpression] = useState(null); + + // Set default date range to last 3 days + const getDefaultDateRange = () => { + const to = new Date(); + const from = new Date(); + from.setDate(from.getDate() - 3); + return { from, to }; + }; + const [dateRange, setDateRange] = useState<{ from: Date | undefined; to: Date | undefined; - }>({ - from: undefined, - to: undefined, - }); + }>(getDefaultDateRange()); useEffect(() => { if (logCleanupStatus) { @@ -169,17 +175,13 @@ export const ShowRequests = () => { {isActive ? ( <>
- {(dateRange.from || dateRange.to) && ( - - )} +