This commit is contained in:
@@ -126,7 +126,7 @@ Rail trái → flyout submenu → content (`www/nav.js`).
|
||||
|--------|-------------------------|---------|------------|
|
||||
| **Dashboards** | Danh sách động → `dashboard` | `dashboard.js` | ✅ |
|
||||
| **Setup** | missions, maps, sounds, transitions, users, user-groups, io-modules, paths, path-guides, build-robot → `config` | `*.js` | 🔶 |
|
||||
| **Monitoring** | monitoring-log → `monitoring` | — | ⏳ |
|
||||
| **Monitoring** | analytics (mặc định), system log, error logs, hardware, safety, mission log → `monitoring` | — | ✅ |
|
||||
| **System** | integrations → `integrations` | `integrations.js` | 🔶 |
|
||||
| **Help** | help-api → `help` | — | ⏳ |
|
||||
|
||||
@@ -276,11 +276,58 @@ API: `/api/layouts`, `/api/lidars`, `/api/imus`, `/api/state`. File: `www/app.js
|
||||
|
||||
---
|
||||
|
||||
## 5. Monitoring — ⏳
|
||||
## 5. Monitoring — ✅
|
||||
|
||||
Trang `pageMonitoring`: placeholder «System log — đang phát triển».
|
||||
Flyout 6 mục (giống MiR): **Analytics**, **System log**, **Error logs**, **Hardware health**, **Safety system**, **Mission log**.
|
||||
Frontend: `www/monitoring.js` (poll ~2.5s), layout `www/index.html`, style `www/style.css`, i18n `www/i18n.js`.
|
||||
Backend: `src/monitoring/monitoring_service.*`, routes `src/server/api_monitoring_routes.cpp`, mission persist trong `src/storage/mission_run_store.*`.
|
||||
|
||||
**Chưa có:** Analytics, Error logs, Hardware health, Safety system, Mission log browser.
|
||||
### 5.1 Analytics — ✅
|
||||
- **UI**: chọn `Start date` / `End date`; preset (current week/7d/30d/365d); `Grouping` day/month; chart mode **Bar graph** / **Accumulated**.
|
||||
- **API**: `GET /api/monitoring/analytics?start=YYYY-MM-DD&end=YYYY-MM-DD&grouping=day|month`
|
||||
- **Data**: document SQLite `monitoring_analytics` (tích lũy khi robot di chuyển; tick từ `RobotRuntime`).
|
||||
|
||||
### 5.2 System log — ✅
|
||||
- **UI**: bảng `State` (dot màu), `Module`, `Message`, `Time`; filter + pager; refresh.
|
||||
- **API**: `GET /api/monitoring/system_log`
|
||||
- **Data**: document SQLite `monitoring_system_log` (sự kiện hệ thống + một phần sự kiện error).
|
||||
|
||||
### 5.3 Error logs — ✅
|
||||
- **UI**: bảng `Description`, `Module`, `Time`; nút **Generate log** (user log); **Delete all**; xóa từng dòng; **Download** từng log.
|
||||
- **API**:
|
||||
- `GET /api/monitoring/error_logs`
|
||||
- `POST /api/monitoring/error_logs/generate`
|
||||
- `DELETE /api/monitoring/error_logs`
|
||||
- `DELETE /api/monitoring/error_logs/<id>`
|
||||
- `GET /api/monitoring/error_logs/<id>/download`
|
||||
- **Data**: document SQLite `monitoring_error_logs` (+ action snapshot ring `monitoring_action_ring`).
|
||||
|
||||
### 5.4 Hardware health — ✅
|
||||
- **UI**: accordion nhóm (Computer, Motors, Power system, Safety system, Sensors, Modbus) → expand xem component.
|
||||
- **API**: `GET /api/monitoring/hardware_health`
|
||||
- **Data**: ghép từ `robot_status` + `StateRepository` (Build robot: LiDAR/IMU).
|
||||
|
||||
### 5.5 Safety system — ✅
|
||||
- **UI**: live cards (E-stop, Front scanner, Rear scanner) với trạng thái Free/Blocked, Released/Activated.
|
||||
- **API**: `GET /api/monitoring/safety`
|
||||
- **Data**: từ `robot_status.safety` (hiện default/placeholder nếu chưa có phần cứng thật).
|
||||
|
||||
### 5.6 Mission log — ✅ (MiR-like, có lịch sử bền vững)
|
||||
- **UI**: bảng Mission/State/Message/Start time/Ran for/Started by; filter + pager; **View action log** (icon mắt); Phase 3/4: **Delete history**, xóa từng run, **Download run bundle**.
|
||||
- **API**:
|
||||
- Queue hiện tại: `GET /api/mission_queue`
|
||||
- Lịch sử persist:
|
||||
- `GET /api/monitoring/mission_runs?limit=N`
|
||||
- `GET /api/monitoring/mission_runs/<id>/actions`
|
||||
- `DELETE /api/monitoring/mission_runs` (clear history)
|
||||
- `DELETE /api/monitoring/mission_runs/<id>`
|
||||
- `GET /api/monitoring/mission_runs/<id>/download` (Phase 4 bundle JSON: run + actions + robot snapshot)
|
||||
- **Data**:
|
||||
- Queue: document SQLite `mission_queue` (mất khi clear queue)
|
||||
- History: tables `mission_runs`, `mission_run_actions` (không mất khi clear queue)
|
||||
- **Retention** (Phase 4): giữ tối đa ~2000 runs gần nhất (DB bounded history).
|
||||
|
||||
**Chưa có (so với MiR)**: error log file mã hóa gửi Support; retention cấu hình qua UI; safety/hardware đọc từ phần cứng thật (thay vì stub/snapshot).
|
||||
|
||||
---
|
||||
|
||||
@@ -302,6 +349,22 @@ File: `www/integrations.js`.
|
||||
|
||||
**Chưa có:** Settings, Backups, PLC registers UI, Processes, Software versions; sửa trigger/schedule (chỉ add/delete).
|
||||
|
||||
### 6.1 System — Settings — ✅
|
||||
|
||||
Trang Settings theo style MiR (card/section + Apply). Frontend: `www/settings.js`.
|
||||
|
||||
**Nhóm Logging & retention:**
|
||||
- `retention_mission_runs`: số mission runs lịch sử tối đa (bounded history; ảnh hưởng Mission log Phase 3/4).
|
||||
- `retention_system_log`: số dòng system log tối đa.
|
||||
- `retention_error_logs`: số dòng error log tối đa.
|
||||
- `log_level`: `error|warn|info|debug` (hiện mới dùng làm setting; chưa ảnh hưởng sâu tới backend logging).
|
||||
|
||||
**API:**
|
||||
- `GET /api/settings`
|
||||
- `PUT /api/settings`
|
||||
|
||||
**Data:** document SQLite `settings`. Retention được áp dụng khi ghi log/runs mới (trim tự động).
|
||||
|
||||
---
|
||||
|
||||
## 7. Help — ⏳
|
||||
@@ -333,13 +396,13 @@ Xác thực: session cookie hoặc Bearer (ưu tiên session web); tích hợp n
|
||||
## 9. Tóm tắt triển khai
|
||||
|
||||
```
|
||||
✅ Hoàn thiện tốt: Sign in, Users, User groups, Sounds, Transitions, Path guides
|
||||
✅ Hoàn thiện tốt: Sign in, Users, User groups, Sounds, Transitions, Path guides, Monitoring
|
||||
🔶 Đang dùng được: Dashboard, Missions, Maps, I/O, Paths, Integrations, Topbar, Build robot
|
||||
⏳ Placeholder: Monitoring, Help, Robot summary widget, PLC tab
|
||||
⏳ Placeholder: Help, Robot summary widget, PLC tab
|
||||
❌ Chưa bắt đầu: Shelf types, Analytics/Error logs/Hardware/Safety, System Settings/Backups
|
||||
```
|
||||
|
||||
**File frontend chính:** `index.html`, `nav.js`, `topbar.js`, `auth.js`, `app.js`, `dashboard.js`, `missions.js`, `maps.js`, `map-editor.js`, `sounds.js`, `transitions.js`, `users.js`, `user-groups.js`, `io-modules.js`, `paths.js`, `path-guides.js`, `integrations.js`, `style.css`, `i18n.js`.
|
||||
**File frontend chính:** `index.html`, `nav.js`, `topbar.js`, `auth.js`, `app.js`, `dashboard.js`, `missions.js`, `maps.js`, `map-editor.js`, `sounds.js`, `transitions.js`, `users.js`, `user-groups.js`, `io-modules.js`, `paths.js`, `path-guides.js`, `integrations.js`, `monitoring.js`, `style.css`, `i18n.js`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user