feat: Phase 2 — frontend-backend integration complete

- All 5 core pages now use real API instead of mock data
  - Dashboard: /api/v1/dashboard/stats
  - Tickets: list/create/detail/approve/execute/statistics
  - Users: list/create/toggle-active/delete
  - Instances: list/create/test-connection/delete
  - Queries: execute with result display + sensitive field masking
- Updated DashboardStats type to match backend schema
- Fixed InstancePage to work with InstanceResponse (no qps/cpu/metrics yet)
- Added create forms for Tickets, Users, Instances
- Added connection test in InstanceDetail
- Updated TDD_PLAN.md: Phase 1 ✅ (44 tests), Phase 2 ✅
- Updated ROADMAP.md: v0.2.0 ✅
- Updated PROJECT_EVALUATION.md: score 5.7 → 6.2
- Frontend build passes with zero TS errors
- 44 backend tests still passing
This commit is contained in:
logan committed 2026-05-22 12:39:48 +08:00
1 parent c0c731acfc
commit 27989274f5
10 files changed
+1074 -840

No files matched your search

+21 -13
View File
@@ -41,22 +41,30 @@
- [x] Mock 数据层 (lib/mock.ts)
- [x] 主题切换 (dark/light)
### v0.2.0 — 前后端打通 + 核心功能完善 🔜
### v0.2.0 — 前后端打通 + 核心功能完善 ✅
**优先级 P0 — 必须完成:**
- [ ] **前端对接真实 API** — 替换所有 mock 数据调用
- Dashboard 对接 `/api/v1/dashboard/stats`
- 工单对接 `/api/v1/tickets`
- 查询对接 `/api/v1/query`
- 实例对接 `/api/v1/instances`
- 用户对接 `/api/v1/users`
- [ ] **Vite proxy 配置** — 开发环境 API 代理到后端 9000 端口
**已完成:**
- [x] **44 个后端 API 测试全部通过** (pytest)
- auth: 8 (登录/登出/token验证/过期/禁用)
- users: 8 (CRUD/权限/删自己)
- instances: 8 (CRUD/连接测试mock/权限)
- tickets: 11 (列表过滤/CRUD/审批/拒绝/执行/统计/分页)
- query: 4 (SELECT/DROP拒绝/DELETE拒绝/guest禁止)
- dashboard: 2 (统计数据/未登录)
- [x] **前端对接真实 API** — 所有页面已替换 mock 数据
- Dashboard → `/api/v1/dashboard/stats`
- 工单 → `/api/v1/tickets` (列表/创建/详情/审批/执行/统计)
- 查询 → `/api/v1/query` (执行+结果展示+敏感字段脱敏)
- 实例 → `/api/v1/instances` (列表/创建/连接测试)
- 用户 → `/api/v1/users` (列表/创建/切换状态/删除)
- [x] **Vite proxy 配置** — `/api` → `http://localhost:9000`
- [x] **前端 TypeScript 编译通过** — build 无错误
**待完成:**
- [ ] **SQLite → MySQL** 生产数据库迁移支持
**优先级 P1 — 重要:**
- [ ] **密码加密存储** — Instance.password 字段加密/解密
- [ ] **SQL 审核引擎** — 基于 AST 的 SQL 规则检查 (非关键词匹配)
- [ ] **工单自动审核** — 提交时自动跑审核规则,生成 audit_result
- [ ] **SQL 审核引擎** — 基于 AST 的 SQL 规则检查
- [ ] **工单自动审核** — 提交时自动跑审核规则
- [ ] **操作审计日志完善** — 所有关键操作记录 AuditLog
### v0.3.0 — 审核规则 + 工作流