feat: redirect to device page after triggering rediscovery

When clicking 'Rediscover Device', navigate to the device details page
where the user can see live updates as discovery progresses.

The device show page already subscribes to PubSub discovery events and
will automatically refresh when discovery completes, showing updated
manufacturer, model, sensors, and interfaces.
This commit is contained in:
Graham McIntire 2026-01-17 18:20:24 -06:00
parent 6c6b68f8fb
commit b6ef989809
No known key found for this signature in database

View file

@ -199,7 +199,11 @@ defmodule ToweropsWeb.DeviceLive.Form do
# Enqueue discovery job
enqueue_discovery(device.id)
{:noreply, put_flash(socket, :info, "Discovery started...")}
# Navigate to device show page where live updates will appear
{:noreply,
socket
|> put_flash(:info, "Discovery started...")
|> push_navigate(to: ~p"/orgs/#{socket.assigns.organization.slug}/devices/#{device.id}")}
else
{:noreply, put_flash(socket, :error, "SNMP is not enabled for this device")}
end