fix: handle devices without sites in GraphLive live polling

Devices can belong directly to organizations without sites. Fixed
perform_live_poll to check device.organization_id instead of
device.site.organization_id which caused BadMapError when site is nil.
Also removed unused Repo alias.
This commit is contained in:
Graham McIntire 2026-02-05 09:16:11 -06:00
parent 912cb8d280
commit dd8c97a45f
No known key found for this signature in database

View file

@ -4,7 +4,6 @@ defmodule ToweropsWeb.GraphLive.Show do
alias Towerops.Devices
alias Towerops.Monitoring
alias Towerops.Repo
alias Towerops.Snmp
# Maximum live data points (5 minutes at 1 second intervals)
@ -631,10 +630,9 @@ defmodule ToweropsWeb.GraphLive.Show do
|> push_navigate(to: ~p"/devices")
device ->
device = Repo.preload(device, site: :organization)
organization = socket.assigns.current_scope.organization
if device.site.organization_id == organization.id do
if device.organization_id == organization.id do
poll_and_update_buffer(socket, device)
else
socket