From e27cc5495abe3ef12b76f6e0213846cbe1244364 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 25 Jan 2026 08:22:31 -0600 Subject: [PATCH] fix: handle checkbox 'on' value for cloud poller creation HTML checkboxes send value='on' when checked, not 'true'. Updated parse_agent_params to accept both 'on' and 'true' values for the is_cloud_poller field. Added debug logging to help diagnose future form submission issues. --- lib/towerops_web/live/agent_live/index.ex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/towerops_web/live/agent_live/index.ex b/lib/towerops_web/live/agent_live/index.ex index 45b1260c..1c88fe4b 100644 --- a/lib/towerops_web/live/agent_live/index.ex +++ b/lib/towerops_web/live/agent_live/index.ex @@ -61,7 +61,12 @@ defmodule ToweropsWeb.AgentLive.Index do @impl true def handle_event("create_agent", params, socket) do + require Logger + + Logger.debug("create_agent params: #{inspect(params)}") + {name, is_cloud_poller} = parse_agent_params(params) + Logger.debug("Parsed: name=#{name}, is_cloud_poller=#{is_cloud_poller}") with :ok <- validate_cloud_poller_permission(socket.assigns.current_scope.user, is_cloud_poller), {:ok, agent_token, token} <- create_agent(socket.assigns.current_organization, name, is_cloud_poller) do @@ -189,7 +194,7 @@ defmodule ToweropsWeb.AgentLive.Index do defp parse_agent_params(params) do case params do %{"agent_form" => %{"name" => n, "is_cloud_poller" => cp}} -> - {n, cp == "true" || cp == true} + {n, cp in ["true", "on", true]} %{"agent_form" => %{"name" => n}} -> {n, false}