defmodule LivebookWeb.SettingsLive do
use LivebookWeb, :live_view
import LivebookWeb.UserHelpers
alias LivebookWeb.{SidebarHelpers, PageHelpers}
@impl true
def mount(_params, _session, socket) do
{:ok,
socket
|> SidebarHelpers.shared_home_handlers()
|> assign(
file_systems: Livebook.Settings.file_systems(),
autosave_path_state: %{
file: autosave_dir(),
dialog_opened?: false
},
update_check_enabled: Livebook.UpdateCheck.enabled?(),
page_title: "Livebook - Settings"
)}
end
@impl true
def render(assigns) do
~H"""
Here you can change global Livebook configuration. Keep in mind
that this configuration gets persisted and will be restored on application
launch.
About
<%= if app_name = Livebook.Config.app_service_name() do %>
<.labeled_text label="Application">
<%= if app_url = Livebook.Config.app_service_url() do %>
<%= app_name %>
<% else %>
<%= app_name %>
<% end %>
<% end %>
<.labeled_text label="Livebook">
v<%= Application.spec(:livebook, :vsn) %>
<.labeled_text label="Elixir">
v<%= System.version() %>
<%= live_redirect to: Routes.live_dashboard_path(@socket, :home),
class: "button-base button-outlined-gray" do %>
<.remix_icon icon="dashboard-2-line" class="align-middle mr-1" />
Open dashboard
<% end %>
File systems are used to store notebooks. The local disk filesystem
is visible only to the current machine, but alternative file systems
are available, such as S3-based storages.
User settings
The configuration in this section changes only your Livebook
experience and is saved in your browser.
Code editor
<.switch_checkbox
name="editor_auto_completion"
label="Show completion list while typing"
checked={false} />
<.switch_checkbox
name="editor_auto_signature"
label="Show function signature while typing"
checked={false} />
<.switch_checkbox
name="editor_font_size"
label="Increase font size"
checked={false} />
<.switch_checkbox
name="editor_high_contrast"
label="Use high contrast theme"
checked={false} />
<.switch_checkbox
name="editor_markdown_word_wrap"
label="Wrap words in Markdown"
checked={false} />
<.current_user_modal current_user={@current_user} />
<%= if @live_action == :add_file_system do %>
<.modal id="add-file-system-modal" show class="w-full max-w-3xl" patch={Routes.settings_path(@socket, :page)}>
<.live_component module={LivebookWeb.SettingsLive.AddFileSystemComponent}
id="add-file-system"
return_to={Routes.settings_path(@socket, :page)} />
<% end %>
"""
end
defp autosave_path_select(%{state: %{dialog_opened?: true}} = assigns) do
~H"""