From 5a44b159a84858ac9396332d334af77cfa4802d0 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 18 Mar 2024 21:31:38 -0400 Subject: [PATCH] chore: form -> query --- .../components/resource/data_table.ex | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/ash_admin/components/resource/data_table.ex b/lib/ash_admin/components/resource/data_table.ex index 820554c..bf8f5b7 100644 --- a/lib/ash_admin/components/resource/data_table.ex +++ b/lib/ash_admin/components/resource/data_table.ex @@ -298,24 +298,24 @@ defmodule AshAdmin.Components.Resource.DataTable do _ -> :create end - form = AshPhoenix.Form.add_form(socket.assigns.form, path, type: type) + query = AshPhoenix.Form.add_form(socket.assigns.query, path, type: type) {:noreply, socket - |> assign(:form, form)} + |> assign(:query, query)} end def handle_event("remove_form", %{"path" => path}, socket) do - form = AshPhoenix.Form.remove_form(socket.assigns.form, path) + query = AshPhoenix.Form.remove_form(socket.assigns.query, path) {:noreply, socket - |> assign(:form, form)} + |> assign(:query, query)} end def handle_event("append_value", %{"path" => path, "field" => field}, socket) do list = - AshPhoenix.Form.get_form(socket.assigns.form, path) + AshPhoenix.Form.get_form(socket.assigns.query, path) |> AshPhoenix.Form.value(String.to_existing_atom(field)) |> Kernel.||([]) |> indexed_list() @@ -323,16 +323,19 @@ defmodule AshAdmin.Components.Resource.DataTable do params = put_in_creating( - socket.assigns.form.params || %{}, - Enum.map(AshPhoenix.Form.parse_path!(socket.assigns.form, path) ++ [field], &to_string/1), + socket.assigns.query.params || %{}, + Enum.map( + AshPhoenix.Form.parse_path!(socket.assigns.query, path) ++ [field], + &to_string/1 + ), list ) - form = AshPhoenix.Form.validate(socket.assigns.form, params) + query = AshPhoenix.Form.validate(socket.assigns.query, params) {:noreply, socket - |> assign(:form, form)} + |> assign(:query, query)} end defp indexed_list(map) when is_map(map) do