dotfiles/app/lib/prymn_web/live/server_live/index.html.heex
Nikos Papadakis be7f584010
app: a nice poc background connection with the agent
Dynamically supervise a GRPC connection and keep it alive for a while,
using a timeout to kill the process on inactivity.

The Connection GenServer keeps the connection alive, while listening to
a health stream from the GRPC endpoint, notifying any subscribed
listeners about changes to health.

This health is then propagated to the main servers page.

Also create a looping get_sys_info which retrieves some basic system
information.
2023-08-26 00:51:04 +03:00

33 lines
1 KiB
Text

<.header>
Your servers
<small class="block">
<%= "#{Enum.count(@servers)} servers" %>
</small>
<:actions>
<.link patch={~p"/servers/new"}>
<.button>Connect a Server</.button>
</.link>
</:actions>
</.header>
<div class="space-y-5" phx-update="replace" id="servers">
<.link
:for={server <- @servers}
navigate={~p"/servers/#{server}"}
class="group block rounded-lg bg-gray-100 p-5 shadow-sm shadow-gray-300 hover:bg-black hover:text-white"
>
<div class="flex flex-row flex-wrap justify-between">
<h2 class="text-xl"><%= server.name %></h2>
<span class="self-center text-sm">
<.server_status server={server} health={@healths[server.public_ip]} />
</span>
</div>
<div class="lg:text-sm">
<span>IP: <%= server.public_ip || "N/A" %></span>
</div>
</.link>
</div>
<.modal :if={@live_action == :new} id="server-modal" show on_cancel={JS.patch(~p"/servers")}>
<.live_component module={PrymnWeb.ServerLive.NewServer} id={:new} patch={~p"/servers"} />
</.modal>