+ <%!-- Header: title + tabs + actions in one row --%>
+
+
{@page_title}
<% percent =
if @device_quota.limit != :unlimited and @device_quota.limit > 0 do
@@ -40,6 +40,41 @@
{@device_quota.current}/{@device_quota.limit}
<% end %>
+ <%!-- Inline tab switcher --%>
+
@@ -85,43 +120,6 @@
- <%!-- Tab Navigation --%>
-
-
-
-
<%= case @active_tab do %>
<% "existing" -> %>
<%= if @sites_enabled && !@has_sites && @has_devices do %>
diff --git a/lib/towerops_web/live/device_live/show.ex b/lib/towerops_web/live/device_live/show.ex
index af6c6c04..9a484aa8 100644
--- a/lib/towerops_web/live/device_live/show.ex
+++ b/lib/towerops_web/live/device_live/show.ex
@@ -265,6 +265,7 @@ defmodule ToweropsWeb.DeviceLive.Show do
|> assign_checks_data(device_id)
|> assign_preseem_data()
|> assign_gaiia_data()
+ |> assign_subscriber_impact()
end
# -- Selective reload helpers (used by handle_info handlers) --
@@ -532,6 +533,20 @@ defmodule ToweropsWeb.DeviceLive.Show do
|> assign(:gaiia_network_site, gaiia_network_site)
end
+ # Subscriber impact data (from Gaiia device-to-subscriber matching).
+ defp assign_subscriber_impact(socket) do
+ device = socket.assigns.device
+
+ impact =
+ try do
+ Gaiia.get_device_impact(device.id)
+ rescue
+ _ -> %{subscriber_count: 0, mrr: nil, accounts: []}
+ end
+
+ assign(socket, :subscriber_impact, impact)
+ end
+
# Preseem tab data.
defp assign_preseem_data(socket) do
device = socket.assigns.device
@@ -1622,6 +1637,15 @@ defmodule ToweropsWeb.DeviceLive.Show do
TimeHelpers.format_time_ago(datetime)
end
+ defp format_mrr(nil), do: "$0"
+
+ defp format_mrr(%Decimal{} = d) do
+ "$#{Decimal.round(d, 2) |> Decimal.to_string(:normal)}"
+ end
+
+ defp format_mrr(n) when is_number(n), do: "$#{:erlang.float_to_binary(n / 1, decimals: 2)}"
+ defp format_mrr(_), do: "$0"
+
defp config_change_dot_color(event) do
cond do
event.change_size > 50 -> "bg-red-500"
diff --git a/lib/towerops_web/live/device_live/show.html.heex b/lib/towerops_web/live/device_live/show.html.heex
index 7d932541..2425e16f 100644
--- a/lib/towerops_web/live/device_live/show.html.heex
+++ b/lib/towerops_web/live/device_live/show.html.heex
@@ -98,6 +98,28 @@