defmodule LivebookWeb.SessionLive.DeleteSectionComponent do
use LivebookWeb, :live_component
@impl true
def render(assigns) do
~H"""
Delete section
Are you sure you want to delete this section -
“<%= @section.name %>”?
"""
end
@impl true
def handle_event("delete", %{"delete_cells" => delete_cells}, socket) do
delete_cells? = delete_cells == "true"
Livebook.Session.delete_section(
socket.assigns.session.pid,
socket.assigns.section.id,
delete_cells?
)
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
end
end