mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-13 00:14:33 +08:00
Link to live dashboard for each running session to show process info (#186)
* Link to live dashboard for each running session to show process info * Update lib/livebook_web/live/home_live/sessions_component.ex Co-authored-by: José Valim <jose.valim@dashbit.co> Co-authored-by: José Valim <jose.valim@dashbit.co>
This commit is contained in:
parent
9c6d747aca
commit
69343bfc3c
2 changed files with 8 additions and 0 deletions
|
@ -26,6 +26,7 @@ defmodule Livebook.Session do
|
||||||
|
|
||||||
@type summary :: %{
|
@type summary :: %{
|
||||||
session_id: id(),
|
session_id: id(),
|
||||||
|
pid: pid(),
|
||||||
notebook_name: String.t(),
|
notebook_name: String.t(),
|
||||||
path: String.t() | nil,
|
path: String.t() | nil,
|
||||||
images_dir: String.t()
|
images_dir: String.t()
|
||||||
|
@ -504,6 +505,7 @@ defmodule Livebook.Session do
|
||||||
defp summary_from_state(state) do
|
defp summary_from_state(state) do
|
||||||
%{
|
%{
|
||||||
session_id: state.session_id,
|
session_id: state.session_id,
|
||||||
|
pid: self(),
|
||||||
notebook_name: state.data.notebook.name,
|
notebook_name: state.data.notebook.name,
|
||||||
path: state.data.path,
|
path: state.data.path,
|
||||||
images_dir: images_dir_from_state(state)
|
images_dir: images_dir_from_state(state)
|
||||||
|
|
|
@ -26,6 +26,12 @@ defmodule LivebookWeb.SessionLive.SessionsComponent do
|
||||||
<%= remix_icon("git-branch-line") %>
|
<%= remix_icon("git-branch-line") %>
|
||||||
<span class="font-medium">Fork</span>
|
<span class="font-medium">Fork</span>
|
||||||
</button>
|
</button>
|
||||||
|
<%= link to: Routes.live_dashboard_path(@socket, :page, node(), "processes", info: Phoenix.LiveDashboard.Helpers.encode_pid(summary.pid)),
|
||||||
|
class: "flex space-x-3 px-5 py-2 items-center text-gray-600 hover:bg-gray-50",
|
||||||
|
target: "_blank" do %>
|
||||||
|
<%= remix_icon("dashboard-2-line") %>
|
||||||
|
<span class="font-medium">See on Dashboard</span>
|
||||||
|
<% end %>
|
||||||
<%= live_patch to: Routes.home_path(@socket, :close_session, summary.session_id),
|
<%= live_patch to: Routes.home_path(@socket, :close_session, summary.session_id),
|
||||||
class: "flex space-x-3 px-5 py-2 items-center text-red-600 hover:bg-gray-50" do %>
|
class: "flex space-x-3 px-5 py-2 items-center text-red-600 hover:bg-gray-50" do %>
|
||||||
<%= remix_icon("close-circle-line") %>
|
<%= remix_icon("close-circle-line") %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue