aprs.me/docs/web/liveview-pages.md

88 lines
2.9 KiB
Markdown

# LiveView Pages
Non-map LiveView pages in the application.
## Packet Streams
### PacketsLive.Index (`/packets`)
- Real-time stream of all incoming packets (max 100)
- Subscribes to `"postgres:aprsme_packets"` Phoenix PubSub topic
- Uses `stream/4` for efficient DOM updates
### PacketsLive.CallsignView (`/packets/:callsign`)
- Filtered packet stream for a single callsign
- Subscribes to `"packets:#{callsign}"` topic
- Includes device information parsed per-packet
## Station Info
### InfoLive.Show (`/info/:callsign`)
- Comprehensive station information page
- Latest packet details, device identification
- Nearby stations via spatial query (neighbors)
- APRS path decoding — "heard by" and "stations heard" analysis
- Digipeater relationships
- APRS symbol rendering
- Embedded single-station map via `InfoMapComponent` (JS hook)
- Subscribes to `"packets:#{callsign}"` for live updates
## Weather
### WeatherLive.CallsignView (`/weather/:callsign`)
- Weather station data visualization with Chart.js charts
- Temperature, humidity, wind, pressure, rainfall trends
- Locale-aware unit conversions (metric/imperial)
- Subscribes to `"weather:#{callsign}"` for live updates
- Pushes `"update_weather_charts"` events to refresh Chart.js
## Status
### StatusLive.Index (`/status`)
- System status dashboard
- APRS-IS connection state, uptime, health score
- Cluster node information (when clustered)
- Polls every 5 seconds via `Process.send_after`
- Inline `render/1` (no template file)
- Subscribes to `"aprs_status"` topic
## Bad Packets
### BadPacketsLive.Index (`/badpackets`)
- Malformed/rejected packet viewer
- Shows raw packet data + error type/message
- Debounced refresh (2s delay)
- Subscribes to `"postgres:aprsme_events"`
## Static Pages
### AboutLive (`/about`)
- Simple about page, title assign only
### ApiDocsLive (`/api`)
- API documentation with interactive testing form
- Inline render (~970 lines)
- Self-documenting with example requests/responses
## Authentication Pages
All auth LiveViews use inline `render/1`:
| LiveView | Route | Auth Pipeline |
|---|---|---|
| `UserLoginLive` | `/users/log_in` | `redirect_if_user_is_authenticated` |
| `UserRegistrationLive` | `/users/register` | `redirect_if_user_is_authenticated` |
| `UserForgotPasswordLive` | `/users/reset_password` | `redirect_if_user_is_authenticated` |
| `UserResetPasswordLive` | `/users/reset_password/:token` | `redirect_if_user_is_authenticated` |
| `UserConfirmationLive` | `/users/confirm/:token` | `:current_user` |
| `UserConfirmationInstructionsLive` | `/users/confirm` | `:current_user` |
| `UserSettingsLive` | `/users/settings` | `require_authenticated_user` |
## Shared LiveView Modules
Located in `lib/aprsme_web/live/shared/`:
- `BoundsUtils` — Map boundary calculations
- `PacketHandler` — Shared packet enrichment
- `ParamUtils` — URL parameter parsing
- `PacketUtils` — Shared packet querying
- `CoordinateUtils` — Coordinate math