Packages

Forgejo/Gitea multi-step check — login, issue an API token, call an authenticated endpoint — with its dashboard panel bundled in the same package as a separate module (Integrations.Forgejo.Display) — one install, both halves; a release without raven_web simply runs the monitor headless.

Current section

Files

Jump to
raven_integration_forgejo lib integrations forgejo display.ex
Raw

lib/integrations/forgejo/display.ex

defmodule Integrations.Forgejo.Display do
@moduledoc """
Dashboard panel for `Integrations.Forgejo` (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.Forgejo` starts, the same as if they were still one module.
"""
use CodeNameRaven.Display, category: :infrastructure, size_hint: :medium
@impl true
def display_name, do: "Forgejo"
@impl true
def compatible_monitors, do: [Integrations.Forgejo]
@impl true
def render(assigns) do
result = assigns[:result]
assigns = Map.merge(assigns, %{result: result})
~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 || "Forgejo" %>
</h2>
<p class="text-xs font-mono text-base-content/40 truncate">
<%= @config.params[:base_url] %>
</p>
</div>
<CodeNameRaven.MonitorComponents.status_chip status={@status} />
</div>
<div :if={@result} class="flex gap-2 flex-wrap">
<CodeNameRaven.MonitorComponents.stat
label="Login"
value={"#{@result.login_ms} ms"} />
<CodeNameRaven.MonitorComponents.stat
label="Repo call"
value={"#{@result.call_ms} ms"} />
<CodeNameRaven.MonitorComponents.stat
label="Repos"
value={"#{@result.repo_count}"} />
<CodeNameRaven.MonitorComponents.stat
:if={@result.verify_repo}
label="Target repo"
value={if @result.repo_found, do: "Found", else: "Missing"} />
</div>
<CodeNameRaven.MonitorComponents.error_message message={@last_error} />
<CodeNameRaven.MonitorComponents.check_time checked_at={@last_checked_at} />
</div>
"""
end
end