Split explorer_web from explorer OTP app

Co-authored-by: Alex Garibay <alex.garibay@dockyard.com>
pull/86/head
Luke Imhoff 7 years ago
parent 526eb526ac
commit d6b00db768
  1. 9
      .gitignore
  2. 8
      README.md
  3. 36
      apps/explorer/README.md
  4. 27
      apps/explorer/config/config.exs
  5. 54
      apps/explorer/config/dev.exs
  6. 4
      apps/explorer/config/dev.secret.exs.example
  7. 39
      apps/explorer/config/prod.exs
  8. 15
      apps/explorer/config/test.exs
  9. 9
      apps/explorer/lib/explorer/application.ex
  10. 35
      apps/explorer/mix.exs
  11. 3
      apps/explorer/test/test_helper.exs
  12. 48
      apps/explorer_web/README.md
  13. 0
      apps/explorer_web/assets/.eslintrc
  14. 0
      apps/explorer_web/assets/brunch-config.js
  15. 0
      apps/explorer_web/assets/css/app.scss
  16. 0
      apps/explorer_web/assets/css/components/_address.scss
  17. 0
      apps/explorer_web/assets/css/components/_all.scss
  18. 0
      apps/explorer_web/assets/css/components/_block.scss
  19. 0
      apps/explorer_web/assets/css/components/_blocks.scss
  20. 0
      apps/explorer_web/assets/css/components/_chain.scss
  21. 0
      apps/explorer_web/assets/css/components/_container.scss
  22. 0
      apps/explorer_web/assets/css/components/_dot.scss
  23. 0
      apps/explorer_web/assets/css/components/_footer.scss
  24. 0
      apps/explorer_web/assets/css/components/_header.scss
  25. 0
      apps/explorer_web/assets/css/components/_internal_transaction.scss
  26. 0
      apps/explorer_web/assets/css/components/_pagination.scss
  27. 0
      apps/explorer_web/assets/css/components/_section.scss
  28. 0
      apps/explorer_web/assets/css/components/_transaction.scss
  29. 0
      apps/explorer_web/assets/css/components/_transaction_log.scss
  30. 0
      apps/explorer_web/assets/css/components/_transactions.scss
  31. 0
      apps/explorer_web/assets/css/explorer/_all.scss
  32. 0
      apps/explorer_web/assets/css/explorer/_breakpoints.scss
  33. 0
      apps/explorer_web/assets/css/explorer/_color.scss
  34. 0
      apps/explorer_web/assets/css/explorer/_header.scss
  35. 0
      apps/explorer_web/assets/css/explorer/_open_sans.scss
  36. 0
      apps/explorer_web/assets/css/explorer/_paper.scss
  37. 0
      apps/explorer_web/assets/css/explorer/_size.scss
  38. 0
      apps/explorer_web/assets/css/explorer/_table.scss
  39. 0
      apps/explorer_web/assets/css/explorer/_typography.scss
  40. 0
      apps/explorer_web/assets/js/app.js
  41. 0
      apps/explorer_web/assets/js/lib/block_subscription.js
  42. 0
      apps/explorer_web/assets/js/lib/react_phoenix.js
  43. 0
      apps/explorer_web/assets/js/socket.js
  44. 4
      apps/explorer_web/assets/package-lock.json
  45. 4
      apps/explorer_web/assets/package.json
  46. 0
      apps/explorer_web/assets/spec/lib/block_subscription_spec.js
  47. 0
      apps/explorer_web/assets/spec/spec_helper.js
  48. 0
      apps/explorer_web/assets/spec/support/jasmine.scss
  49. 0
      apps/explorer_web/assets/static/favicon.ico
  50. 0
      apps/explorer_web/assets/static/images/average_time.svg
  51. 0
      apps/explorer_web/assets/static/images/block.svg
  52. 0
      apps/explorer_web/assets/static/images/blocks.svg
  53. 0
      apps/explorer_web/assets/static/images/last_block.svg
  54. 0
      apps/explorer_web/assets/static/images/logo.svg
  55. 0
      apps/explorer_web/assets/static/images/mgi.svg
  56. 0
      apps/explorer_web/assets/static/images/transaction.svg
  57. 0
      apps/explorer_web/assets/static/images/transactions.svg
  58. 0
      apps/explorer_web/assets/static/robots.txt
  59. 4
      apps/explorer_web/assets/yarn.lock
  60. 31
      apps/explorer_web/config/config.exs
  61. 54
      apps/explorer_web/config/dev.exs
  62. 5
      apps/explorer_web/config/dev.secret.exs.example
  63. 31
      apps/explorer_web/config/prod.exs
  64. 13
      apps/explorer_web/config/test.exs
  65. 0
      apps/explorer_web/lib/explorer_web.ex
  66. 33
      apps/explorer_web/lib/explorer_web/application.ex
  67. 0
      apps/explorer_web/lib/explorer_web/channels/user_socket.ex
  68. 0
      apps/explorer_web/lib/explorer_web/controllers/address_controller.ex
  69. 0
      apps/explorer_web/lib/explorer_web/controllers/address_transaction_from_controller.ex
  70. 0
      apps/explorer_web/lib/explorer_web/controllers/address_transaction_to_controller.ex
  71. 0
      apps/explorer_web/lib/explorer_web/controllers/block_controller.ex
  72. 0
      apps/explorer_web/lib/explorer_web/controllers/block_transaction_controller.ex
  73. 0
      apps/explorer_web/lib/explorer_web/controllers/chain_controller.ex
  74. 0
      apps/explorer_web/lib/explorer_web/controllers/internal_transaction_controller.ex
  75. 0
      apps/explorer_web/lib/explorer_web/controllers/pending_transaction_controller.ex
  76. 0
      apps/explorer_web/lib/explorer_web/controllers/transaction_controller.ex
  77. 0
      apps/explorer_web/lib/explorer_web/controllers/transaction_log_controller.ex
  78. 8
      apps/explorer_web/lib/explorer_web/endpoint.ex
  79. 0
      apps/explorer_web/lib/explorer_web/forms/block_form.ex
  80. 0
      apps/explorer_web/lib/explorer_web/forms/pending_transaction_form.ex
  81. 0
      apps/explorer_web/lib/explorer_web/forms/transaction_form.ex
  82. 2
      apps/explorer_web/lib/explorer_web/gettext.ex
  83. 0
      apps/explorer_web/lib/explorer_web/router.ex
  84. 0
      apps/explorer_web/lib/explorer_web/templates/address/show.html.eex
  85. 0
      apps/explorer_web/lib/explorer_web/templates/address_transaction_from/index.html.eex
  86. 0
      apps/explorer_web/lib/explorer_web/templates/address_transaction_to/index.html.eex
  87. 0
      apps/explorer_web/lib/explorer_web/templates/block/index.html.eex
  88. 0
      apps/explorer_web/lib/explorer_web/templates/block/show.html.eex
  89. 0
      apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex
  90. 0
      apps/explorer_web/lib/explorer_web/templates/chain/show.html.eex
  91. 0
      apps/explorer_web/lib/explorer_web/templates/internal_transaction/index.html.eex
  92. 0
      apps/explorer_web/lib/explorer_web/templates/layout/_footer.html.eex
  93. 0
      apps/explorer_web/lib/explorer_web/templates/layout/_header.html.eex
  94. 0
      apps/explorer_web/lib/explorer_web/templates/layout/app.html.eex
  95. 0
      apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex
  96. 0
      apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex
  97. 0
      apps/explorer_web/lib/explorer_web/templates/transaction/show.html.eex
  98. 0
      apps/explorer_web/lib/explorer_web/templates/transaction_log/index.html.eex
  99. 0
      apps/explorer_web/lib/explorer_web/views/address_transaction_from_view.ex
  100. 0
      apps/explorer_web/lib/explorer_web/views/address_transaction_to_view.ex
  101. Some files were not shown because too many files have changed in this diff Show More

