Skip to content

Commit

Permalink
Make sure socket info components render properly
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Oct 28, 2020
1 parent e562c63 commit f87a450
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/phoenix/live_dashboard/info/socket_info_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Phoenix.LiveDashboard.SocketInfoComponent do
end

defp assign_info(%{assigns: assigns} = socket) do
case SystemInfo.fetch_socket_info(assigns.port, @info_keys) do
case SystemInfo.fetch_socket_info(assigns.port) do
{:ok, info} ->
Enum.reduce(info, socket, fn {key, val}, acc ->
assign(acc, key, format_info(key, val, assigns.path))
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix/live_dashboard/system_info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ defmodule Phoenix.LiveDashboard.SystemInfo do
:rpc.call(node, __MODULE__, :sockets_callback, [search, sort_by, sort_dir, limit])
end

def fetch_socket_info(port, keys) do
:rpc.call(node(port), __MODULE__, :socket_info_callback, [port, keys])
def fetch_socket_info(port) do
:rpc.call(node(port), __MODULE__, :socket_info_callback, [port])
end

def fetch_process_info(pid) do
Expand Down
6 changes: 3 additions & 3 deletions test/phoenix/live_dashboard/pages/sockets_page_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ defmodule Phoenix.LiveDashboard.SocketsPageTest do
{:ok, live, _} = live(build_conn(), socket_info_path(socket, 50, :send_oct, :asc))
rendered = render(live)
assert rendered =~ sockets_href(50, "", :send_oct, :asc)

assert rendered =~ "modal-content"
assert rendered =~ ~r/Local Address.*#{address}/s

refute live |> element("#modal .close") |> render_click() =~ "modal"
rendered = live |> element("#modal .close") |> render_click()
refute rendered =~ "modal"
return_path = sockets_path(50, "", :send_oct, :asc)
assert_patch(live, return_path)
end
Expand All @@ -93,7 +93,7 @@ defmodule Phoenix.LiveDashboard.SocketsPageTest do

defp socket_info_path(port, limit, sort_by, sort_dir) do
sockets_path(limit, "", sort_by, sort_dir) <>
"&info=#{Phoenix.LiveDashboard.Helpers.encode_port(port)}"
"&info=#{Phoenix.LiveDashboard.Helpers.encode_socket(port)}"
end

defp sockets_path(limit, search, sort_by, sort_dir) do
Expand Down

0 comments on commit f87a450

Please sign in to comment.