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.
This commit is contained in:
Graham McIntire 2026-03-13 16:41:23 -05:00
parent 83e85952f1
commit 9104ad2948
No known key found for this signature in database

View file

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