Files
EvoBGP/memory-bank/creative/creative-runtime-logs-ui.md
DenozordecandCursor e27936c072 docs(memory-bank): add creative phase CP-2 runtime logs UI
Решение: вкладка «Файловые логи» в Monitoring с подвкладками files и audit.

Co-authored-by: Cursor <[email protected]>
2026-06-12 18:58:01 +07:00

85 lines
4.2 KiB
Markdown
Raw Permalink 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.
# Creative: Runtime Logs UI (CP-2)
📌 **CREATIVE PHASE START: Runtime Logs Web UI**
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
## 1️⃣ PROBLEM
**Description:** Оператору нужен просмотр файлов runtime-логов (`*.log` из sidecar `stack-runtime-logs`), tail/preview и sync-очистка с audit. API будет доступен только на `evobgp-all` с volume; UI должен корректно показывать `503` и направлять к документации.
**Requirements:**
- Список файлов: имя, размер, mtime
- Preview (tail) в dialog или panel
- Cleanup с ConfirmDialog (operator)
- Просмотр cleanup audit (viewer+)
- Empty/unavailable state при `503`
**Constraints:**
- Не смешивать с PostgreSQL maintenance logs (уже tab `postgres` в Monitoring)
- `AppDataTable`, `ScrollPreBlock`, `ConfirmDialog`
- Sync DELETE — UI ждёт ответ, показывает spinner на кнопке
## 2️⃣ OPTIONS
| Option | Описание |
|--------|----------|
| **A** | Новая вкладка **«Файловые логи»** в `/monitoring` (`?tab=runtime-logs`) |
| **B** | Отдельный route `/runtime-logs` в mainNav |
| **C** | Секция в Operations (рядом с jobs) |
| **D** | Подвкладка внутри Monitoring → PostgreSQL |
## 3️⃣ ANALYSIS
| Criterion | A Monitoring tab | B Own route | C Operations | D Under Postgres |
|-----------|------------------|-------------|--------------|------------------|
| Логическая группировка | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ | ⭐ |
| Переиспользование Monitoring layout | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ |
| Не перегружать nav | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| Рядом с infra observability | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ |
| Реализация (diff) | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
**Key insights:**
- Monitoring уже = health + Postgres; файловые логи — ещё один «операционный» источник диагностики.
- Отдельный route раздувает nav (8+ пунктов mainNav).
- Operations семантически про ревизии/jobs, не raw FS.
## 4️⃣ DECISION
**Selected: Option A** — вкладка в Monitoring.
**Structure:**
```
/monitoring
├─ system (существует)
├─ postgres (существует)
└─ runtime-logs (новая)
```
**Внутри вкладки `runtime-logs` — nested Tabs:**
| Sub-tab | Содержание |
|---------|------------|
| `files` | AppDataTable файлов + actions: Просмотр / Очистить |
| `audit` | Таблица cleanup audit (`GET /v1/runtime-logs/cleanup-audit`) |
**Unavailable (`503`):** `EmptyState` с текстом: «Файловые логи доступны только на evobgp-all с примонтированным каталогом runtime-logs» + ссылка на docs.
**Preview:** `Dialog` + `ScrollPreBlock`, загрузка `GET .../files/{name}?lines=200` (лимиты из CP-3).
**Cleanup:** `ConfirmDialog` — текст с именем файла и размером; `DELETE ?mode=truncate` по умолчанию; опция «Удалить файл» в dropdown для operator.
**Rationale:** минимум nav-churn, консистентность с postgres monitoring, один URL `/monitoring?tab=runtime-logs`.
## 5️⃣ IMPLEMENTATION NOTES
- `web/src/lib/components/monitoring/RuntimeLogsTab.svelte`
- `web/src/lib/runtime-logs/runtime-logs-api.ts`
- `monitoring/+page.svelte`: `TabsTrigger value="runtime-logs"` label «Файловые логи»
- Parse `?tab=` включить `runtime-logs`
- Иконка вкладки: `FileText` или `HardDrive` (уже импортирован в monitoring)
- KPI сверху (опционально): суммарный размер, число файлов — из list response
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 **CREATIVE PHASE END: Runtime Logs UI**