livebook/lib/livebook_web/live/session_live/runtime_helpers.ex
Jonatan Kłosko 4493a60380
Improve runtimes UI (#655)
* Show reconnect for all runtime types when applicable

* Make it clear which runtime is the default

* Show Mix.install restart suggestion only for standalone runtimes

* Fix tests not to rely on the default runtime tab
2021-10-28 19:41:07 +02:00

22 lines
629 B
Elixir

defmodule LivebookWeb.SessionLive.RuntimeHelpers do
use Phoenix.Component
@doc """
Displays an info text if `@module` is the default runtime.
"""
def default_runtime_note(assigns) do
~H"""
<%= if default_runtime_module?(@module) do %>
<p class="text-gray-600 text-sm">
Note: This is the <span class="font-semibold">default runtime</span> and starts
automatically as soon as you evaluate the first cell.
</p>
<% end %>
"""
end
defp default_runtime_module?(module) do
{default_module, _args} = Livebook.Config.default_runtime()
default_module == module
end
end