towerops/lib/towerops_web/live
Graham McIntire 6fd03ace16
feat: add comprehensive wireless client tracking and monitoring
Implements real-time wireless client monitoring with historical tracking,
LiveView UI, proactive alerting, and cross-browser e2e tests.

Phase 1: Historical Tracking
- Add TimescaleDB hypertable for wireless_client_readings
- Batch insert client metrics every 60 seconds from DevicePollerWorker
- 90-day retention with compression after 7 days
- Continuous aggregates for hourly (1 year) and daily (5 years) rollups

Phase 2: LiveView UI
- Add wireless tab to device detail page
- Real-time client list with PubSub updates
- Signal strength and SNR badges with 5-level thresholds
- Display MAC, IP, subscriber, TX/RX rates, distance, uptime
- Subscriber matching via device_subscriber_links
- Empty state handling

Phase 3: Proactive Alerting
- WirelessInsightWorker runs every 5 minutes via Oban cron
- 4 insight types with auto-resolution:
  * wireless_signal_weak: < -75 dBm (warning), < -85 dBm (critical)
  * wireless_snr_low: < 15 dB (warning), < 10 dB (critical)
  * wireless_ap_overloaded: > 50 clients (warning), > 75 clients (critical)
  * wireless_client_missing: expected subscribers not connecting
- Hysteresis thresholds prevent alert flapping
- Multi-organization isolation with proper deduplication

Code Quality:
- Refactored reload_current_tab_data to reduce cyclomatic complexity
- Combined double Enum.filter into single pass for efficiency
- Fixed length/1 comparison to use empty list check
- All Credo checks passing

Testing:
- 28 unit tests (ExUnit) - 100% passing
- 15 e2e tests (Playwright) - 100% passing across chromium/firefox/webkit
- Total: 73 tests, all passing

Files changed:
- lib/towerops/workers/wireless_insight_worker.ex (NEW)
- lib/towerops_web/live/device_live/show.ex (wireless tab + refactoring)
- lib/towerops_web/live/device_live/show.html.heex (wireless template)
- lib/towerops/snmp.ex (5 new query functions)
- lib/towerops/gaiia.ex (list_missing_subscribers)
- lib/towerops/preseem/insight.ex (5 new insight types)
- config/runtime.exs (Oban cron schedule)
- test/support/fixtures/snmp_fixtures.ex (NEW)
- test/towerops/workers/wireless_insight_worker_test.exs (NEW)
- test/towerops_web/live/device_live/show_test.exs (9 new tests)
- e2e/tests/wireless-clients.spec.ts (NEW - 15 cross-browser tests)
2026-03-10 09:57:12 -05:00
..
account_live Fix dark mode inconsistencies across all pages 2026-02-16 10:31:52 -06:00
admin ui: comprehensive button styling audit - convert all text-styled actions to proper buttons 2026-03-09 15:32:42 -05:00
agent_live ui: comprehensive button styling audit - convert all text-styled actions to proper buttons 2026-03-09 15:32:42 -05:00
alert_live fix: handle alert_changed PubSub messages and primary owner ordering 2026-03-07 12:04:30 -06:00
check_live Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
components feat: comprehensive e2e test coverage for all user-facing features 2026-03-06 16:58:06 -06:00
device_live feat: add comprehensive wireless client tracking and monitoring 2026-03-10 09:57:12 -05:00
graph_live fix: comprehensive bug fixes from reliability audit 2026-03-05 08:53:30 -06:00
help_live fix: configure Watchtower to only monitor agent container 2026-03-06 12:38:44 -06:00
helpers refactor: centralize LiveView access control checks 2026-02-04 17:51:05 -06:00
insights_live i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
maintenance_live Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
map_live i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
mikrotik_backup_live i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
org ui: comprehensive button styling audit - convert all text-styled actions to proper buttons 2026-03-09 15:32:42 -05:00
org_live fix: org switching now correctly updates session 2026-03-04 17:04:49 -06:00
site_live feat: add capacity insight worker, UI, and reporting views 2026-03-07 14:42:40 -06:00
trace_live feat: add site search to trace 2026-03-06 15:37:23 -06:00
user_settings_live feat: add 12/24-hour time format setting with consistent timezone display 2026-02-13 15:16:29 -06:00
activity_feed_live.ex fix: comprehensive bug fixes from reliability audit 2026-03-05 08:53:30 -06:00
activity_feed_live.html.heex fix: netbox url field type, gaiia ipRange→block, remove unknown webhook log 2026-02-14 17:44:01 -06:00
capacity_live.ex feat: add capacity insight worker, UI, and reporting views 2026-03-07 14:42:40 -06:00
capacity_live.html.heex feat: add capacity insight worker, UI, and reporting views 2026-03-07 14:42:40 -06:00
changelog_live.ex fix: add navigation and footer to changelog page 2026-03-09 15:59:13 -05:00
config_timeline_live.ex i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
dashboard_live.ex fix: handle alert_changed PubSub messages and primary owner ordering 2026-03-07 12:04:30 -06:00
dashboard_live.html.heex feat: dynamic favicon reflects real-time system health status 2026-03-05 13:47:54 -06:00
mobile_qr_live.ex fix: comprehensive bug fixes from reliability audit 2026-03-05 08:53:30 -06:00
network_map_live.ex i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
network_map_live.html.heex i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
onboarding_live.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
onboarding_live.html.heex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
user_registration_live.ex stripe and email after signup 2026-03-06 10:07:27 -06:00
user_reset_password_live.ex i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
user_settings_live.ex i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
user_settings_live.html.heex ui: polish device detail, site detail, and user settings 2026-02-14 21:11:33 -06:00