Current section

43 Versions

Jump to

Compare versions

21 files changed
+186 additions
-57 deletions
  @@ -1,8 +1,15 @@
1 1 # CHANGELOG
2 2
3 + ## v0.2.3 (2020-05-15)
4 +
5 + * Allow the Dashboard to connect to nodes even if they are not running the Dashboard (or Phoenix)
6 + * Support hidden nodes
7 + * Allow some environment variables to be opted-in and shown in the Dashboard
8 + * Support latest `telemetry_metrics`
9 +
3 10 ## v0.2.2 (2020-05-05)
4 11
5 - * Improvements on the amount of data sent
12 + * Improvements on the amount of data sent between client/server
6 13 * Fix OS Data page on Windows
7 14
8 15 ## v0.2.1 (2020-04-29)
  @@ -63,10 +63,10 @@
63 63 {<<"name">>,<<"telemetry_metrics">>},
64 64 {<<"optional">>,false},
65 65 {<<"repository">>,<<"hexpm">>},
66 - {<<"requirement">>,<<"~> 0.4.0">>}],
66 + {<<"requirement">>,<<"~> 0.4.0 or ~> 0.5.0">>}],
67 67 [{<<"app">>,<<"phoenix_html">>},
68 68 {<<"name">>,<<"phoenix_html">>},
69 69 {<<"optional">>,false},
70 70 {<<"repository">>,<<"hexpm">>},
71 71 {<<"requirement">>,<<"~> 2.14.1 or ~> 2.15">>}]]}.
72 - {<<"version">>,<<"0.2.2">>}.
72 + {<<"version">>,<<"0.2.3">>}.
  @@ -18,16 +18,20 @@ defmodule Phoenix.LiveDashboard.LiveHelpers do
18 18 """
19 19 def assign_defaults(socket, params, session, refresher? \\ false) do
20 20 param_node = Map.fetch!(params, "node")
21 - found_node = Enum.find([node() | Node.list()], &(Atom.to_string(&1) == param_node))
21 + found_node = Enum.find(nodes(), &(Atom.to_string(&1) == param_node))
22 + target_node = found_node || node()
23 +
24 + capabilities = Phoenix.LiveDashboard.SystemInfo.ensure_loaded(target_node)
22 25
23 26 socket =
24 27 Phoenix.LiveView.assign(socket, :menu, %{
25 28 refresher?: refresher?,
26 29 action: socket.assigns.live_action,
27 - node: found_node || node(),
28 - metrics: session["metrics"],
29 - os_mon: Application.get_application(:os_mon),
30 - request_logger: session["request_logger"]
30 + node: target_node,
31 + metrics: capabilities.dashboard && session["metrics"],
32 + os_mon: capabilities.os_mon,
33 + request_logger: capabilities.dashboard && session["request_logger"],
34 + dashboard_running?: capabilities.dashboard
31 35 })
32 36
33 37 if found_node do
  @@ -36,4 +40,9 @@ defmodule Phoenix.LiveDashboard.LiveHelpers do
36 40 Phoenix.LiveView.push_redirect(socket, to: live_dashboard_path(socket, :home, node()))
37 41 end
38 42 end
43 +
44 + @doc """
45 + All connected nodes (including the current node).
46 + """
47 + def nodes(), do: [node()] ++ Node.list(:connected)
39 48 end
  @@ -4,6 +4,7 @@ defmodule Phoenix.LiveDashboard.ViewHelpers do
4 4
5 5 import Phoenix.LiveView.Helpers
6 6 @format_limit 100
7 + @format_path_regex ~r/^(?<beginning>((.+?\/){3})).*(?<ending>(\/.*){3})$/
7 8
8 9 @doc """
9 10 Encodes references for URLs.
  @@ -157,6 +158,19 @@ defmodule Phoenix.LiveDashboard.ViewHelpers do
157 158 def percentage(nil, _total, _rounds), do: 0
158 159 def percentage(value, total, rounds), do: Float.round(value / total * 100, rounds)
159 160
161 + @doc """
162 + Formats path.
163 + """
164 + def format_path(path) do
165 + path_string = to_string(path)
166 + Regex.named_captures(@format_path_regex, path_string)
167 + |> case do
168 + %{"beginning" => beginning, "ending" => ending} -> "#{beginning}...#{ending}"
169 + _ -> path_string
170 + end
171 +
172 + end
173 +
160 174 @doc """
161 175 Shows a hint.
162 176 """
  @@ -15,6 +15,6 @@ defmodule Phoenix.LiveDashboard.LayoutView do
15 15 def render("app.css", _), do: @app_css
16 16
17 17 def live_socket_path(conn) do
18 - [Enum.map(conn.script_name, &["/" | &1]) | "/live"]
18 + [Enum.map(conn.script_name, &["/" | &1]) | conn.private.live_socket_path]
19 19 end
20 20 end
Loading more files…