fix: properly support adding embeds for nil values

fix: upgrade `ash_phoenix` for fix on calculating values
This commit is contained in:
Zach Daniel 2024-07-26 12:25:03 -04:00
parent c549656060
commit 4a62e1210e
4 changed files with 4 additions and 12 deletions

View file

@ -1391,7 +1391,7 @@ defmodule AshAdmin.Components.Resource.Form do
defp allow_nil_option(_, _), do: "Select an option"
defp can_append_embed?(form, attribute, {:array, _}) do
defp can_append_embed?(form, attribute, _) do
case AshPhoenix.Form.value(form, attribute) do
%Ash.Union{value: nil} ->
true
@ -1407,8 +1407,6 @@ defmodule AshAdmin.Components.Resource.Form do
end
end
defp can_append_embed?(_, _, _), do: false
defp placeholder(value) when is_function(value) do
"DEFAULT"
end

View file

@ -89,13 +89,7 @@ defmodule AshAdmin.Components.Resource.Table do
defp attributes(resource, attributes, skip) do
attributes
|> Enum.map(fn x ->
value = Ash.Resource.Info.field(resource, x)
if is_nil(value) do
Ash.Resource.Info.relationship(resource, x)
else
value
end
Ash.Resource.Info.field(resource, x)
end)
|> Enum.filter(& &1)
|> Enum.reject(&(&1.name in skip))

View file

@ -116,7 +116,7 @@ defmodule AshAdmin.MixProject do
defp deps do
[
{:ash, "~> 3.0"},
{:ash_phoenix, "~> 2.0 and >= 2.0.4"},
{:ash_phoenix, "~> 2.1"},
{:phoenix_view, "~> 2.0"},
{:phoenix, "~> 1.7"},
{:phoenix_live_view, "~> 0.20"},

View file

@ -1,6 +1,6 @@
%{
"ash": {:hex, :ash, "3.2.6", "a09042b76c5b573831fcdf004d1109592f9b63fdebc5b464a750289cfaecad83", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter, ">= 0.2.12 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 0.9", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.2.8 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.2", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 1.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ee850c1e77f987ac094199175610e86558087469a930762e3cd8f6d91ef9da8d"},
"ash_phoenix": {:hex, :ash_phoenix, "2.0.4", "0d18a3371879b875865180aaabc1697a35a6dcb9ebd2f346456208214bd02c9e", [:mix], [{:ash, "~> 3.0", [hex: :ash, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5.6 or ~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.20.3 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "f3ea5309b42cdcaafc0ca713757cd4bb4819e02aeacc5195a040a955e861767d"},
"ash_phoenix": {:hex, :ash_phoenix, "2.1.0", "a05d372df10f079b96ff1558aa2fc896a064c6861a25d6cf419ef434a6607f80", [:mix], [{:ash, "~> 3.0", [hex: :ash, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5.6 or ~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.20.3 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "ef6a509db2a69ace5e8200fd5cb075f707980a2d6e29ac65b36ea215f3e8952c"},
"ash_postgres": {:hex, :ash_postgres, "2.1.15", "ee43c3a856526b7238e66e7c34466218cbc4da278004ced7df197aadfeb2db26", [:mix], [{:ash, ">= 3.2.5 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:ash_sql, ">= 0.2.26 and < 1.0.0-0", [hex: :ash_sql, repo: "hexpm", optional: false]}, {:ecto, ">= 3.11.2 and < 4.0.0-0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, ">= 3.11.3 and < 4.0.0-0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:igniter, ">= 0.3.6 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "7700b3585c0fda524e37ee946ce95698579a5bb38e7f680be0b6d20772a68a47"},
"ash_sql": {:hex, :ash_sql, "0.2.26", "79158f0ec945c83a4403eaa75f7349dde573c4115ef477f57c22624f27607f21", [:mix], [{:ash, ">= 3.1.7 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}], "hexpm", "a19b591df382cbc30131e5724514b3737c10a2ab7baf497f5229d1b3557d1244"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},