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
This commit is contained in:
Graham McIntire 2026-01-17 17:16:35 -06:00
parent 412086d7ec
commit d81b025282
No known key found for this signature in database
2 changed files with 14 additions and 14 deletions

View file

@ -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

View file

@ -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>
<.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>
<.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
</.link>
</div>
</div>