Skip to content

Commit 3594ac3

Browse files
chore: fixing credo warning
1 parent 2d7b46c commit 3594ac3

File tree

5 files changed

+10
-53
lines changed

5 files changed

+10
-53
lines changed

lib/ash_admin/components/resource/show.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defmodule AshAdmin.Components.Resource.Show do
99

1010
require Logger
1111

12-
alias AshAdmin.Components.Resource.{Helpers.FormatHelper, SensitiveAttribute, CinderTable}
12+
alias AshAdmin.Components.Resource.{CinderTable, Helpers.FormatHelper, SensitiveAttribute}
1313
import AshAdmin.Helpers
1414
import AshAdmin.CoreComponents
1515

lib/ash_admin/pages/page_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ defmodule AshAdmin.PageLive do
455455
def handle_event("clear_all_filters", _params, socket), do: {:noreply, socket}
456456
def handle_event("toggle_sort", _params, socket), do: {:noreply, socket}
457457
def handle_event("goto_page", _params, socket), do: {:noreply, socket}
458-
def handle_event("filter_change", params, socket), do: {:noreply, socket}
458+
def handle_event("filter_change", _params, socket), do: {:noreply, socket}
459459

460460
@impl true
461461
def handle_info({:filter_builder_value, _filter, filter_query}, socket) do

mix.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ defmodule AshAdmin.MixProject do
123123
]
124124
end
125125

126-
if Mix.env() == :test do
126+
if Mix.env() == :text do
127127
# Run "mix help compile.app" to learn about applications.
128128
def application do
129129
[
130-
extra_applications: [:logger]
130+
extra_applications: [:logger],
131+
mod: {AshAdmin, []}
131132
]
132133
end
133134
end

test/components/resource/data_table_filtering_test.exs

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,8 @@ defmodule AshAdmin.Test.Components.Resource.DataTableFilteringTest do
1818
{view, render(view)}
1919
end
2020

21-
# Helper function to wait for Cinder table to finish loading (for existing view)
22-
defp wait_for_table_load(view) do
23-
refute_eventually(fn -> render(view) =~ "Loading..." end, timeout: 5000, interval: 100)
24-
view
25-
end
26-
2721
# Helper to retry a condition until it's false or timeout
28-
defp refute_eventually(func, opts \\ []) do
22+
defp refute_eventually(func, opts) do
2923
timeout = Keyword.get(opts, :timeout, 2000)
3024
interval = Keyword.get(opts, :interval, 50)
3125
end_time = System.monotonic_time(:millisecond) + timeout
@@ -89,7 +83,7 @@ defmodule AshAdmin.Test.Components.Resource.DataTableFilteringTest do
8983

9084
describe "basic filter functionality" do
9185
test "renders data table instead of schema view", %{conn: conn} do
92-
{view, html} =
86+
{_view, html} =
9387
live_and_wait(conn, "/api/admin?domain=Domain&resource=Post&action_type=read&action=read")
9488

9589
# Should NOT show the schema view (Attributes/Relationships tables)
@@ -151,45 +145,6 @@ defmodule AshAdmin.Test.Components.Resource.DataTableFilteringTest do
151145
assert html =~ "Second post about Phoenix"
152146
assert html =~ "Third post about Testing"
153147
end
154-
155-
# @tag timeout: :infinity
156-
test "clears individual filter", %{conn: conn} do
157-
# :debugger.start()
158-
# module = Cinder.Table.LiveComponent
159-
# {:module, _} = :int.ni(module)
160-
# :ok = :int.break(module, 256)
161-
162-
{view, _html} =
163-
live_and_wait(conn, "/api/admin?domain=Domain&resource=Post&action_type=read&action=read")
164-
165-
# Apply filter
166-
view
167-
|> element("form")
168-
|> render_change(%{"filters" => %{"body" => "Elixir"}})
169-
170-
# Wait for Cinder to re-query
171-
html = render_async(view)
172-
173-
# Should show all posts again
174-
assert html =~ "First post about Elixir"
175-
end
176-
177-
@skip true
178-
test "clears all filters at once", %{conn: conn} do
179-
{view, _html} =
180-
live_and_wait(conn, "/api/admin?domain=Domain&resource=Post&action_type=read&action=read")
181-
182-
# Apply filter
183-
view
184-
|> element("form")
185-
|> render_change(%{"filters" => %{"body" => "Elixir"}})
186-
187-
# Wait for Cinder to re-query
188-
html = render_async(view)
189-
190-
# Should show all posts
191-
assert html =~ "First post about Elixir"
192-
end
193148
end
194149

195150
describe "filter interaction with sorting" do

test/support/resources/comment.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ defmodule AshAdmin.Test.Comment do
1919

2020
actions do
2121
default_accept(:*)
22-
defaults([:create, :read, :update, :destroy])
22+
defaults([:read, :update, :destroy])
2323

24-
create :create_with_photo do
24+
create :create do
25+
primary?(true)
2526
argument(:photo, :file)
2627
end
2728
end

0 commit comments

Comments
 (0)