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:
parent
912cb8d280
commit
dd8c97a45f
1 changed files with 1 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue