mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-10 21:46:46 +08:00
Disable saving UI in app sessions (#2952)
This commit is contained in:
parent
3eb574c1aa
commit
1a33c3000a
2 changed files with 25 additions and 0 deletions
|
@ -178,6 +178,11 @@ defmodule LivebookWeb.SessionLive do
|
||||||
%{select_secret_metadata: select_secret_metadata, prefill_secret_name: params["secret_name"]}}
|
%{select_secret_metadata: select_secret_metadata, prefill_secret_name: params["secret_name"]}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp handle_params(:file_settings, _params, _url, socket)
|
||||||
|
when socket.private.data.mode == :app do
|
||||||
|
{redirect_to_self(socket), %{}}
|
||||||
|
end
|
||||||
|
|
||||||
defp handle_params(live_action, params, _url, socket)
|
defp handle_params(live_action, params, _url, socket)
|
||||||
when live_action in [:app_settings, :file_settings] do
|
when live_action in [:app_settings, :file_settings] do
|
||||||
{socket, %{context: params["context"]}}
|
{socket, %{context: params["context"]}}
|
||||||
|
|
|
@ -28,6 +28,7 @@ defmodule LivebookWeb.SessionLive.Render do
|
||||||
<div data-el-js-view-iframes phx-update="ignore" id="js-view-iframes"></div>
|
<div data-el-js-view-iframes phx-update="ignore" id="js-view-iframes"></div>
|
||||||
<.indicators
|
<.indicators
|
||||||
session_id={@session.id}
|
session_id={@session.id}
|
||||||
|
mode={@session.mode}
|
||||||
file={@data_view.file}
|
file={@data_view.file}
|
||||||
dirty={@data_view.dirty}
|
dirty={@data_view.dirty}
|
||||||
persistence_warnings={@data_view.persistence_warnings}
|
persistence_warnings={@data_view.persistence_warnings}
|
||||||
|
@ -1029,6 +1030,7 @@ defmodule LivebookWeb.SessionLive.Render do
|
||||||
>
|
>
|
||||||
<.view_indicator />
|
<.view_indicator />
|
||||||
<.persistence_indicator
|
<.persistence_indicator
|
||||||
|
mode={@mode}
|
||||||
file={@file}
|
file={@file}
|
||||||
dirty={@dirty}
|
dirty={@dirty}
|
||||||
persistence_warnings={@persistence_warnings}
|
persistence_warnings={@persistence_warnings}
|
||||||
|
@ -1090,6 +1092,24 @@ defmodule LivebookWeb.SessionLive.Render do
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp persistence_indicator(%{mode: :app} = assigns) do
|
||||||
|
~H"""
|
||||||
|
<span
|
||||||
|
class="tooltip left"
|
||||||
|
data-tooltip={
|
||||||
|
~S'''
|
||||||
|
This session is a deployed app. You can use it
|
||||||
|
for debugging, but changes are not persisted.
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<button class={[status_button_classes(:gray), "opacity-60"]} disabled>
|
||||||
|
<.remix_icon icon="save-line" />
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
defp persistence_indicator(%{file: nil} = assigns) do
|
defp persistence_indicator(%{file: nil} = assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<span class="tooltip left" data-tooltip="Choose a file to save the notebook">
|
<span class="tooltip left" data-tooltip="Choose a file to save the notebook">
|
||||||
|
|
Loading…
Add table
Reference in a new issue