mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-27 13:56:21 +08:00
Add info about empty Kino outputs (#1899)
This commit is contained in:
parent
06f318bc20
commit
6061901ee9
2 changed files with 38 additions and 0 deletions
|
|
@ -119,6 +119,10 @@ defmodule LivebookWeb.AppLive do
|
|||
input_values={output_view.input_values}
|
||||
/>
|
||||
</div>
|
||||
<div :if={@data_view.output_views == []} class="info-box">
|
||||
This deployed notebook is empty. Deployed apps only render Kino outputs.
|
||||
Ensure you use Kino for interactive visualizations and dynamic content.
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 80vh"></div>
|
||||
</div>
|
||||
|
|
|
|||
34
test/livebook_web/live/app_live_test.exs
Normal file
34
test/livebook_web/live/app_live_test.exs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
defmodule LivebookWeb.AppLiveTest do
|
||||
use LivebookWeb.ConnCase, async: true
|
||||
|
||||
import Phoenix.LiveViewTest
|
||||
|
||||
alias Livebook.Session
|
||||
|
||||
test "render guidance when Kino output is empty", %{conn: conn} do
|
||||
session = start_session()
|
||||
|
||||
Session.subscribe(session.id)
|
||||
|
||||
slug = Livebook.Utils.random_short_id()
|
||||
app_settings = %{Livebook.Notebook.AppSettings.new() | slug: slug}
|
||||
Session.set_app_settings(session.pid, app_settings)
|
||||
|
||||
Session.set_notebook_name(session.pid, "My app #{slug}")
|
||||
Session.deploy_app(session.pid)
|
||||
|
||||
assert_receive {:operation, {:add_app, _, _, _}}
|
||||
assert_receive {:operation, {:set_app_registered, _, _, true}}
|
||||
|
||||
{:ok, view, _} = live(conn, ~p"/apps/#{slug}")
|
||||
|
||||
assert render(view) =~
|
||||
"This deployed notebook is empty. Deployed apps only render Kino outputs."
|
||||
end
|
||||
|
||||
defp start_session() do
|
||||
{:ok, session} = Livebook.Sessions.create_session()
|
||||
on_exit(fn -> Session.close(session.pid) end)
|
||||
session
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue