mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-23 03:16:00 +08:00
c1654345b7
* Update phoenix deps
* Update reference to LiveDashboard encode_pid
* Fix form input id references
* Move to HEEx
* Update back to filesystem LV npm package
* Further HEEx rewrites
* Refactor icons into function components
* .html.leex -> .html.heex
* Further refactoring
* Move render helpers into function components
* Add doctype back
* Further refactoring
* Refactor cell component
* Further refactoring
* Compose sidebar using function components
* Rewrite notebook card component as function component
* Fruther refactoring
* Fix race condition in runtime tests
* Rewrite tooltips into function component
* Update Tailwind purge rules
* Revert "Rewrite tooltips into function component"
This reverts commit bd6ca8f0b5
.
* Refactor conditional tooltip
42 lines
1.3 KiB
Elixir
42 lines
1.3 KiB
Elixir
defmodule LivebookWeb.SessionLive.EmbeddedLive do
|
|
use LivebookWeb, :live_view
|
|
|
|
alias Livebook.{Session, Runtime}
|
|
|
|
@impl true
|
|
def mount(_params, %{"session_id" => session_id}, socket) do
|
|
{:ok, assign(socket, session_id: session_id)}
|
|
end
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<div class="flex-col space-y-5">
|
|
<p class="text-gray-700">
|
|
Run the notebook code within the Livebook node itself.
|
|
This is reserved for specific cases where there is no option
|
|
of starting a separate Elixir runtime (for example, on embedded
|
|
devices or cases where the amount of memory available is
|
|
limited). Prefer the "Elixir standalone" runtime whenever possible.
|
|
</p>
|
|
<p class="text-gray-700">
|
|
<span class="font-semibold">Warning:</span>
|
|
any module that you define will be defined globally until
|
|
you restart Livebook. Furthermore, code in one notebook
|
|
may interfere with code from another notebook.
|
|
</p>
|
|
<button class="button button-blue" phx-click="init">
|
|
Connect
|
|
</button>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def handle_event("init", _params, socket) do
|
|
{:ok, runtime} = Runtime.Embedded.init()
|
|
Session.connect_runtime(socket.assigns.session_id, runtime)
|
|
{:noreply, socket}
|
|
end
|
|
end
|