Enhance cron job builder with "Select All" options for time units

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/d15e2650-48cd-4f25-a56f-8106c89a9940.jpg
This commit is contained in:
alphaeusmote
2025-04-11 03:38:18 +00:00
@@ -116,8 +116,8 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
const day = schedule.dayOfMonth || 1;
cronExpression = `${schedule.minute} ${schedule.hour} ${day} * *`;
break;
case 'custom':
// For custom schedules, if there's no existing cron expression, use a default
default:
// For any other schedules, if there's no existing cron expression, use a default
cronExpression = schedule.cronExpression || '0 0 * * *';
break;
}
@@ -594,6 +594,35 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
</AccordionTrigger>
<AccordionContent>
<div className="space-y-4 pt-2">
<div className="mb-2 flex justify-between items-center">
<Button
variant="outline"
size="sm"
onClick={() => {
// Select all minutes (0-59)
const allMinutes = Array.from({ length: 60 }, (_, i) => i);
updateSchedule(index, {
minutes: allMinutes,
customSchedule: true
});
}}
>
Select All
</Button>
<Button
variant="outline"
size="sm"
onClick={() => {
// Clear all selected minutes
updateSchedule(index, {
minutes: [],
customSchedule: true
});
}}
>
Clear All
</Button>
</div>
<div className="grid grid-cols-6 gap-2">
{Array.from({ length: 60 }, (_, i) => i).map((minute) => (
<Button
@@ -630,6 +659,35 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
</AccordionTrigger>
<AccordionContent>
<div className="space-y-4 pt-2">
<div className="mb-2 flex justify-between items-center">
<Button
variant="outline"
size="sm"
onClick={() => {
// Select all hours (0-23)
const allHours = Array.from({ length: 24 }, (_, i) => i);
updateSchedule(index, {
hours: allHours,
customSchedule: true
});
}}
>
Select All
</Button>
<Button
variant="outline"
size="sm"
onClick={() => {
// Clear all selected hours
updateSchedule(index, {
hours: [],
customSchedule: true
});
}}
>
Clear All
</Button>
</div>
<div className="grid grid-cols-6 gap-2">
{Array.from({ length: 24 }, (_, i) => i).map((hour) => (
<Button