From d81b025282d780769ac9dac9752287fc265e46f8 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 17 Jan 2026 17:16:35 -0600 Subject: [PATCH] Make Active Alerts the first and default tab in alerts page Changed the default filter from 'all' to 'active' and reordered tabs so Active Alerts appears first (leftmost) in the tab bar --- lib/towerops_web/live/alert_live/index.ex | 4 ++-- .../live/alert_live/index.html.heex | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/towerops_web/live/alert_live/index.ex b/lib/towerops_web/live/alert_live/index.ex index 1375ff68..230968fb 100644 --- a/lib/towerops_web/live/alert_live/index.ex +++ b/lib/towerops_web/live/alert_live/index.ex @@ -18,13 +18,13 @@ defmodule ToweropsWeb.AlertLive.Index do {:ok, socket |> assign(:page_title, "Alerts") - |> assign(:filter, "all") + |> assign(:filter, "active") |> load_alerts(organization.id)} end @impl true def handle_params(params, _url, socket) do - filter = Map.get(params, "filter", "all") + filter = Map.get(params, "filter", "active") {:noreply, socket diff --git a/lib/towerops_web/live/alert_live/index.html.heex b/lib/towerops_web/live/alert_live/index.html.heex index 84a27fd7..9b3cb062 100644 --- a/lib/towerops_web/live/alert_live/index.html.heex +++ b/lib/towerops_web/live/alert_live/index.html.heex @@ -15,18 +15,6 @@ patch={~p"/orgs/#{@current_organization.slug}/alerts"} class={[ "px-4 py-2 text-sm font-medium rounded-l-lg", - @filter == "all" && - "bg-blue-600 text-white dark:bg-blue-500", - @filter != "all" && - "bg-white text-zinc-700 hover:bg-zinc-50 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800" - ]} - > - All Alerts - - <.link - patch={~p"/orgs/#{@current_organization.slug}/alerts?filter=active"} - class={[ - "px-4 py-2 text-sm font-medium rounded-r-lg border-l border-zinc-200 dark:border-zinc-800", @filter == "active" && "bg-blue-600 text-white dark:bg-blue-500", @filter != "active" && @@ -35,6 +23,18 @@ > Active Alerts + <.link + patch={~p"/orgs/#{@current_organization.slug}/alerts?filter=all"} + class={[ + "px-4 py-2 text-sm font-medium rounded-r-lg border-l border-zinc-200 dark:border-zinc-800", + @filter == "all" && + "bg-blue-600 text-white dark:bg-blue-500", + @filter != "all" && + "bg-white text-zinc-700 hover:bg-zinc-50 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800" + ]} + > + All Alerts +