defmodule Integrations.S3.Display do @moduledoc """ Dashboard panel for `Integrations.S3` (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.S3` starts, the same as if they were still one module. """ use CodeNameRaven.Display, category: :infrastructure, size_hint: :medium @impl true def display_name, do: "S3 Storage" @impl true def compatible_monitors, do: [Integrations.S3] @impl true def render(assigns) do result = assigns[:result] assigns = Map.merge(assigns, %{result: result}) ~H"""

<%= @config.name || storage_title(@config.params) %>

<%= get_in(@config.params, [:endpoint]) || get_in(@config.params, ["endpoint"]) %>

""" end # --------------------------------------------------------------------------- # Private helpers # --------------------------------------------------------------------------- defp status_label(:up), do: "OK" defp status_label(:degraded), do: "Degraded" defp status_label(:down), do: "Down" defp status_label(:skipped), do: "—" defp status_label(_), do: "?" defp storage_title(params) do ep = params[:endpoint] || params["endpoint"] || "S3" bucket = params[:bucket] || params["bucket"] if bucket, do: "#{ep}/#{bucket}", else: ep end end