9
.gitignore vendored

@ -10,13 +10,16 @@ erl_crash.dump
# Generated on crash by NPM # Generated on crash by NPM
npm-debug.log npm-debug.log
# Generated on crash by Yarn
yarn-error.log
# Static artifacts # Static artifacts
/assets/node_modules /apps/explorer_web/assets/node_modules
# Since we are building assets from assets/, # Since we are building assets from assets/,
# we ignore priv/static. You may want to comment # we ignore priv/static. You may want to comment
# this depending on your deployment strategy. # this depending on your deployment strategy.
/priv/static/ /apps/*/priv/static/
# Files matching config/*.secret.exs pattern contain sensitive # Files matching config/*.secret.exs pattern contain sensitive
# data and you should not commit them into version control. # data and you should not commit them into version control.
@ -24,7 +27,7 @@ npm-debug.log
# Alternatively, you may comment the line below and commit the # Alternatively, you may comment the line below and commit the
# secrets files as long as you replace their contents by environment # secrets files as long as you replace their contents by environment
# variables. # variables.
/apps/explorer/config/*.secret.exs /apps/*/config/*.secret.exs
# Wallaby screenshots # Wallaby screenshots
screenshots/ screenshots/

@ -25,7 +25,7 @@ To get POA Explorer up and running locally:
* Set up some default configuration with: `$ cp config/dev.secret.exs.example config/dev.secret.esx` * Set up some default configuration with: `$ cp config/dev.secret.exs.example config/dev.secret.esx`
* Install dependencies with `$ mix do deps.get, local.rebar, deps.compile, compile` * Install dependencies with `$ mix do deps.get, local.rebar, deps.compile, compile`
* Create and migrate your database with `$ mix ecto.create && mix ecto.migrate` * Create and migrate your database with `$ mix ecto.create && mix ecto.migrate`
* Install Node.js dependencies with `$ cd assets && npm install && cd ..` * Install Node.js dependencies with `$ cd apps/explorer_web/assets && npm install && cd -`
* Start Phoenix with `$ mix phx.server` * Start Phoenix with `$ mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
@ -38,20 +38,20 @@ Configure your local CCMenu with the following url: [`https://circleci.com/gh/po
### Testing ### Testing
* Build the assets: `$ cd assets && yarn build` * Build the assets: `$ cd apps/explorer_web/assets && yarn build && cd -`
* Format the Elixir code: `$ mix format` * Format the Elixir code: `$ mix format`
* Run the test suite: `$ mix test` * Run the test suite: `$ mix test`
* Lint the Elixir code: `$ mix credo --strict` * Lint the Elixir code: `$ mix credo --strict`
* Run the dialyzer: `mix dialyzer --halt-exit-status` * Run the dialyzer: `mix dialyzer --halt-exit-status`
* Check the Elixir code for vulnerabilities: `$ mix sobelow --config` * Check the Elixir code for vulnerabilities: `$ mix sobelow --config`
* Lint the JavaScript code: `$ cd assets && yarn eslint` * Lint the JavaScript code: `$ cd apps/explorer_web/assets && yarn eslint && cd -`
## Internationalization ## Internationalization
The app is currently internationalized. It is only localized to U.S. English. The app is currently internationalized. It is only localized to U.S. English.
To translate new strings, run `$ mix gettext.extract --merge` and edit the new strings in `priv/gettext/en/LC_MESSAGES/default.po`. To translate new strings, run `$ cd apps/explorer_web; mix gettext.extract --merge` and edit the new strings in `apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po`.
## Contributing ## Contributing

@ -0,0 +1,36 @@
# POA Explorer
This is a tool for inspecting and analyzing the POA Network blockchain.
## Machine Requirements
* Erlang/OTP 20.2+
* Elixir 1.5+
* Postgres 10.0
## Required Accounts
* Heroku for deployment
* Github for code storage
## Setup Instructions
### Development
To get POA Explorer up and running locally:
* Set up some default configuration with: `$ cp config/dev.secret.exs.example config/dev.secret.esx`
* Install dependencies with `$ mix do deps.get, local.rebar, deps.compile, compile`
* Create and migrate your database with `$ mix ecto.create && mix ecto.migrate`
* Run IEx (Interactive Elixir) to access the index and explore: `$ iex -S mix`
### Testing
* Format the Elixir code: `$ mix format`
* Run the test suite: `$ mix test`
* Lint the Elixir code: `$ mix credo --strict`
* Run the dialyzer: `mix dialyzer --halt-exit-status`
* Check the Elixir code for vulnerabilities: `$ mix sobelow --config`

@ -5,34 +5,15 @@
# is restricted to this project. # is restricted to this project.
use Mix.Config use Mix.Config
config :ethereumex, url: "http://localhost:8545"
# General application configuration # General application configuration
config :explorer, ecto_repos: [Explorer.Repo] config :explorer, ecto_repos: [Explorer.Repo]
# Configures gettext config :explorer, :ethereum, backend: Explorer.Ethereum.Live
config :explorer, ExplorerWeb.Gettext, locales: ~w(en), default_locale: "en"
# Configures the endpoint
config :explorer, ExplorerWeb.Endpoint,
url: [host: "localhost"],
render_errors: [view: ExplorerWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: Explorer.PubSub, adapter: Phoenix.PubSub.PG2]
config :explorer, Explorer.Integrations.EctoLogger, query_time_ms_threshold: 2_000 config :explorer, Explorer.Integrations.EctoLogger, query_time_ms_threshold: 2_000
# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
config :ethereumex, url: "http://localhost:8545"
config :new_relixir, active: false
config :ex_cldr,
default_locale: "en",
locales: ["en"],
gettext: ExplorerWeb.Gettext
config :exq, config :exq,
host: "localhost", host: "localhost",
port: 6379, port: 6379,
@ -50,8 +31,6 @@ config :exq,
{"receipts", 1} {"receipts", 1}
] ]
config :explorer, :ethereum, backend: Explorer.Ethereum.Live
config :exq_ui, server: false config :exq_ui, server: false
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom

@ -1,59 +1,5 @@
use Mix.Config use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :explorer, ExplorerWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/brunch/bin/brunch",
"watch",
"--stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# command from your terminal:
#
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout priv/server.key -out priv/server.pem
#
# The `http:` config above can be replaced with:
#
# https: [port: 4000, keyfile: "priv/server.key", certfile: "priv/server.pem"],
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.
# Watch static and templates for browser reloading.
config :explorer, ExplorerWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{lib/explorer_web/views/.*(ex)$},
~r{lib/explorer_web/templates/.*(eex)$}
]
]
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
# Configure your database # Configure your database
config :explorer, Explorer.Repo, config :explorer, Explorer.Repo,
adapter: Ecto.Adapters.Postgres, adapter: Ecto.Adapters.Postgres,

@ -3,7 +3,3 @@ use Mix.Config
# Configure ethereumex # Configure ethereumex
config :ethereumex, config :ethereumex,
url: "http://localhost:8545" url: "http://localhost:8545"
# Configures the endpoint
config :explorer, ExplorerWeb.Endpoint,
secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5"

@ -1,38 +1,5 @@
use Mix.Config use Mix.Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# ExplorerWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don't forget to configure the url host to something meaningful,
# Phoenix uses this information when generating URLs.
#
# Finally, we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the mix phx.digest task
# which you typically run after static files are built.
config :explorer, ExplorerWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json",
force_ssl: [rewrite_on: [:x_forwarded_proto]],
instrumenters: [NewRelixir.Instrumenters.Phoenix],
load_from_system_env: true,
pubsub: [
adapter: Phoenix.PubSub.Redis,
url: System.get_env("REDIS_URL"),
node_name: System.get_env("DYNO")
],
secret_key_base: System.get_env("SECRET_KEY_BASE"),
url: [
scheme: "https",
host: Map.fetch!(System.get_env(), "HEROKU_APP_NAME") <> ".herokuapp.com",
port: 443
]
# Do not print debug messages in production
config :logger, level: :info
# Configures the database # Configures the database
config :explorer, Explorer.Repo, config :explorer, Explorer.Repo,
adapter: Ecto.Adapters.Postgres, adapter: Ecto.Adapters.Postgres,
@ -43,12 +10,6 @@ config :explorer, Explorer.Repo,
timeout: 60_000, timeout: 60_000,
pool_timeout: 60_000 pool_timeout: 60_000
# Configure New Relic
config :new_relixir,
application_name: System.get_env("NEW_RELIC_APP_NAME"),
license_key: System.get_env("NEW_RELIC_LICENSE_KEY"),
active: true
# Configure Web3 # Configure Web3
config :ethereumex, url: System.get_env("ETHEREUM_URL") config :ethereumex, url: System.get_env("ETHEREUM_URL")

@ -1,17 +1,5 @@
use Mix.Config use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :explorer, ExplorerWeb.Endpoint,
http: [port: 4001],
secret_key_base: "27Swe6KtEtmN37WyEYRjKWyxYULNtrxlkCEKur4qoV+Lwtk8lafsR16ifz1XBBYj",
server: true
config :explorer, :sql_sandbox, true
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database # Configure your database
config :explorer, Explorer.Repo, config :explorer, Explorer.Repo,
adapter: Ecto.Adapters.Postgres, adapter: Ecto.Adapters.Postgres,
@ -20,9 +8,6 @@ config :explorer, Explorer.Repo,
pool: Ecto.Adapters.SQL.Sandbox, pool: Ecto.Adapters.SQL.Sandbox,
ownership_timeout: 60_000 ownership_timeout: 60_000
# Configure wallaby
config :wallaby, screenshot_on_failure: true
# Configure ethereumex # Configure ethereumex
config :ethereumex, url: "https://sokol-trace.poa.network" config :ethereumex, url: "https://sokol-trace.poa.network"

@ -14,14 +14,6 @@ defmodule Explorer.Application do
Supervisor.start_link(children(Mix.env()), opts) Supervisor.start_link(children(Mix.env()), opts)
end end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
alias ExplorerWeb.Endpoint
Endpoint.config_change(changed, removed)
:ok
end
defp children(:test), do: children() defp children(:test), do: children()
defp children(_) do defp children(_) do
@ -40,7 +32,6 @@ defmodule Explorer.Application do
[ [
supervisor(Explorer.Repo, []), supervisor(Explorer.Repo, []),
supervisor(ExplorerWeb.Endpoint, [])
] ]
end end
end end

@ -7,7 +7,6 @@ defmodule Explorer.Mixfile do
app: :explorer, app: :explorer,
build_path: "../../_build", build_path: "../../_build",
config_path: "../../config/config.exs", config_path: "../../config/config.exs",
compilers: [:phoenix, :gettext | Mix.compilers()],
deps: deps(), deps: deps(),
deps_path: "../../deps", deps_path: "../../deps",
dialyzer: [ dialyzer: [
@ -17,7 +16,7 @@ defmodule Explorer.Mixfile do
], ],
elixir: "~> 1.4", elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
lock_file: "../../mix.lock", lockfile: "../../mix.lock",
package: package(), package: package(),
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,
version: "0.0.1" version: "0.0.1"
@ -48,18 +47,15 @@ defmodule Explorer.Mixfile do
defp extra_applications, defp extra_applications,
do: [ do: [
:scrivener_ecto,
:scrivener_html,
:ex_cldr,
:ex_jasmine,
:ethereumex,
:timex,
:timex_ecto,
:crontab, :crontab,
:set_locale, :ethereumex,
:logger, :logger,
:mix,
:new_relixir,
:runtime_tools, :runtime_tools,
:new_relixir :scrivener_ecto,
:timex,
:timex_ecto
] ]
# Specifies your project dependencies. # Specifies your project dependencies.
@ -67,42 +63,27 @@ defmodule Explorer.Mixfile do
# Type `mix help deps` for examples and options. # Type `mix help deps` for examples and options.
defp deps do defp deps do
[ [
{:cowboy, "~> 1.0"},
{:credo, "~> 0.8", only: [:dev, :test], runtime: false}, {:credo, "~> 0.8", only: [:dev, :test], runtime: false},
{:crontab, "~> 1.1"}, {:crontab, "~> 1.1"},
{:dialyxir, "~> 0.5", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 0.5", only: [:dev, :test], runtime: false},
{:ethereumex, "~> 0.3"}, {:ethereumex, "~> 0.3"},
{:ex_cldr_numbers, "~> 1.0"},
{:ex_cldr_units, "~> 1.0"},
{:ex_jasmine, github: "minifast/ex_jasmine", branch: "master"},
{:ex_machina, "~> 2.1", only: [:test]}, {:ex_machina, "~> 2.1", only: [:test]},
{:exq, "~> 0.9.1"}, {:exq, "~> 0.9.1"},
{:exq_ui, "~> 0.9.0"}, {:exq_ui, "~> 0.9.0"},
{:exvcr, "~> 0.10", only: :test}, {:exvcr, "~> 0.10", only: :test},
{:flow, "~> 0.12"}, {:flow, "~> 0.12"},
{:gettext, "~> 0.11"},
{:httpoison, "~> 1.0", override: true}, {:httpoison, "~> 1.0", override: true},
{:junit_formatter, ">= 0.0.0", only: [:test], runtime: false}, {:junit_formatter, ">= 0.0.0", only: [:test], runtime: false},
{:math, "~> 0.3.0"}, {:math, "~> 0.3.0"},
{:mock, "~> 0.3.0", only: [:test], runtime: false}, {:mock, "~> 0.3.0", only: [:test], runtime: false},
{:new_relixir, "~> 0.4"}, {:new_relixir, "~> 0.4"},
{:phoenix, "~> 1.3.0"},
{:phoenix_ecto, "~> 3.2"},
{:phoenix_html, "~> 2.10"},
{:phoenix_live_reload, "~> 1.0", only: [:dev]},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_pubsub_redis, "~> 2.1.0", only: [:prod]},
{:postgrex, ">= 0.0.0"}, {:postgrex, ">= 0.0.0"},
{:quantum, "~> 2.2.1"}, {:quantum, "~> 2.2.1"},
{:react_phoenix, "~> 0.5"},
{:scrivener_ecto, "~> 1.0"}, {:scrivener_ecto, "~> 1.0"},
{:scrivener_html, "~> 1.7"}, {:scrivener_html, "~> 1.7"},
# Waiting on https://github.com/smeevil/set_locale/pull/9
{:set_locale, github: "minifast/set_locale", branch: "master"},
{:sobelow, ">= 0.0.0", only: [:dev, :test], runtime: false}, {:sobelow, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:timex, "~> 3.1.24"}, {:timex, "~> 3.1.24"},
{:timex_ecto, "~> 3.2.1"}, {:timex_ecto, "~> 3.2.1"}
{:wallaby, "~> 0.19.2", only: [:test], runtime: false}
] ]
end end

@ -1,9 +1,6 @@
ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter])
ExUnit.start() ExUnit.start()
{:ok, _} = Application.ensure_all_started(:wallaby)
Application.put_env(:wallaby, :base_url, ExplorerWeb.Endpoint.url())
{:ok, _} = Application.ensure_all_started(:ex_machina) {:ok, _} = Application.ensure_all_started(:ex_machina)
Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual) Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual)

@ -0,0 +1,48 @@
# POA Explorer Web
This is a tool for inspecting and analyzing the POA Network blockchain from a web browser.
## Machine Requirements
* Erlang/OTP 20.2+
* Elixir 1.5+
* Postgres 10.0
## Required Accounts
* Heroku for deployment
* Github for code storage
## Setup Instructions
### Development
To get POA Explorer Web interface up and running locally:
* Setup `../explorer`
* Set up some default configuration with: `$ cp config/dev.secret.exs.example config/dev.secret.esx`
* Install Node.js dependencies with `$ cd assets && npm install && cd ..`
* Start Phoenix with `$ mix phx.server` (This can be run from this directory or the project root: the project root is recommended.)
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
You can also run IEx (Interactive Elixir): `$ iex -S mix phx.server` (This can be run from this directory or the project root: the project root is recommended.)
### Testing
* Build the assets: `$ cd assets && yarn build`
* Format the Elixir code: `$ mix format`
* Run the test suite: `$ mix test`
* Lint the Elixir code: `$ mix credo --strict`
* Run the dialyzer: `mix dialyzer --halt-exit-status`
* Check the Elixir code for vulnerabilities: `$ mix sobelow --config`
* Lint the JavaScript code: `$ cd assets && yarn eslint`
## Internationalization
The app is currently internationalized. It is only localized to U.S. English.
To translate new strings, run `$ mix gettext.extract --merge` and edit the new strings in `priv/gettext/en/LC_MESSAGES/default.po`.

@ -5008,10 +5008,10 @@
} }
}, },
"phoenix": { "phoenix": {
"version": "file:../deps/phoenix" "version": "file:../../../deps/phoenix"
}, },
"phoenix_html": { "phoenix_html": {
"version": "file:../deps/phoenix_html" "version": "file:../../../deps/phoenix_html"
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",

@ -25,8 +25,8 @@
"brunch": "2.10.9", "brunch": "2.10.9",
"clean-css-brunch": "2.10.0", "clean-css-brunch": "2.10.0",
"normalize-scss": "^7.0.0", "normalize-scss": "^7.0.0",
"phoenix": "file:../deps/phoenix", "phoenix": "file:../../../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html", "phoenix_html": "file:../../../deps/phoenix_html",
"react": "^16.2.0", "react": "^16.2.0",
"react-dom": "^16.2.0", "react-dom": "^16.2.0",
"sass-brunch": "github:brunch/sass-brunch#7ffb2e6ebb7380f920a2f594476a3db0654b11b9", "sass-brunch": "github:brunch/sass-brunch#7ffb2e6ebb7380f920a2f594476a3db0654b11b9",

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 935 B

After

Width:  |  Height:  |  Size: 935 B

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

@ -3329,10 +3329,10 @@ performance-now@^2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
"phoenix@file:../deps/phoenix": "phoenix@file:../../../deps/phoenix":
version "1.3.0" version "1.3.0"
"phoenix_html@file:../deps/phoenix_html": "phoenix_html@file:../../../deps/phoenix_html":
version "2.10.5" version "2.10.5"
pify@^2.0.0: pify@^2.0.0:

@ -0,0 +1,31 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# General application configuration
config :explorer_web,
namespace: ExplorerWeb,
ecto_repos: [Explorer.Repo]
# Configures gettext
config :explorer_web, ExplorerWeb.Gettext, locales: ~w(en), default_locale: "en"
# Configures the endpoint
config :explorer_web, ExplorerWeb.Endpoint,
url: [host: "localhost"],
render_errors: [view: ExplorerWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: ExplorerWeb.PubSub, adapter: Phoenix.PubSub.PG2]
config :ex_cldr,
default_locale: "en",
locales: ["en"],
gettext: ExplorerWeb.Gettext
config :exq_ui, server: false
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"

@ -0,0 +1,54 @@
use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :explorer_web, ExplorerWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/brunch/bin/brunch",
"watch",
"--stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# command from your terminal:
#
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout priv/server.key -out priv/server.pem
#
# The `http:` config above can be replaced with:
#
# https: [port: 4000, keyfile: "priv/server.key", certfile: "priv/server.pem"],
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.
# Watch static and templates for browser reloading.
config :explorer_web, ExplorerWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{lib/explorer_web/views/.*(ex)$},
~r{lib/explorer_web/templates/.*(eex)$}
]
]
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
import_config "dev.secret.exs"

@ -0,0 +1,5 @@
use Mix.Config
# Configures the endpoint
config :explorer_web, ExplorerWeb.Endpoint,
secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5"

@ -0,0 +1,31 @@
use Mix.Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# ExplorerWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don't forget to configure the url host to something meaningful,
# Phoenix uses this information when generating URLs.
#
# Finally, we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the mix phx.digest task
# which you typically run after static files are built.
config :explorer_web, ExplorerWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json",
force_ssl: [rewrite_on: [:x_forwarded_proto]],
instrumenters: [NewRelixir.Instrumenters.Phoenix],
load_from_system_env: true,
pubsub: [
adapter: Phoenix.PubSub.Redis,
url: System.get_env("REDIS_URL"),
node_name: System.get_env("DYNO")
],
secret_key_base: System.get_env("SECRET_KEY_BASE"),
url: [
scheme: "https",
host: Map.fetch!(System.get_env(), "HEROKU_APP_NAME") <> ".herokuapp.com",
port: 443
]

@ -0,0 +1,13 @@
use Mix.Config
config :explorer_web, :sql_sandbox, true
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :explorer_web, ExplorerWeb.Endpoint,
http: [port: 4001],
secret_key_base: "27Swe6KtEtmN37WyEYRjKWyxYULNtrxlkCEKur4qoV+Lwtk8lafsR16ifz1XBBYj",
server: true
# Configure wallaby
config :wallaby, screenshot_on_failure: true

@ -0,0 +1,33 @@
defmodule ExplorerWeb.Application do
@moduledoc """
Supervises `ExplorerWeb.Endpoint` in order to serve Web UI.
"""
use Application
alias ExplorerWeb.Endpoint
def start(_type, _args) do
import Supervisor.Spec
# Define workers and child supervisors to be supervised
children = [
# Start the endpoint when the application starts
supervisor(Endpoint, []),
# Start your own worker by calling: PoaexpWeb.Worker.start_link(arg1, arg2, arg3)
# worker(PoaexpWeb.Worker, [arg1, arg2, arg3]),
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: ExplorerWeb.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
Endpoint.config_change(changed, removed)
:ok
end
end

@ -1,8 +1,8 @@
defmodule ExplorerWeb.Endpoint do defmodule ExplorerWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :explorer use Phoenix.Endpoint, otp_app: :explorer_web
if Application.get_env(:explorer, :sql_sandbox) do if Application.get_env(:explorer_web, :sql_sandbox) do
plug(Phoenix.Ecto.SQL.Sandbox) plug(Phoenix.Ecto.SQL.Sandbox, repo: Explorer.Repo)
end end
socket("/socket", ExplorerWeb.UserSocket) socket("/socket", ExplorerWeb.UserSocket)
@ -14,7 +14,7 @@ defmodule ExplorerWeb.Endpoint do
plug( plug(
Plug.Static, Plug.Static,
at: "/", at: "/",
from: :explorer, from: :explorer_web,
gzip: false, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt) only: ~w(css fonts images js favicon.ico robots.txt)
) )

@ -20,7 +20,7 @@ defmodule ExplorerWeb.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
""" """
use Gettext, otp_app: :explorer use Gettext, otp_app: :explorer_web
@dialyzer [ @dialyzer [
{:nowarn_function, "MACRO-dgettext": 3}, {:nowarn_function, "MACRO-dgettext": 3},

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save