Revert "feat: add status emoji to page titles"

This reverts commit f3873e0da7.
This commit is contained in:
Graham McIntire 2026-03-06 14:43:13 -06:00
parent f3873e0da7
commit c110832b42
No known key found for this signature in database
4 changed files with 3 additions and 81 deletions

View file

@ -7,7 +7,6 @@ defmodule ToweropsWeb.Layouts do
alias ToweropsWeb.Components.ConsentPrompt
alias ToweropsWeb.Components.CookieConsent
alias ToweropsWeb.Helpers.StatusHelpers
alias ToweropsWeb.Live.Components.GlobalSearchComponent
require Logger
@ -1047,18 +1046,4 @@ defmodule ToweropsWeb.Layouts do
</footer>
"""
end
@doc """
Returns the page title with status emoji prepended based on organization health.
"""
def status_title(assigns) do
page_title = assigns[:page_title] || "TowerOps"
organization = get_in(assigns, [:current_scope, Access.key(:organization)])
if organization do
StatusHelpers.title_with_status(page_title, organization)
else
page_title
end
end
end

View file

@ -27,7 +27,7 @@
<link rel="apple-touch-icon" href={~p"/images/towerops_logo.png"} />
<.live_title suffix=" | TowerOps">
{status_title(assigns)}
{assigns[:page_title] || "TowerOps"}
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/js/app.js"}>

View file

@ -1,63 +0,0 @@
defmodule ToweropsWeb.Helpers.StatusHelpers do
@moduledoc """
Helpers for displaying organization status indicators.
"""
alias Towerops.Alerts
alias Towerops.Organizations.Organization
@doc """
Returns a status emoji based on the organization's active alerts.
## Status Logic
- 🔴 Red circle: Critical alerts (device_down, agent_offline, or severity 1)
- 🟡 Yellow circle: Warning alerts (severity 2 or other active alerts)
- 🟢 Green circle: No active alerts
## Examples
iex> status_emoji(%Organization{id: org_id})
"🔴"
"""
def status_emoji(nil), do: "🟢"
def status_emoji(%Organization{id: organization_id}) do
case get_organization_status(organization_id) do
:critical -> "🔴"
:warning -> "🟡"
:healthy -> "🟢"
end
end
@doc """
Returns a page title with status emoji prepended.
## Examples
iex> title_with_status("Dashboard", %Organization{})
"🔴 Dashboard"
"""
def title_with_status(title, organization) do
emoji = status_emoji(organization)
"#{emoji} #{title}"
end
defp get_organization_status(organization_id) do
alerts = Alerts.list_organization_active_alerts(organization_id)
cond do
has_critical_alerts?(alerts) -> :critical
Enum.any?(alerts) -> :warning
true -> :healthy
end
end
defp has_critical_alerts?(alerts) do
Enum.any?(alerts, fn alert ->
# Device down or agent offline are always critical
# Severity 1 is critical
alert.alert_type in ["device_down", "agent_offline"] or
alert.severity == 1
end)
end
end

View file

@ -4,8 +4,8 @@
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">{t("All Organizations")}</h1>
<p class="text-gray-600 dark:text-gray-400">{t_admin("Manage organizations")}</p>
</div>
<!-- Global Billing Defaults Card -->
<!-- Global Billing Defaults Card -->
<div
class="rounded-lg border border-slate-200 bg-white p-6 dark:border-slate-700 dark:bg-slate-800"
data-test="global-defaults-card"