dotfiles/app/lib/prymn_web/live/server_live/show.html.heex
Nikos Papadakis 26ba60b95d
app: refactor the Connection to make it asynchronous when connecting
Some work has been done on making the Connection feel nicer, but also
more work is needed to not have the channel be exposed to the upper
layers of the application. We should wrap all the GRPC calls in the
GenServer (which may also allow caching on certain calls such as
get_sys_info)
2023-08-28 23:32:42 +03:00

70 lines
2.3 KiB
Text

<.header>
<span
role="tooltip"
class="relative inline-flex h-3 w-3
before:-translate-x-1/2 before:-translate-y-full before:-top-2
before:left-1/2 before:absolute before:text-sm before:text-white
before:font-normal before:content-[attr(data-tip)] before:opacity-0
hover:before:opacity-100 before:py-1 before:px-2 before:bg-black
before:rounded before:pointer-events-none before:transition-opacity"
data-tip={@health.message}
>
<%= case @health.message do %>
<% "Connected" -> %>
<span class="absolute top-0 left-0 h-full w-full animate-ping rounded-full bg-green-400 opacity-75" />
<span class="h-3 w-3 rounded-full bg-green-500" />
<% "Disconnected" -> %>
<span class="h-3 w-3 rounded-full bg-red-500" />
<% _ -> %>
<span class="h-3 w-3 rounded-full bg-yellow-500" />
<% end %>
</span>
<span class="ml-3">Server <%= @server.name %></span>
</.header>
<section :if={@server.status == :unregistered} class="my-10">
<p class="mb-9">
Connect to your server using root credentials and execute the following command:
</p>
<div class="group inline-flex items-center rounded-lg bg-gray-800 p-4 pl-6 text-white">
<code class="flex gap-4">
<span class="select-none text-gray-500">#</span>
<span class="flex-1">
<%= @registration_command %>
</span>
</code>
<button type="button" tabindex="-1">
<.icon
name="hero-document-duplicate-solid"
class="invisible ml-4 animate-bounce text-gray-500 group-hover:visible"
/>
</button>
</div>
</section>
<section :if={@server.status == :registered} class="my-10 flex rounded bg-gray-800 p-5 text-white">
<div>
<p class="text-xl"><%= @uptime || "" %>s</p>
<p class="text-sm">Uptime</p>
</div>
<div class="ml-4">
<p class="text-xl"><%= Enum.count(@cpus || []) %></p>
<p class="text-sm">CPUs</p>
</div>
<div class="ml-4">
<p class="text-xl">
<%= @used_memory || 0 %> / <%= @total_memory || 0 %>
<span>GiB</span>
</p>
<p class="text-sm">Memory</p>
</div>
<div class="ml-4">
<p class="text-xl">
<%= @used_disk %>
<span>%</span>
</p>
<p class="text-sm">Used Disk</p>
</div>
</section>
<.back navigate={~p"/servers"}>Back to servers</.back>