defmodule LivebookWeb.SettingsLive.EnvVarsComponent do use LivebookWeb, :live_component @impl true def render(assigns) do assigns = assigns |> assign_new(:target, fn -> nil end) |> assign_new(:edit_label, fn -> "Edit" end) ~H"""
<.no_entries :if={@env_vars == []}> No environment variables here... yet!
<.table id="env-var-table" rows={@env_vars}> <:col :let={env_var} label="Name"><%= env_var.name %> <:action :let={env_var}> <.icon_button id={"env-var-#{env_var.name}-edit"} type="button" phx-click={ JS.push("edit_env_var", value: %{env_var: env_var.name}, target: @target) } > <.remix_icon icon="edit-fill" /> <:action :let={env_var}> <.icon_button id={"env-var-#{env_var.name}-delete"} type="button" phx-click={ JS.push("delete_env_var", value: %{env_var: env_var.name}, target: @target) } > <.remix_icon icon="delete-bin-6-line" />
<.button patch={@add_env_var_path} id="add-env-var"> Add environment variable
""" end end