Files
Nexus/docs/design/specs/2026-06-08-schedule-cycle-picker-design.md
T
Nexus Agent 08a0157c95 feat: 调度表单重构、登录门控、批量任务与页面缓存对齐
调度页执行周期可视化/单次执行/分类选机/推送源对齐;登录 IP 门控与无缝导航;
服务器批量后台任务、执行记录、凭据合并、各页激活刷新与错误提示修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 11:17:21 +08:00

44 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 调度执行周期可视化 — 设计
## 背景
新建/编辑调度时要求手工填写 5 字段 Cron,运维成本高且易错。宝塔面板(aaPanel)通过「执行周期」下拉 + 参数表单生成 Cron,体验更直观。
## 目标
- 循环调度:用「执行周期」选择器替代 Cron 文本框
- 一次性调度:保留「指定日期(年-月-日 时:分)」
- 列表展示人类可读周期标签,底层仍存 `cron_expr`
- 与现有 `schedule_runner` 完全兼容,不改 DB schema
## 方案
| 周期类型 | 宝塔 type | 生成 Cron |
|---------|-----------|-----------|
| 每天 | day | `{分} {时} * * *` |
| 每 N 天 | day-n | `{分} {时} */{N} * *` |
| 每小时 | hour | `{分} * * * *` |
| 每 N 小时 | hour-n | `{分} */{N} * * *` |
| 每 N 分钟 | minute-n | `*/{N} * * * *` |
> **不含「每 N 秒」**runner 60s 轮询,秒级 Cron 与 minute-n 无法 roundtrip;最短周期为 1 分钟。
| 每周 | week | `{分} {时} * * {周}` |
| 每月 | month | `{分} {时} {日} * *` |
秒级:runner 60s 轮询,**不提供「每 N 秒」**(与 minute-n Cron 无法 roundtrip);最短 **1 分钟**
无法反解析的历史 Cron → `custom` 模式保留原表达式编辑。
## 涉及文件
- `frontend/src/utils/scheduleCycle.ts`
- `frontend/src/components/schedules/ScheduleCyclePicker.vue`
- `frontend/src/pages/SchedulesPage.vue`
- `server/utils/schedule_cycle.py`(单测镜像)
## 验收
- 新建各类型周期 → 保存 → 列表显示中文标签 → runner 可触发
- 编辑已有 Cron 调度 → 反解析为对应表单
- 无法识别的 Cron → 自定义模式可保存