feat(scheduled-tasks): add cron syntax support to task editor dialog (#1593)

Adds a 'Cron' schedule type option to the scheduled task editor, allowing
users to create and edit cron-based schedules through the UI.

- Add cron expression input with inline validation (cron-parser)
- Show next 4 upcoming run times as a preview
- Provide clickable example chips (every 5min, hourly, Monday 9am, etc.)
- Preserve cron expressions when editing existing cron tasks
- Add cron.ts utility module for validation and next-run computation
- Add i18n keys across all 8 locale files

Closes #1586

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Tom Rochette
2026-06-16 11:03:42 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent e904abda04
commit e402cd75f5
14 changed files with 341 additions and 18 deletions
@@ -227,6 +227,7 @@ export const dict: Record<I18nKey, string> = {
'sessions.scheduledTasks.editor.scheduleType.daily': '每天',
'sessions.scheduledTasks.editor.scheduleType.weekly': '每週',
'sessions.scheduledTasks.editor.scheduleType.once': '一次性',
'sessions.scheduledTasks.editor.scheduleType.cron': 'Cron',
'sessions.scheduledTasks.editor.date.label': '日期',
'sessions.scheduledTasks.editor.date.placeholder': '選擇日期',
'sessions.scheduledTasks.editor.date.previousMonth': '上個月',
@@ -265,6 +266,17 @@ export const dict: Record<I18nKey, string> = {
'sessions.scheduledTasks.editor.validation.atLeastOneTime': '請至少新增一個有效時間',
'sessions.scheduledTasks.editor.validation.atLeastOneWeekday': '請至少選擇一個星期',
'sessions.scheduledTasks.editor.validation.timezoneRequired': '時區為必填項',
'sessions.scheduledTasks.editor.validation.cronRequired': 'Cron 表達式為必填項',
'sessions.scheduledTasks.editor.validation.cronInvalid': 'Cron 表達式無效',
'sessions.scheduledTasks.editor.cronExpression.label': 'Cron 表達式',
'sessions.scheduledTasks.editor.cronExpression.placeholder': '*/5 * * * *',
'sessions.scheduledTasks.editor.cronExpression.nextRuns': '下次執行',
'sessions.scheduledTasks.editor.cronExpression.examples': '範例',
'sessions.scheduledTasks.editor.cronExpression.examples.every5min': '每 5 分鐘',
'sessions.scheduledTasks.editor.cronExpression.examples.everyHour': '每小時',
'sessions.scheduledTasks.editor.cronExpression.examples.monday9am': '每週一上午 9 點',
'sessions.scheduledTasks.editor.cronExpression.examples.9am5pm': '每天上午 9 點和下午 5 點',
'sessions.scheduledTasks.editor.cronExpression.examples.firstOfMonth': '每月第一天',
'multirun.launcher.title': '新增 Multi-run',
'multirun.launcher.actions.closeEsc': '關閉 (Esc)',
'multirun.launcher.actions.cancel': '取消',