From 89998976856769c49d3c94ca95d6c25baa9de9ba Mon Sep 17 00:00:00 2001 From: KKlochko Date: Fri, 9 May 2025 14:37:13 +0300 Subject: [PATCH] Update Server edit to allow change only sync_on? for other server's data. --- .../live/dbi_server_live/form_component.ex | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/decentralised_book_index_web/live/dbi_server_live/form_component.ex b/lib/decentralised_book_index_web/live/dbi_server_live/form_component.ex index 0d3e3d6..778ed82 100644 --- a/lib/decentralised_book_index_web/live/dbi_server_live/form_component.ex +++ b/lib/decentralised_book_index_web/live/dbi_server_live/form_component.ex @@ -16,8 +16,14 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.FormComponent do phx-change="validate" phx-submit="save" > - <.input field={@form[:name]} type="text" label="Name" /> - <.input field={@form[:url]} type="text" label="Url" /> + <%= if @form.source.type == :create do %> + <.input field={@form[:name]} type="text" label="Name" /> + <.input field={@form[:url]} type="text" label="Url" /> + <% end %> + <%= if @form.source.type == :update and is_nil(@form[:dbi_server].value) do %> + <.input field={@form[:name]} type="text" label="Name" /> + <.input field={@form[:url]} type="text" label="Url" /> + <% end %> <.input field={@form[:sync_on?]} type="checkbox" label="Sync on" /> <:actions>