Packages

HTTP absence check, with its dashboard panel bundled in the same package as a separate module (Integrations.HttpAbsent.Display) — one install, both halves; a release without raven_web simply runs the monitor headless.

Current section

Files

Jump to
raven_integration_http_absent lib integrations http_absent display.ex
Raw

lib/integrations/http_absent/display.ex

defmodule Integrations.HttpAbsent.Display do
@moduledoc """
Dashboard panel for `Integrations.HttpAbsent` (same package).
Nested under the monitor's own namespace deliberately — the package's
top-level module name never changes, and this module's name is
guaranteed distinct from any separately-published standalone display
package. `Display.BundledDefault` auto-hooks this whenever
`Integrations.HttpAbsent` starts, the same as if they were still one
module.
"""
use CodeNameRaven.Display, category: :web, size_hint: :small
@impl true
def display_name, do: "HTTP Absence Check"
@impl true
def compatible_monitors, do: [Integrations.HttpAbsent]
@impl true
def render(assigns) do
~H"""
<div class="space-y-3">
<div class="flex items-start justify-between gap-2">
<div class="min-w-0">
<h2 class="text-sm font-semibold text-base-content truncate">
{(@config.name || @config.params[:url]) || "HTTP Absence Check"}
</h2>
<p class="text-xs text-base-content/40 font-mono truncate">
{@config.params[:url]}
</p>
</div>
<CodeNameRaven.MonitorComponents.status_chip status={@status} />
</div>
<div :if={@result} class="flex gap-2">
<CodeNameRaven.MonitorComponents.stat
label="Reachable"
value={if @result.reachable, do: "yes", else: "no"}
/>
<CodeNameRaven.MonitorComponents.stat
:if={@result.status_code}
label="Status"
value={to_string(@result.status_code)}
/>
</div>
<CodeNameRaven.MonitorComponents.error_message message={@last_error} />
<p class="text-xs text-base-content/30">
{if @last_checked_at,
do: "Checked #{Calendar.strftime(@last_checked_at, "%H:%M:%S UTC")}",
else: "Waiting for first check…"}
</p>
</div>
"""
end
end