From 9104ad29486d3f1b7edf44e263d5a683fbe54e60 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 13 Mar 2026 16:41:23 -0500 Subject: [PATCH] fix: onboarding checklist alerting step guides to escalation policy When alert routing is set to "builtin" (TowerOps) but no escalation policy exists, the checklist item now reads "Create an escalation policy" and links directly to the new escalation policy page instead of looping back to general settings where the routing already looks configured. --- lib/towerops_web/live/dashboard_live.ex | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/towerops_web/live/dashboard_live.ex b/lib/towerops_web/live/dashboard_live.ex index 5f33c8ef..329f696f 100644 --- a/lib/towerops_web/live/dashboard_live.ex +++ b/lib/towerops_web/live/dashboard_live.ex @@ -158,9 +158,19 @@ defmodule ToweropsWeb.DashboardLive do defp build_setup_checklist(organization, device_count) do integrations = Towerops.Integrations.list_integrations(organization.id) has_billing = Enum.any?(integrations, fn i -> i.provider in ~w(gaiia sonar splynx visp) and i.enabled end) - has_alert_routing = organization.alert_routing != "builtin" or has_escalation_policy?(organization) + has_escalation_policy = has_escalation_policy?(organization) + has_alert_routing = organization.alert_routing != "builtin" or has_escalation_policy schedules = Towerops.OnCall.list_schedules(organization.id) + # When using builtin routing without an escalation policy, guide the user + # to create one rather than looping back to general settings. + {alerting_label, alerting_link} = + if organization.alert_routing == "builtin" and not has_escalation_policy do + {"Create an escalation policy", ~p"/schedules/escalation-policies/new"} + else + {"Configure alert routing", ~p"/orgs/#{organization.slug}/settings?tab=general"} + end + steps = [ %{key: :devices, label: "Add devices to monitor", done: device_count > 0, link: ~p"/devices/new"}, %{ @@ -172,9 +182,9 @@ defmodule ToweropsWeb.DashboardLive do }, %{ key: :alerting, - label: "Configure alert routing", + label: alerting_label, done: has_alert_routing, - link: ~p"/orgs/#{organization.slug}/settings?tab=general", + link: alerting_link, optional: false }, %{