mirror of
https://github.com/freedbygrace/ActiveDirectoryManager.git
synced 2026-08-24 08:56:26 +00:00
Enhance cron job builder with "Select All" options for time units and remove "custom" option
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/3e43a46b-eb88-40c4-b4c3-92293e8327e6.jpg
This commit is contained in:
@@ -281,10 +281,8 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
|
|||||||
return `Runs weekly on ${schedule.dayOfWeek || 'Monday'} at ${formatTime(schedule.hour, schedule.minute)}`;
|
return `Runs weekly on ${schedule.dayOfWeek || 'Monday'} at ${formatTime(schedule.hour, schedule.minute)}`;
|
||||||
case 'monthly':
|
case 'monthly':
|
||||||
return `Runs monthly on day ${schedule.dayOfMonth || 1} at ${formatTime(schedule.hour, schedule.minute)}`;
|
return `Runs monthly on day ${schedule.dayOfMonth || 1} at ${formatTime(schedule.hour, schedule.minute)}`;
|
||||||
case 'custom':
|
|
||||||
return 'Custom schedule';
|
|
||||||
default:
|
default:
|
||||||
return 'Custom schedule';
|
return 'Advanced schedule';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -724,6 +722,34 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<div className="space-y-4 pt-2">
|
<div className="space-y-4 pt-2">
|
||||||
|
<div className="mb-2 flex justify-between items-center">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
// Select all days of week
|
||||||
|
updateSchedule(index, {
|
||||||
|
daysOfWeek: [...weekdays],
|
||||||
|
customSchedule: true
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Select All
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
// Clear all selected days
|
||||||
|
updateSchedule(index, {
|
||||||
|
daysOfWeek: [],
|
||||||
|
customSchedule: true
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear All
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<div className="grid grid-cols-3 sm:grid-cols-4 gap-2">
|
<div className="grid grid-cols-3 sm:grid-cols-4 gap-2">
|
||||||
{weekdays.map((day) => (
|
{weekdays.map((day) => (
|
||||||
<Button
|
<Button
|
||||||
@@ -760,6 +786,35 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<div className="space-y-4 pt-2">
|
<div className="space-y-4 pt-2">
|
||||||
|
<div className="mb-2 flex justify-between items-center">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
// Select all days of month (1-31)
|
||||||
|
const allDays = Array.from({ length: 31 }, (_, i) => i + 1);
|
||||||
|
updateSchedule(index, {
|
||||||
|
daysOfMonth: allDays,
|
||||||
|
customSchedule: true
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Select All
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
// Clear all selected days
|
||||||
|
updateSchedule(index, {
|
||||||
|
daysOfMonth: [],
|
||||||
|
customSchedule: true
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear All
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<div className="grid grid-cols-7 gap-2">
|
<div className="grid grid-cols-7 gap-2">
|
||||||
{Array.from({ length: 31 }, (_, i) => i + 1).map((day) => (
|
{Array.from({ length: 31 }, (_, i) => i + 1).map((day) => (
|
||||||
<Button
|
<Button
|
||||||
@@ -796,6 +851,35 @@ export const CronJobBuilder: React.FC<CronJobBuilderProps> = ({
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<div className="space-y-4 pt-2">
|
<div className="space-y-4 pt-2">
|
||||||
|
<div className="mb-2 flex justify-between items-center">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
// Select all months (1-12)
|
||||||
|
const allMonths = Array.from({ length: 12 }, (_, i) => i + 1);
|
||||||
|
updateSchedule(index, {
|
||||||
|
months: allMonths,
|
||||||
|
customSchedule: true
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Select All
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
// Clear all selected months
|
||||||
|
updateSchedule(index, {
|
||||||
|
months: [],
|
||||||
|
customSchedule: true
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear All
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<div className="grid grid-cols-3 sm:grid-cols-4 gap-2">
|
<div className="grid grid-cols-3 sm:grid-cols-4 gap-2">
|
||||||
{[
|
{[
|
||||||
'January', 'February', 'March', 'April',
|
'January', 'February', 'March', 'April',
|
||||||
|
|||||||
+2
-3
@@ -154,8 +154,7 @@ export const scheduleFrequencies = [
|
|||||||
"daily",
|
"daily",
|
||||||
"weekly",
|
"weekly",
|
||||||
"monthly",
|
"monthly",
|
||||||
"yearly",
|
"yearly"
|
||||||
"custom"
|
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const weekdays = [
|
export const weekdays = [
|
||||||
@@ -172,7 +171,7 @@ export const weekdays = [
|
|||||||
export const scheduleRules = pgTable("schedule_rules", {
|
export const scheduleRules = pgTable("schedule_rules", {
|
||||||
id: serial("id").primaryKey(),
|
id: serial("id").primaryKey(),
|
||||||
ruleId: integer("rule_id").references(() => dynamicGroupRules.id, { onDelete: "cascade" }).notNull(),
|
ruleId: integer("rule_id").references(() => dynamicGroupRules.id, { onDelete: "cascade" }).notNull(),
|
||||||
frequency: text("frequency").notNull(), // once, minutely, hourly, daily, weekly, monthly, yearly, custom
|
frequency: text("frequency").notNull(), // once, minutely, hourly, daily, weekly, monthly, yearly
|
||||||
minute: integer("minute"), // 0-59
|
minute: integer("minute"), // 0-59
|
||||||
hour: integer("hour"), // 0-23
|
hour: integer("hour"), // 0-23
|
||||||
dayOfMonth: integer("day_of_month"), // 1-31
|
dayOfMonth: integer("day_of_month"), // 1-31
|
||||||
|
|||||||
Reference in New Issue
Block a user