Skip to content

Commit

Permalink
Only show calls/outliers if enabled, closes phoenixframework#210
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Oct 24, 2020
1 parent f413222 commit 44e8e30
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion guides/ecto_stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ If you want to disable the "Ecto Stats" option altogether, set `ecto_repos: []`.

### Install custom extensions

Once the repository page is enabled, some of the queries (Calls and Outliers) require the [pg_stat_statements](https://www.postgresql.org/docs/current/pgstatstatements.html) extension installed. If you wish to access said functionality, you must install the extension first, otherwise an error will be shown.
Once the repository page is enabled, some of the queries (Calls and Outliers) require the [pg_stat_statements](https://www.postgresql.org/docs/current/pgstatstatements.html) extension installed. If you wish to access said functionality, you must install the extension first, otherwise said functionality won't be shown.
2 changes: 1 addition & 1 deletion lib/phoenix/live_dashboard/pages/ecto_stats_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Phoenix.LiveDashboard.EctoStatsPage do
@forbidden_tables [:kill_all, :mandelbrot]

defp items(%{repo: repo, info_module: info_module}) do
for {table_name, table_module} <- info_module.queries(),
for {table_name, table_module} <- info_module.queries(repo),
table_name not in @forbidden_tables do
{table_name,
name: Phoenix.Naming.humanize(table_name),
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ defmodule Phoenix.LiveDashboard.MixProject do
{:phoenix_live_view, "~> 0.14.3", phoenix_live_view_opts()},
{:telemetry_metrics, "~> 0.4.0 or ~> 0.5.0 or ~> 0.6.0"},
{:phoenix_html, "~> 2.14.1 or ~> 2.15"},
{:ecto_psql_extras, "~> 0.3.2 or ~> 0.4", optional: true},
{:ecto_psql_extras, "~> 0.4.1 or ~> 0.5", optional: true},

# Dev and test
{:circular_buffer, "~> 0.2", only: :dev},
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
"earmark": {:hex, :earmark, "1.4.9", "837e4c1c5302b3135e9955f2bbf52c6c52e950c383983942b68b03909356c0d9", [:mix], [{:earmark_parser, ">= 1.4.9", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "0d72df7d13a3dc8422882bed5263fdec5a773f56f7baeb02379361cb9e5b0d8e"},
"earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"},
"ecto": {:hex, :ecto, "3.5.2", "4e2c15b117a0e9918860cd1859bfa1791c587b78fca812bc8d373e0498d1f828", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fd92cfb1e300dd8093e7607158760f734147dc9cc4a60743573e0ec137a7df11"},
"ecto_psql_extras": {:hex, :ecto_psql_extras, "0.3.2", "9cff798788cdb7b3837fc3e417547fda5fd1722b2cf58cf0a6744aab952db4c1", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.15.7", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.0.0", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "1050c4950d16262adf504bfa20ea13912fb23c97c5e60fbcd7aefc119183b042"},
"ecto_sql": {:hex, :ecto_sql, "3.5.1", "7c03f302caa3c2bbc4f5397281a5d0d8653f246d47c353e3cd46750b16ad310c", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.5.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "338150ecb2398f013f98e4a70d5413b70fed4b6383d4f7c400314d315cdf87a9"},
"ecto": {:hex, :ecto, "3.5.3", "64aa70c6a64b8ee6a28ee186083b317b082beac8fed4d55bcc3f23199667a2f3", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c481b220bb080e94fd1ab528c3b62bdfdd29188c74aef44fc2b204efa8769532"},
"ecto_psql_extras": {:hex, :ecto_psql_extras, "0.4.1", "dda8d9cb3357921f94b7c6e46f5d4599d4eb6615647bfc2957783e92bc106389", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.15.7", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.0.0", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "e99dd90d6007391a069b83ec78ada61b0296e273a3d3d3a5fb5318f5bf1689a5"},
"ecto_sql": {:hex, :ecto_sql, "3.5.2", "45502b7deb987b46f0d3714e694e07de2a41c06b2fcb7597dc40caf7d2fb5544", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.5.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "aaa3ea1a514b4364a95be4bdb4b2ece41dccb6293159da47dceb3a208e97d196"},
"ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"},
"file_system": {:hex, :file_system, "0.2.8", "f632bd287927a1eed2b718f22af727c5aeaccc9a98d8c2bd7bff709e851dc986", [:mix], [], "hexpm", "97a3b6f8d63ef53bd0113070102db2ce05352ecf0d25390eb8d747c2bde98bca"},
"floki": {:hex, :floki, "0.27.0", "6b29a14283f1e2e8fad824bc930eaa9477c462022075df6bea8f0ad811c13599", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "583b8c13697c37179f1f82443bcc7ad2f76fbc0bf4c186606eebd658f7f2631b"},
Expand Down
4 changes: 2 additions & 2 deletions test/phoenix/live_dashboard/pages/ecto_stats_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ defmodule Phoenix.LiveDashboard.EctoStatsPageTest do
assert rendered =~ "Granted"
end

@forbidden_navs [:calls, :outliers, :kill_all, :mandelbrot]
@forbidden_navs [:kill_all, :mandelbrot]

test "navs" do
for {nav, _} <- EctoPSQLExtras.queries(), nav not in @forbidden_navs do
for {nav, _} <- EctoPSQLExtras.queries(Repo), nav not in @forbidden_navs do
{:ok, _, _} = live(build_conn(), ecto_stats_path(nav))
end
end
Expand Down

0 comments on commit 44e8e30

Please sign in to comment.