fix: align sidebar bottom border with footer border
Adjust sidebar bottom section padding from py-3 to py-3.5 to align the horizontal border with the footer border. Also remove unused private functions from settings_live and fix credo warnings.
This commit is contained in:
parent
88323a2290
commit
529a6138d1
5 changed files with 64 additions and 46 deletions
|
|
@ -25,14 +25,7 @@ defmodule Towerops.Workers.AlertNotificationWorker do
|
|||
|
||||
pd_result =
|
||||
if routing in ["pagerduty", "both"] do
|
||||
case Notifier.notify_trigger(alert, device) do
|
||||
{:error, :not_configured} ->
|
||||
Logger.debug("PagerDuty not configured for alert #{alert_id}, skipping")
|
||||
:ok
|
||||
|
||||
result ->
|
||||
result
|
||||
end
|
||||
notify_pagerduty_trigger(alert, device, alert_id)
|
||||
else
|
||||
:ok
|
||||
end
|
||||
|
|
@ -65,14 +58,7 @@ defmodule Towerops.Workers.AlertNotificationWorker do
|
|||
if routing in ["builtin", "both"], do: maybe_acknowledge_incident(alert)
|
||||
|
||||
if routing in ["pagerduty", "both"] do
|
||||
case Notifier.notify_acknowledge(alert) do
|
||||
{:error, :not_configured} ->
|
||||
Logger.debug("PagerDuty not configured for alert #{alert_id}, skipping")
|
||||
:ok
|
||||
|
||||
result ->
|
||||
result
|
||||
end
|
||||
notify_pagerduty_acknowledge(alert, alert_id)
|
||||
else
|
||||
:ok
|
||||
end
|
||||
|
|
@ -95,14 +81,7 @@ defmodule Towerops.Workers.AlertNotificationWorker do
|
|||
if routing in ["builtin", "both"], do: maybe_resolve_incident(alert)
|
||||
|
||||
if routing in ["pagerduty", "both"] do
|
||||
case Notifier.notify_resolve(alert) do
|
||||
{:error, :not_configured} ->
|
||||
Logger.debug("PagerDuty not configured for alert #{alert_id}, skipping")
|
||||
:ok
|
||||
|
||||
result ->
|
||||
result
|
||||
end
|
||||
notify_pagerduty_resolve(alert, alert_id)
|
||||
else
|
||||
:ok
|
||||
end
|
||||
|
|
@ -136,6 +115,39 @@ defmodule Towerops.Workers.AlertNotificationWorker do
|
|||
|> Oban.insert()
|
||||
end
|
||||
|
||||
defp notify_pagerduty_trigger(alert, device, alert_id) do
|
||||
case Notifier.notify_trigger(alert, device) do
|
||||
{:error, :not_configured} ->
|
||||
Logger.debug("PagerDuty not configured for alert #{alert_id}, skipping")
|
||||
:ok
|
||||
|
||||
result ->
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
defp notify_pagerduty_acknowledge(alert, alert_id) do
|
||||
case Notifier.notify_acknowledge(alert) do
|
||||
{:error, :not_configured} ->
|
||||
Logger.debug("PagerDuty not configured for alert #{alert_id}, skipping")
|
||||
:ok
|
||||
|
||||
result ->
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
defp notify_pagerduty_resolve(alert, alert_id) do
|
||||
case Notifier.notify_resolve(alert) do
|
||||
{:error, :not_configured} ->
|
||||
Logger.debug("PagerDuty not configured for alert #{alert_id}, skipping")
|
||||
:ok
|
||||
|
||||
result ->
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
defp maybe_start_escalation(alert, device) do
|
||||
policy_id = device.escalation_policy_id || device.organization.default_escalation_policy_id
|
||||
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ defmodule ToweropsWeb.Layouts do
|
|||
</nav>
|
||||
|
||||
<!-- Bottom pinned: org switcher + settings + collapse toggle -->
|
||||
<div class="border-t border-gray-200 dark:border-white/10 px-2 py-3 space-y-1">
|
||||
<div class="border-t border-gray-200 dark:border-white/10 px-2 py-3.5 space-y-1">
|
||||
<!-- Org switcher -->
|
||||
<div :if={@current_organization} class="relative">
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -163,9 +163,27 @@ defmodule ToweropsWeb.DashboardLive do
|
|||
|
||||
steps = [
|
||||
%{key: :devices, label: "Add devices to monitor", done: device_count > 0, link: ~p"/devices/new"},
|
||||
%{key: :billing, label: "Connect billing platform", done: has_billing, link: ~p"/orgs/#{organization.slug}/settings?tab=integrations", optional: true},
|
||||
%{key: :alerting, label: "Configure alert routing", done: has_alert_routing, link: ~p"/orgs/#{organization.slug}/settings?tab=general", optional: false},
|
||||
%{key: :oncall, label: "Create on-call schedule", done: length(schedules) > 0, link: ~p"/schedules/new", optional: true}
|
||||
%{
|
||||
key: :billing,
|
||||
label: "Connect billing platform",
|
||||
done: has_billing,
|
||||
link: ~p"/orgs/#{organization.slug}/settings?tab=integrations",
|
||||
optional: true
|
||||
},
|
||||
%{
|
||||
key: :alerting,
|
||||
label: "Configure alert routing",
|
||||
done: has_alert_routing,
|
||||
link: ~p"/orgs/#{organization.slug}/settings?tab=general",
|
||||
optional: false
|
||||
},
|
||||
%{
|
||||
key: :oncall,
|
||||
label: "Create on-call schedule",
|
||||
done: schedules != [],
|
||||
link: ~p"/schedules/new",
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
|
||||
completed = Enum.count(steps, & &1.done)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@
|
|||
|
||||
<%!-- Setup Checklist — shown when devices exist but setup isn't complete --%>
|
||||
<%= if assigns[:setup_checklist] && !@setup_checklist.all_done && @device_count > 0 do %>
|
||||
<div id="setup-checklist" class="mt-4 rounded-lg border border-blue-200 bg-blue-50/50 dark:border-blue-800/50 dark:bg-blue-900/10 p-4">
|
||||
<div
|
||||
id="setup-checklist"
|
||||
class="mt-4 rounded-lg border border-blue-200 bg-blue-50/50 dark:border-blue-800/50 dark:bg-blue-900/10 p-4"
|
||||
>
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<.icon name="hero-rocket-launch" class="h-5 w-5 text-blue-600 dark:text-blue-400" />
|
||||
|
|
@ -145,7 +148,8 @@
|
|||
"flex items-center gap-2.5 rounded-md px-3 py-2 text-sm transition-colors",
|
||||
if(step.done,
|
||||
do: "text-gray-400 dark:text-gray-500",
|
||||
else: "text-gray-700 dark:text-gray-300 hover:bg-blue-100/50 dark:hover:bg-blue-900/20"
|
||||
else:
|
||||
"text-gray-700 dark:text-gray-300 hover:bg-blue-100/50 dark:hover:bg-blue-900/20"
|
||||
)
|
||||
]}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -576,14 +576,6 @@ defmodule ToweropsWeb.Org.SettingsLive do
|
|||
end
|
||||
end
|
||||
|
||||
defp next_sync_minutes(nil, _interval), do: nil
|
||||
|
||||
defp next_sync_minutes(last_synced_at, interval) do
|
||||
next_sync = DateTime.add(last_synced_at, interval * 60, :second)
|
||||
diff = DateTime.diff(next_sync, DateTime.utc_now(), :second)
|
||||
max(0, div(diff, 60))
|
||||
end
|
||||
|
||||
defp normalize_params(params, existing_integration) do
|
||||
provider =
|
||||
case existing_integration do
|
||||
|
|
@ -653,10 +645,6 @@ defmodule ToweropsWeb.Org.SettingsLive do
|
|||
end
|
||||
end
|
||||
|
||||
defp webhook_url(organization_id) do
|
||||
ToweropsWeb.Endpoint.url() <> "/api/v1/webhooks/gaiia/#{organization_id}"
|
||||
end
|
||||
|
||||
defp get_credential(nil, _key), do: ""
|
||||
|
||||
defp get_credential(%Integration{credentials: credentials}, key) when is_map(credentials) do
|
||||
|
|
@ -665,10 +653,6 @@ defmodule ToweropsWeb.Org.SettingsLive do
|
|||
|
||||
defp get_credential(_integration, _key), do: ""
|
||||
|
||||
defp format_help_step(text) do
|
||||
String.replace(text, ~r/\*\*(.+?)\*\*/, "<strong>\\1</strong>")
|
||||
end
|
||||
|
||||
defp current_integration(socket) do
|
||||
provider = socket.assigns.configuring
|
||||
Map.get(socket.assigns.integrations, provider)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue