Update to refactor the unused and deprecated code.

dev
KKlochko 2 months ago
parent 601f77e0a8
commit e2094b915f

@ -2,8 +2,6 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.JustSearchResources
use Phoenix.Component
use DecentralisedBookIndexWeb, :verified_routes
alias DecentralisedBookIndex.Accounts.Role
attr :search_query, :string, default: ""
attr :select_options, :list, required: true
attr :selected_option, :string, required: true

@ -39,7 +39,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
|> assign(:page_title, "Edit Author")
|> assign(
:author,
Ash.get!(DecentralisedBookIndex.Metadata.Author, id, actor: socket.assigns.current_user)
Ash.get!(Metadata.Author, id, actor: socket.assigns.current_user)
)
end

@ -94,7 +94,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.FormComponent do
socket =
socket
|> push_redirect(to: patch_url(socket.assigns.action, author_id))
|> push_navigate(to: patch_url(socket.assigns.action, author_id))
{:noreply, socket}
end
@ -109,7 +109,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.FormComponent do
actor: socket.assigns.current_user
)
else
AshPhoenix.Form.for_create(DecentralisedBookIndex.Metadata.Author, :create,
AshPhoenix.Form.for_create(Metadata.Author, :create,
as: "author",
actor: socket.assigns.current_user
)

@ -175,7 +175,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
end
@impl true
def handle_event("add-bid", params, socket) do
def handle_event("add-bid", _params, socket) do
socket =
update(socket, :form, fn form ->
AshPhoenix.Form.add_form(form, :bids)
@ -265,7 +265,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
end
@impl true
def handle_event("add-author-role", params, socket) do
def handle_event("add-author-role", _params, socket) do
socket =
update(socket, :form, fn form ->
AshPhoenix.Form.add_form(form, :author_roles)
@ -333,7 +333,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
socket =
socket
|> push_redirect(to: patch_url(socket.assigns.action, book_id))
|> push_navigate(to: patch_url(socket.assigns.action, book_id))
{:noreply, socket}
end
@ -409,7 +409,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
{:noreply, socket}
end
def handle_event("open-select-author", %{"path" => path, "value" => value}, socket) do
def handle_event("open-select-author", %{"path" => path}, socket) do
socket =
socket
|> assign(:select_author_open?, true)

@ -39,7 +39,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Edit do
|> assign(:page_title, "Edit Server")
|> assign(
:dbi_server,
Ash.get!(DecentralisedBookIndex.Metadata.DBIServer, id, actor: socket.assigns.current_user)
Ash.get!(Metadata.DBIServer, id, actor: socket.assigns.current_user)
)
end

@ -57,7 +57,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.FormComponent do
socket =
socket
|> put_flash(:info, "Server #{socket.assigns.form.source.type}d successfully")
|> push_redirect(to: patch_url(socket.assigns.action, dbi_server.id))
|> push_navigate(to: patch_url(socket.assigns.action, dbi_server.id))
{:noreply, socket}
@ -72,7 +72,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.FormComponent do
socket =
socket
|> push_redirect(to: patch_url(socket.assigns.action, dbi_server_id))
|> push_navigate(to: patch_url(socket.assigns.action, dbi_server_id))
{:noreply, socket}
end

@ -101,7 +101,6 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Index do
|> apply_action(socket.assigns.live_action, params)
{:noreply, socket}
# {:noreply, apply_action(socket, socket.assigns.live_action, params)}
end
defp apply_action(socket, :edit, %{"id" => id}) do

@ -39,7 +39,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
|> assign(:page_title, "Edit Publisher")
|> assign(
:publisher,
Ash.get!(DecentralisedBookIndex.Metadata.Publisher, id, actor: socket.assigns.current_user)
Ash.get!(Metadata.Publisher, id, actor: socket.assigns.current_user)
)
end

@ -58,7 +58,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.FormComponent do
socket =
socket
|> put_flash(:info, "Publisher #{socket.assigns.form.source.type}d successfully")
|> push_redirect(to: patch_url(socket.assigns.action, publisher.id))
|> push_navigate(to: patch_url(socket.assigns.action, publisher.id))
{:noreply, socket}
@ -73,7 +73,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.FormComponent do
socket =
socket
|> push_redirect(to: patch_url(socket.assigns.action, publisher_id))
|> push_navigate(to: patch_url(socket.assigns.action, publisher_id))
{:noreply, socket}
end

@ -57,7 +57,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.FormComponent do
socket =
socket
|> put_flash(:info, "User #{socket.assigns.form.source.type}d successfully")
|> push_redirect(to: patch_url(socket.assigns.action, user.id))
|> push_navigate(to: patch_url(socket.assigns.action, user.id))
{:noreply, socket}
@ -72,7 +72,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.FormComponent do
socket =
socket
|> push_redirect(to: patch_url(socket.assigns.action, user_id))
|> push_navigate(to: patch_url(socket.assigns.action, user_id))
{:noreply, socket}
end
@ -92,7 +92,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.FormComponent do
socket =
socket
|> put_flash(:info, "User not exists successfully")
|> push_redirect(to: patch_url(socket.assigns.action, nil))
|> push_navigate(to: patch_url(socket.assigns.action, nil))
{:noreply, socket}
end

Loading…
Cancel
Save