defmodule LivebookWeb.Hub.Edit.TeamComponent do use LivebookWeb, :live_component alias Livebook.Hubs.Team alias Livebook.Teams alias LivebookWeb.LayoutHelpers alias LivebookWeb.NotFoundError @impl true def update(assigns, socket) do socket = assign(socket, assigns) changeset = Team.change_hub(assigns.hub) show_key? = assigns.params["show-key"] == "true" secrets = Livebook.Hubs.get_secrets(assigns.hub) secret_name = assigns.params["secret_name"] secret_value = if assigns.live_action == :edit_secret do Enum.find_value(secrets, &(&1.name == secret_name and &1.value)) || raise(NotFoundError, "could not find secret matching #{inspect(secret_name)}") end {:ok, socket |> assign( secrets: secrets, show_key: show_key?, secret_name: secret_name, secret_value: secret_value ) |> assign_dockerfile() |> assign_form(changeset)} end @impl true def render(assigns) do ~H"""
A shared Teams hub. All resources here are shared with your team. Manage users and billing on livebook.dev.
Secrets are a safe way to share credentials and tokens with notebooks.
They are often shared with Smart cells and can be read as
environment variables using the LB_ prefix.
Deploy your stamped notebooks with your Hub using an instance of the Hub using environment variables.
Once deleted, you won’t be able to access its features unless you rejoin.