defmodule LivebookWeb.Hub.Edit.TeamComponent do use LivebookWeb, :live_component alias Livebook.Hubs.Team alias Livebook.Teams alias LivebookWeb.LayoutHelpers @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 && &1.value)) end {:ok, socket |> assign( secrets: secrets, show_key: show_key?, secret_name: secret_name, secret_value: secret_value ) |> assign_form(changeset)} end @impl true def render(assigns) do ~H"""
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.