dotfiles/backend/lib/prymn_web/live/server_live/index.html.heex
2023-06-23 10:05:10 +03:00

41 lines
1.2 KiB
Text

<.header>
All available servers to you
<:actions>
<.link patch={~p"/servers/new"}>
<.button>Connect a Server</.button>
</.link>
</:actions>
</.header>
<.table
id="servers"
rows={@streams.servers}
row_click={fn {_id, server} -> JS.navigate(~p"/servers/#{server}") end}
row_indicator={
fn
{_id, %Servers.Server{connection_status: :awaiting}} ->
~H(<span class="text-grey-600">Awaiting connection</span>)
{_id, %Servers.Server{connection_status: :connecting}} ->
~H(<span class="text-purple-600">Connecting</span>)
{_id, %Servers.Server{connection_status: :connected}} ->
~H(<span class="text-green-600">Connected</span>)
end
}
indicator_label="Status"
>
<:col :let={{_id, server}} label="Name"><%= server.name %></:col>
<:action :let={{id, server}}>
<.link
phx-click={JS.push("delete", value: %{id: server.id}) |> hide("##{id}")}
data-confirm="Are you sure?"
>
Delete
</.link>
</:action>
</.table>
<.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>