+
+
Good morning, <%= @current_user.email %>!
+ Your overview
+
+
+
+
+ 0
+
Total Servers
+ <.link class="text-sm text-blue-600" navigate={~p"/servers"}>
+ <.icon class="h-3 w-4" name="hero-arrow-right" /> View your servers
+
+
+
+ 0
+
Apps
+ <.link class="text-sm text-blue-600">
+ <.icon class="h-3 w-4" name="hero-arrow-right" /> View your apps
+
+
+
+
+
+
+ <.header>
+ Your servers
+
+ <%= "#{Enum.count(@servers)} servers" %>
+
+ <:actions>
+ <.button type="link" patch={~p"/servers/new"}>Connect a Server
+
+
-
- <.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"
- >
-
-
<%= server.name %>
- <.server_status status={server.status} health={@healths[server.public_ip]} />
-
-
-
IP: <%= server.public_ip || "N/A" %>
-
- <%= for {name, task} <- Enum.take(@healths[server.public_ip].tasks, 1) do %>
- In progress: <%= name %>
- <%= task.progress %>
- <% end %>
-
-
-
+
+ <.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"
+ >
+
+
<%= server.name %>
+ <.server_status status={server.status} health={@healths[server.public_ip]} />
+
+
+
IP: <%= server.public_ip || "N/A" %>
+
+ <%= for {name, task} <- Enum.take(@healths[server.public_ip].tasks, 1) do %>
+ In progress: <%= name %>
+ <%= task.progress %>
+ <% end %>
+
+
+
+
+
+ <.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 :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"} />
-
diff --git a/app/lib/prymn_web/live/server_live/show.ex b/app/lib/prymn_web/live/server_live/show.ex
index 5eb0683..09e5baa 100644
--- a/app/lib/prymn_web/live/server_live/show.ex
+++ b/app/lib/prymn_web/live/server_live/show.ex
@@ -23,7 +23,7 @@ defmodule PrymnWeb.ServerLive.Show do
{:noreply,
socket
- |> assign(:health, health || %{message: "Connecting..."})
+ |> assign(:health, health || %{message: "Connecting...", tasks: []})
|> assign(:page_title, server.name)
|> assign(:server, server)
|> assign(:dry_run, false)
diff --git a/app/lib/prymn_web/live/server_live/show.html.heex b/app/lib/prymn_web/live/server_live/show.html.heex
index b381b89..589acdf 100644
--- a/app/lib/prymn_web/live/server_live/show.html.heex
+++ b/app/lib/prymn_web/live/server_live/show.html.heex
@@ -1,110 +1,145 @@
-<.header>
-
- Server <%= @server.name %>
-
- <%= case @health.message do %>
- <% "Connected" -> %>
-
-
- <% "Disconnected" -> %>
-
- <% _ -> %>
-
- <% end %>
-
-
- <:subtitle>
- <%= @server.public_ip %>
-
-
-
-
- <%= for {name, task} <- @health.tasks do %>
- Background task in progress: <%= name %>
-
<%= task.progress %> complete
- <% end %>
-
-
-
-
- Connect to your server using root credentials and execute the following command:
-
-
-
- #
-
- <%= @registration_command %>
+
+ <.header>
+
+
+
+
+ <%= case @health.message do %>
+ <% "Connected" -> %>
+
+
+ <% "Disconnected" -> %>
+
+ <% _ -> %>
+
+ <% end %>
-
-
-
-
-
-
-
-
-
<%= @sys_info.uptime || "" %>s
-
Uptime
-
-
-
<%= Enum.count(@sys_info.cpus || []) %>
-
CPUs
-
-
-
<%= calculate_cpu_usage(@sys_info.cpus) %>
-
CPU%
-
-
-
- <%= bytes_to_gigabytes(@sys_info.mem_total_bytes - @sys_info.mem_avail_bytes) %>
- /
- <%= bytes_to_gigabytes(@sys_info.mem_total_bytes) %>
- GiB
-
-
Memory
-
-
-
- <%= calculate_disk_used_percent(@sys_info.disks) %>
- %
-
-
Used Disk
-
-
-
-
-
-
- System
-
- Updates: <%= @sys_info.updates_available %> pending updates.
- <.button type="button" class="ml-4" phx-click="system_update">
- Update now
+
+ <:subtitle>
+ <%= @server.public_ip %>
+
+ <:actions>
+ <.button>+ New App
+ <.button class="border border-black bg-transparent text-black hover:text-white">
+ Quick actions <.icon name="hero-chevron-down" />
-
- <%= output %>
-
+
+
+
+ <%= for {name, task} <- @health.tasks do %>
+ Background task in progress: <%= name %>
+
<%= task.progress %> complete
+ <% end %>
+
+
+
+ Connect to your server using root credentials and execute the following command:
-
+
+
+ #
+
+ <%= @registration_command %>
+
+
+
+
+
+
+
+
+
<%= @sys_info.uptime || "" %>s
+
Uptime
+
+
+
<%= Enum.count(@sys_info.cpus || []) %>
+
CPUs
+
+
+
<%= calculate_cpu_usage(@sys_info.cpus) %>
+
CPU%
+
+
+
+ <%= bytes_to_gigabytes(@sys_info.mem_total_bytes - @sys_info.mem_avail_bytes) %>
+ /
+ <%= bytes_to_gigabytes(@sys_info.mem_total_bytes) %>
+ GiB
+
+
Memory
+
+
+
+ <%= calculate_disk_used_percent(@sys_info.disks) %>
+ %
+
+
Used Disk
+
+
+
+
+ System
+
+ Updates: <%= @sys_info.updates_available %> pending updates.
+ <.button type="button" class="ml-4" phx-click="system_update">
+ Update now
+
+
+ <%= output %>
+
+
+
+
+
+ Backups
+
+ <.table id="backups" rows={[%{date: "2023-10-11"}, %{date: "2023-10-10"}]}>
+ <:col :let={backup} label="Date"><%= backup.date %>
+ <:action>
+ <.button>Restore
+
+
+
+
+
+ Manage Services
+
+ <.table
+ id="services"
+ rows={[%{name: "mariadb", status: "Active"}, %{name: "php8.0", status: "Disabled"}]}
+ >
+ <:col :let={service} label="Service"><%= service.name %>
+ <:col :let={service} label="Status"><%= service.status %>
+ <:action>
+ <.button>Activate
+ <.button>Deactivate
+
+
+
+
+ <.back navigate={~p"/servers"}>Back to servers
-
-<.back navigate={~p"/servers"}>Back to servers
diff --git a/app/lib/prymn_web/router.ex b/app/lib/prymn_web/router.ex
index 0548e6d..21ccd5c 100644
--- a/app/lib/prymn_web/router.ex
+++ b/app/lib/prymn_web/router.ex
@@ -27,10 +27,10 @@ defmodule PrymnWeb.Router do
scope "/", PrymnWeb do
pipe_through [:browser, :require_authenticated_user]
- get "/", PageController, :home
-
live_session :require_authenticated_user,
on_mount: [{PrymnWeb.UserAuth, :ensure_authenticated}] do
+ live "/", DashboardLive
+
live "/users/settings", UserSettingsLive
live "/users/settings/confirm_email/:token", UserSettingsLive