Current section
43 Versions
Jump to
Current section
43 Versions
Compare versions
7
files changed
+61
additions
-10
deletions
| @@ -1,5 +1,10 @@ | |
| 1 1 | # CHANGELOG |
| 2 2 | |
| 3 | + ## v0.6.0 (2021-10-21) |
| 4 | + |
| 5 | + * Require LiveView v0.17.1 |
| 6 | + * Add Ecto Stats for MySQL (and MariaDB) databases |
| 7 | + |
| 3 8 | ## v0.5.3 (2021-10-06) |
| 4 9 | |
| 5 10 | * Show OTP 24.1+ new sockets in tab |
unknowndist/css/app.css
File is too large to be displayed (100 KB limit).
unknowndist/js/app.js
File is too large to be displayed (100 KB limit).
| @@ -63,7 +63,7 @@ | |
| 63 63 | {<<"name">>,<<"phoenix_live_view">>}, |
| 64 64 | {<<"optional">>,false}, |
| 65 65 | {<<"repository">>,<<"hexpm">>}, |
| 66 | - {<<"requirement">>,<<"~> 0.16.0">>}], |
| 66 | + {<<"requirement">>,<<"~> 0.17.1">>}], |
| 67 67 | [{<<"app">>,<<"telemetry_metrics">>}, |
| 68 68 | {<<"name">>,<<"telemetry_metrics">>}, |
| 69 69 | {<<"optional">>,false}, |
| @@ -74,9 +74,14 @@ | |
| 74 74 | {<<"optional">>,true}, |
| 75 75 | {<<"repository">>,<<"hexpm">>}, |
| 76 76 | {<<"requirement">>,<<"~> 0.7">>}], |
| 77 | + [{<<"app">>,<<"ecto_mysql_extras">>}, |
| 78 | + {<<"name">>,<<"ecto_mysql_extras">>}, |
| 79 | + {<<"optional">>,true}, |
| 80 | + {<<"repository">>,<<"hexpm">>}, |
| 81 | + {<<"requirement">>,<<"~> 0.3">>}], |
| 77 82 | [{<<"app">>,<<"ecto">>}, |
| 78 83 | {<<"name">>,<<"ecto">>}, |
| 79 84 | {<<"optional">>,true}, |
| 80 85 | {<<"repository">>,<<"hexpm">>}, |
| 81 86 | {<<"requirement">>,<<"~> 3.6.2 or ~> 3.7">>}]]}. |
| 82 | - {<<"version">>,<<"0.5.3">>}. |
| 87 | + {<<"version">>,<<"0.6.0">>}. |
| @@ -8,11 +8,22 @@ defmodule Phoenix.LiveDashboard.EctoStatsPage do | |
| 8 8 | @page_title "Ecto Stats" |
| 9 9 | |
| 10 10 | @impl true |
| 11 | - def init(%{repos: repos, ecto_psql_extras_options: ecto_options}) do |
| 11 | + def init(%{ |
| 12 | + repos: repos, |
| 13 | + ecto_psql_extras_options: ecto_psql_extras_options, |
| 14 | + ecto_mysql_extras_options: ecto_mysql_extras_options |
| 15 | + }) do |
| 12 16 | capabilities = for repo <- List.wrap(repos), do: {:process, repo} |
| 13 17 | repos = repos || :auto_discover |
| 14 18 | |
| 15 | - {:ok, %{repos: repos, ecto_options: ecto_options}, capabilities} |
| 19 | + {:ok, |
| 20 | + %{ |
| 21 | + repos: repos, |
| 22 | + ecto_options: [ |
| 23 | + ecto_psql_extras_options: ecto_psql_extras_options, |
| 24 | + ecto_mysql_extras_options: ecto_mysql_extras_options |
| 25 | + ] |
| 26 | + }, capabilities} |
| 16 27 | end |
| 17 28 | |
| 18 29 | @impl true |
| @@ -108,6 +119,7 @@ defmodule Phoenix.LiveDashboard.EctoStatsPage do | |
| 108 119 | defp info_module_for(node, repo) do |
| 109 120 | case :rpc.call(node, repo, :__adapter__, []) do |
| 110 121 | Ecto.Adapters.Postgres -> EctoPSQLExtras |
| 122 | + Ecto.Adapters.MyXQL -> EctoMySQLExtras |
| 111 123 | _ -> nil |
| 112 124 | end |
| 113 125 | end |
| @@ -184,8 +196,15 @@ defmodule Phoenix.LiveDashboard.EctoStatsPage do | |
| 184 196 | defp sortable(_), do: :desc |
| 185 197 | |
| 186 198 | defp row_fetcher(repo, info_module, table_name, searchable, ecto_options, params, node) do |
| 199 | + ecto_db_extras_options = |
| 200 | + case info_module do |
| 201 | + EctoPSQLExtras -> Keyword.fetch!(ecto_options, :ecto_psql_extras_options) |
| 202 | + EctoMySQLExtras -> Keyword.fetch!(ecto_options, :ecto_mysql_extras_options) |
| 203 | + _ -> [] |
| 204 | + end |
| 205 | + |
| 187 206 | opts = |
| 188 | - case Keyword.fetch(ecto_options, table_name) do |
| 207 | + case Keyword.fetch(ecto_db_extras_options, table_name) do |
| 189 208 | {:ok, args} -> [args: args] |
| 190 209 | :error -> [] |
| 191 210 | end |
| @@ -259,8 +278,10 @@ defmodule Phoenix.LiveDashboard.EctoStatsPage do | |
| 259 278 | case assigns.error do |
| 260 279 | :no_ecto_repos_available -> |
| 261 280 | error_details = """ |
| 262 | - No Ecto repository was found running on this node or Ecto PSQL Extras is not installed. |
| 263 | - Currently only PSQL databases are supported. |
| 281 | + No Ecto repository was found running on this node. |
| 282 | + Currently only PSQL and MySQL databases are supported. |
| 283 | + |
| 284 | + Depending on the database Ecto PSQL Extras or Ecto MySQL Extras should be installed. |
| 264 285 | |
| 265 286 | Check the <a href="https://hexdocs.pm/phoenix_live_dashboard/ecto_stats.html" target="_blank">documentation</a> for details. |
| 266 287 | """ |
Loading more files…