2021-04-23 23:40:13 +08:00
|
|
|
defmodule LivebookWeb.HomeLive.SessionsComponent do
|
2021-03-04 05:56:28 +08:00
|
|
|
use LivebookWeb, :live_component
|
2021-02-21 23:54:44 +08:00
|
|
|
|
|
|
|
@impl true
|
|
|
|
def render(assigns) do
|
|
|
|
~L"""
|
2021-03-12 18:57:01 +08:00
|
|
|
<div class="flex flex-col space-y-4">
|
2021-02-21 23:54:44 +08:00
|
|
|
<%= for summary <- @session_summaries do %>
|
2021-03-26 02:04:49 +08:00
|
|
|
<div class="p-5 flex items-center border border-gray-200 rounded-lg"
|
|
|
|
data-test-session-id="<%= summary.session_id %>">
|
2021-03-12 18:57:01 +08:00
|
|
|
<div class="flex-grow flex flex-col space-y-1">
|
|
|
|
<%= live_redirect summary.notebook_name, to: Routes.session_path(@socket, :page, summary.session_id),
|
|
|
|
class: "font-semibold text-gray-800 hover:text-gray-900" %>
|
|
|
|
<div class="text-gray-600 text-sm">
|
|
|
|
<%= summary.path || "No file" %>
|
2021-02-21 23:54:44 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-04-22 05:02:09 +08:00
|
|
|
<div class="relative" id="session-<%= summary.session_id %>-menu" phx-hook="Menu" data-element="menu">
|
|
|
|
<button class="icon-button" data-toggle>
|
2021-03-23 21:10:34 +08:00
|
|
|
<%= remix_icon("more-2-fill", class: "text-xl") %>
|
2021-03-20 21:10:15 +08:00
|
|
|
</button>
|
2021-04-22 05:02:09 +08:00
|
|
|
<div class="menu" data-content>
|
|
|
|
<button class="menu__item text-gray-500"
|
2021-03-20 21:10:15 +08:00
|
|
|
phx-click="fork_session"
|
2021-03-26 02:04:49 +08:00
|
|
|
phx-value-id="<%= summary.session_id %>">
|
2021-03-20 21:10:15 +08:00
|
|
|
<%= remix_icon("git-branch-line") %>
|
|
|
|
<span class="font-medium">Fork</span>
|
|
|
|
</button>
|
2021-04-22 05:02:09 +08:00
|
|
|
<%= link to: live_dashboard_process_path(@socket, summary.pid),
|
|
|
|
class: "menu__item text-gray-500",
|
2021-04-15 04:37:17 +08:00
|
|
|
target: "_blank" do %>
|
|
|
|
<%= remix_icon("dashboard-2-line") %>
|
|
|
|
<span class="font-medium">See on Dashboard</span>
|
|
|
|
<% end %>
|
2021-04-13 05:24:26 +08:00
|
|
|
<%= live_patch to: Routes.home_path(@socket, :close_session, summary.session_id),
|
2021-04-22 05:02:09 +08:00
|
|
|
class: "menu__item text-red-600" do %>
|
2021-04-13 05:24:26 +08:00
|
|
|
<%= remix_icon("close-circle-line") %>
|
|
|
|
<span class="font-medium">Close</span>
|
2021-03-26 00:39:18 +08:00
|
|
|
<% end %>
|
2021-03-20 21:10:15 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-21 23:54:44 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|