Files
Nexus/docs/changelog/2026-06-08-script-exec-global-progress-board.md
T

55 lines
2.1 KiB
Markdown
Raw Normal View History

# 2026-06-08 — 脚本执行:全局进度 + 看板 + Telegram 汇总
## 摘要
脚本批量执行改为真后台(API 立即返回 `running`);扩展 `/ws/alerts` 推送 `script_progress` / `script_complete`;全局顶栏进度条与完成 Alert+提示音;新建「脚本看板」页;Telegram 仅发成功/失败汇总与看板深链。
## 动机
366 台同步执行阻塞 HTTP 请求;用户需跨页面查看进度;失败明细应在看板而非 Telegram 长列表。
## 涉及文件
### 后端
- `server/application/services/script_service.py``asyncio` 后台批次
- `server/application/services/script_execution_notify.py` — WS + Telegram 编排
- `server/application/services/script_job_callback.py` — 长任务终态通知
- `server/infrastructure/redis/script_execution_store.py``execution_progress_stats`
- `server/api/websocket.py``broadcast_script_progress/complete`
- `server/infrastructure/telegram/__init__.py``send_telegram_script_summary`
- `server/config.py` / `server/api/settings.py``NOTIFY_SCRIPT_COMPLETE`
### 前端
- `frontend/src/composables/useScriptExecutionQueue.ts`
- `frontend/src/composables/useWebSocket.ts`
- `frontend/src/App.vue` — 全局进度与完成 Alert
- `frontend/src/pages/ScriptRunsPage.vue` — 第 15 页
- `frontend/src/pages/ScriptsPage.vue` — 移除页内批量状态面板
- `frontend/src/router/index.ts` / `frontend/src/types/api.ts`
### 文档
- `docs/project/nexus-functional-development-guide.md` — 15 页 SSOT
- `docs/changelog/2026-06-08-script-exec-global-progress-board.md`
- `docs/audit/2026-06-08-script-exec-global-progress-board.md`
## 迁移 / 重启
- 无需 DB 迁移
- 需重启 API worker;前端 `vite build` 后部署 `web/app/`
- 可选:在设置中配置 `notify_script_complete`
## 验证
```bash
pytest tests/test_script_execution_progress_stats.py tests/test_exec_detail_grouping.py -q
cd frontend && npm run build
bash scripts/local_verify.sh
```
- 提交执行后 1s 内对话框关闭,顶栏显示「已进行 X 台,剩余 Y 台」
- 结束:提示音 + AlertTelegram 仅汇总 + `#/script-runs/{id}` 链接
- WS 断线:3s 轮询直至终态