defmodule LivebookWeb.SettingsLive.RemoveFileSystemComponent do
use LivebookWeb, :live_component
@impl true
def render(assigns) do
~H"""
Detach file system
Are you sure you want to detach this file system?
Any sessions using it will keep the access until
they get closed.
<%= live_patch "Cancel", to: @return_to, class: "button button-outlined-gray" %>
"""
end
@impl true
def handle_event("detach", %{}, socket) do
file_systems = Livebook.Config.remove_file_system(socket.assigns.file_system)
send(self(), {:file_systems_updated, file_systems})
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
end
end