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:
Jonatan Kłosko 2021-04-14 22:37:17 +02:00 committed by GitHub
parent 9c6d747aca
commit 69343bfc3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,7 @@ defmodule Livebook.Session do
@type summary :: %{
session_id: id(),
pid: pid(),
notebook_name: String.t(),
path: String.t() | nil,
images_dir: String.t()
@ -504,6 +505,7 @@ defmodule Livebook.Session do
defp summary_from_state(state) do
%{
session_id: state.session_id,
pid: self(),
notebook_name: state.data.notebook.name,
path: state.data.path,
images_dir: images_dir_from_state(state)

View file

@ -26,6 +26,12 @@ defmodule LivebookWeb.SessionLive.SessionsComponent do
<%= remix_icon("git-branch-line") %>
<span class="font-medium">Fork</span>
</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),
class: "flex space-x-3 px-5 py-2 items-center text-red-600 hover:bg-gray-50" do %>
<%= remix_icon("close-circle-line") %>