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 }, %{