Files
telemt-api/web/README.md
T
Denozordec 8c8ccce6ee
Publish telemt-api gateway Docker image / test (push) Successful in 24s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 1m58s
Enhance API and UI for incident management and live updates
- Added a new endpoint `/api/agg/incidents` to provide a normalized snapshot of incidents for fleet triage, including severity and recommended actions.
- Implemented live event streaming via `/api/live/events` for real-time updates on fleet status and incidents, enhancing observability.
- Updated the Web UI to include dedicated sections for incidents and live updates, improving user navigation and access to critical information.
- Enhanced API documentation to reflect new endpoints and their functionalities, ensuring clarity for developers and users.
2026-03-30 19:17:29 +07:00

68 lines
2.8 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.
# Telemt Panel (Web UI)
SvelteKit + shadcn-svelte. В **production** статика собирается и **встраивается в образ шлюза** ([Dockerfile](../Dockerfile) в корне репозитория): панель и API на **одном порту** (например `http://127.0.0.1:8080/` — UI, `/api/…` — шлюз).
## Основные разделы панели
- `/` — обзор флота (KPI, активные IP, сводка по нодам)
- `/users`, `/users/[username]` — пользователи и детали
- `/ips` — unique IP + GeoIP карта
- `/incidents` — triage-интерфейс инцидентов (`ack/resolved/owner/note` в localStorage)
- `/live` — live snapshot (SSE, авто-reconnect)
## Переменная `PUBLIC_TELEMT_GATEWAY_URL`
| Значение | Когда |
| --- | --- |
| *(пусто)* | Тот же хост и порт, что у страницы (Docker-образ шлюза, `npm run build` в Dockerfile с `ENV PUBLIC_TELEMT_GATEWAY_URL=`) |
| `http://127.0.0.1:8080` | Локальная разработка: Vite на `:5173`, шлюз на `:8080` |
Скопируйте [.env.example](.env.example) в `.env` и при необходимости задайте URL.
## Разработка (Vite отдельно от Go)
```powershell
cd web
npm install
npm run dev
```
Откройте `http://localhost:5173`. В конфиге шлюза включите [CORS](../docs/AGGREGATE.md) для этого origin:
```yaml
cors_allowed_origins:
- "http://localhost:5173"
```
## Сборка только фронта
```powershell
npm run build
```
Артефакт — каталог `build/`, при сборке **Docker-образа шлюза** он копируется в `internal/webui/static/` и попадает в бинарник через `embed`.
## Типы из OpenAPI агрегатов
```powershell
npm run gen:api
```
Источник: [../docs/AGGREGATE_OPENAPI.yaml](../docs/AGGREGATE_OPENAPI.yaml).
## URL-driven controls (операторский режим)
На ключевых страницах используются query-параметры:
- `aliases=node-a,node-b` — фильтр по нодам
- `refresh=0|10..300` — auto-refresh (0 выключает polling)
- `include_links=0|1` — для `/users`
- `geo=0|1` — для `/ips`
Live-страница `/live` работает через SSE endpoint шлюза: `/api/live/events`.
## Ограничения
- Секреты upstream к Telemt задаются на шлюзе (`authorization_env`), не в браузере.
- Для мутаций из другого origin шлюз отдаёт нужные заголовки CORS (в т.ч. методы `POST`, `PATCH`, `DELETE`).