Edit cron jobs in a modal with live schedule validation#244
Merged
Conversation
The pencil now opens a dialog (like task/clock time entries) holding the schedule, model, output, timeout, cloud flag, and the prompt, saved together; the expanded card shows a read-only prompt preview. Inline per-card field/prompt editing is gone. The schedule field validates as you type against the same APScheduler CronTrigger that actually runs jobs: a valid expression previews its next fire times, an invalid one (like hour 45) shows the error and blocks Save. The backend gains a /cron/validate-schedule endpoint and rejects invalid schedules on create/update as a backstop. Shared cron field bits move to cronFields.tsx so the dialog and the add-job form reuse them without importing CronView.
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Two problems with cron editing, in one feature:
06 45 * * *(hour 45) was silently accepted, never ran, and — combined with Skip cron jobs with invalid schedules instead of 500-ing every cron mutation #243 — bricked every cron mutation.What changed
Modal editor. The pencil now opens a
CronJobDialog(mirrorsTimeEntryDialog) holding schedule, model, output, timeout, cloud flag, and the prompt, saved together. The expanded card becomes a read-only prompt preview with an Edit button. Inline field/prompt editing is removed.Live schedule validation. The schedule field validates as you type against the same APScheduler
CronTriggerthat actually schedules jobs, so the verdict never drifts from runtime behaviour:New
POST /api/cron/validate-schedulepowers the live feedback;POST/PATCHalso reject an invalid schedule (400) as a backstop. Both the modal and the add-job form use the sharedScheduleField.Shared cron field bits (
MODEL_DATALIST,fieldCls,OutputSelect,ScheduleField) moved tocronFields.tsxso the dialog andCronViewreuse them without an import cycle.Verified
Drove the real app (source backend + Vite): modal opens with correct values (the stale-timeout symptom is gone), invalid schedule shows the error and blocks Save, valid edit previews next runs, saves persist, and reopening shows fresh values. Backend suite: 841 passing (4 new schedule-validation tests).
Notes
day_of_week1= Tuesday (not Monday as in standard crontab). The preview surfaces this faithfully — it shows exactly when a job will fire. Pre-existing semantics, now visible instead of surprising.