From 6b2de4a114a64ec20872ff84b9f7b6e0d9ecf6ed Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 13 Feb 2026 13:34:04 -0600 Subject: [PATCH] add gaiia to org settings integrations page --- .../live/org/integrations_live.ex | 18 +++++-- .../live/org/integrations_live.html.heex | 50 +++++++++++++------ 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/lib/towerops_web/live/org/integrations_live.ex b/lib/towerops_web/live/org/integrations_live.ex index be12d7d0..320b23bb 100644 --- a/lib/towerops_web/live/org/integrations_live.ex +++ b/lib/towerops_web/live/org/integrations_live.ex @@ -2,6 +2,7 @@ defmodule ToweropsWeb.Org.IntegrationsLive do @moduledoc false use ToweropsWeb, :live_view + alias Towerops.Gaiia.Client, as: GaiiaClient alias Towerops.Integrations alias Towerops.Integrations.Integration alias Towerops.Preseem.Client, as: PreseemClient @@ -12,6 +13,13 @@ defmodule ToweropsWeb.Org.IntegrationsLive do name: "Preseem", description: "QoE monitoring and subscriber experience analytics for wireless ISPs.", icon: "hero-signal" + }, + %{ + id: "gaiia", + name: "Gaiia", + description: + "Billing and subscriber management. Enables outage impact analysis, inventory reconciliation, and subscriber-aware monitoring.", + icon: "hero-user-group" } ] @@ -112,11 +120,12 @@ defmodule ToweropsWeb.Org.IntegrationsLive do @impl true def handle_event("test_connection", _params, socket) do api_key = extract_api_key(socket) + provider = socket.assigns.configuring if api_key == "" or is_nil(api_key) do {:noreply, assign(socket, :test_result, {:error, "Please enter an API key first"})} else - result = PreseemClient.test_connection(api_key) + result = test_provider_connection(provider, api_key) {:noreply, assign(socket, :test_result, format_connection_result(result))} end end @@ -143,6 +152,10 @@ defmodule ToweropsWeb.Org.IntegrationsLive do end end + defp test_provider_connection("preseem", api_key), do: PreseemClient.test_connection(api_key) + defp test_provider_connection("gaiia", api_key), do: GaiiaClient.test_connection(api_key) + defp test_provider_connection(_, _api_key), do: {:error, "Unknown provider"} + defp load_integrations(organization_id) do organization_id |> Integrations.list_integrations() @@ -189,8 +202,7 @@ defmodule ToweropsWeb.Org.IntegrationsLive do defp format_connection_result({:error, {:unexpected_status, status}}), do: {:error, "API returned unexpected status: #{status}"} - defp format_connection_result({:error, %{reason: :timeout}}), - do: {:error, "Connection timeout - unable to reach Preseem API"} + defp format_connection_result({:error, %{reason: :timeout}}), do: {:error, "Connection timeout - unable to reach API"} defp format_connection_result({:error, %{reason: :econnrefused}}), do: {:error, "Connection refused - check API endpoint"} diff --git a/lib/towerops_web/live/org/integrations_live.html.heex b/lib/towerops_web/live/org/integrations_live.html.heex index a1717ef2..cd9103f9 100644 --- a/lib/towerops_web/live/org/integrations_live.html.heex +++ b/lib/towerops_web/live/org/integrations_live.html.heex @@ -81,20 +81,40 @@ <% end %> - <.link - navigate={~p"/orgs/#{@organization.slug}/settings/integrations/preseem/devices"} - class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" - > - Manage Devices → - - <.link - navigate={ - ~p"/orgs/#{@organization.slug}/settings/integrations/preseem/insights" - } - class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" - > - Network Insights → - + <%= if provider.id == "preseem" do %> + <.link + navigate={ + ~p"/orgs/#{@organization.slug}/settings/integrations/preseem/devices" + } + class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" + > + Manage Devices → + + <.link + navigate={ + ~p"/orgs/#{@organization.slug}/settings/integrations/preseem/insights" + } + class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" + > + Network Insights → + + <% end %> + <%= if provider.id == "gaiia" do %> + <.link + navigate={~p"/orgs/#{@organization.slug}/settings/integrations/gaiia/mapping"} + class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" + > + Entity Mapping → + + <.link + navigate={ + ~p"/orgs/#{@organization.slug}/settings/integrations/gaiia/reconciliation" + } + class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300" + > + Reconciliation → + + <% end %> <% end %> @@ -147,7 +167,7 @@ field={@form[:api_key]} type="password" label="API Key" - placeholder="Enter your Preseem API key" + placeholder={"Enter your #{provider.name} API key"} autocomplete="off" value={get_credential(@integrations[provider.id], "api_key")} />