From 4f38fea5cd36f662a9f89470593d25b4624c2c3a Mon Sep 17 00:00:00 2001 From: Cristine Guadelupe Date: Thu, 28 Dec 2023 16:21:52 -0300 Subject: [PATCH] Deployment groups adjustments (#2414) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jonatan KÅ‚osko --- lib/livebook/config.ex | 2 +- lib/livebook/live_markdown/import.ex | 3 ++- lib/livebook_web/live/app_helpers.ex | 6 +++--- .../live/session_live/app_docker_component.ex | 14 ++++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/livebook/config.ex b/lib/livebook/config.ex index e60fbcef8..8b960af2f 100644 --- a/lib/livebook/config.ex +++ b/lib/livebook/config.ex @@ -31,7 +31,7 @@ defmodule Livebook.Config do name: "Teleport", value: "Teleport cluster address", module: Livebook.ZTA.Teleport, - help: "Example: https://[cluster-name]:3080" + placeholder: "https://[cluster-name]:3080" } ] diff --git a/lib/livebook/live_markdown/import.ex b/lib/livebook/live_markdown/import.ex index 76dae5986..7f7da653a 100644 --- a/lib/livebook/live_markdown/import.ex +++ b/lib/livebook/live_markdown/import.ex @@ -354,7 +354,8 @@ defmodule Livebook.LiveMarkdown.Import do if is_nil(hub_id) or Hubs.hub_exists?(hub_id) do {attrs, true, messages} else - {Map.delete(attrs, :hub_id), false, messages ++ [@unknown_hub_message]} + {Map.drop(attrs, [:hub_id, :deployment_group_id]), false, + messages ++ [@unknown_hub_message]} end # We identify a single leading cell as the setup cell, in any diff --git a/lib/livebook_web/live/app_helpers.ex b/lib/livebook_web/live/app_helpers.ex index a5775d058..762112a86 100644 --- a/lib/livebook_web/live/app_helpers.ex +++ b/lib/livebook_web/live/app_helpers.ex @@ -160,7 +160,7 @@ defmodule LivebookWeb.AppHelpers do :if={zta_metadata = zta_metadata(@form[:zta_provider].value)} field={@form[:zta_key]} label={zta_metadata.value} - help={zta_help(zta_metadata)} + placeholder={zta_placeholder(zta_metadata)} phx-debounce disabled={@form[:ready_only].value} class="disabled:cursor-not-allowed" @@ -301,6 +301,6 @@ defmodule LivebookWeb.AppHelpers do Enum.reject(apps, &(&1.slug == app.slug)) end - defp zta_help(%{help: help}), do: "#{help}" - defp zta_help(_), do: nil + defp zta_placeholder(%{placeholder: placeholder}), do: placeholder + defp zta_placeholder(_), do: nil end diff --git a/lib/livebook_web/live/session_live/app_docker_component.ex b/lib/livebook_web/live/session_live/app_docker_component.ex index 85818e2be..2faf63615 100644 --- a/lib/livebook_web/live/session_live/app_docker_component.ex +++ b/lib/livebook_web/live/session_live/app_docker_component.ex @@ -105,11 +105,7 @@ defmodule LivebookWeb.SessionLive.AppDockerComponent do id="select_deployment_group_form" > <.select_field - help={ - ~S''' - Share deployment credentials, secrets, and configuration with deployment groups. - ''' - } + help={deployment_group_help()} field={@deployment_group_form[:deployment_group_id]} options={deployment_group_options(@deployment_groups)} label="Deployment Group" @@ -119,7 +115,9 @@ defmodule LivebookWeb.SessionLive.AppDockerComponent do <% else %>

- <.label>Deployment Group + <.label help={deployment_group_help()}> + Deployment Group + No deployment groups available

<% end %> @@ -285,4 +283,8 @@ defmodule LivebookWeb.SessionLive.AppDockerComponent do assigns.changeset end end + + defp deployment_group_help() do + "Share deployment credentials, secrets, and configuration with deployment groups." + end end