status-go/vendor/github.com/ethereum/go-ethereum/dashboard
Pedro Pombeiro e4cbce12c4
Update to go-ethereum 1.8.1 (#702)
* Update `github.com/ethereum/go-ethereum` package to 1.8.1 branch. Part of #638
* Fix code due to some signature changes. Part of #638
* use upstream for whisper backend
* Add patch to downgrade usage of Whisper v6 to v5 in some geth 1.8.1 vendor files. Part of #638
* Take into account the DNS rebinding protection introduced in 1.8.0 by adding exception for localhost. Part of #638
* Add patches required for cross-compiled builds starting with geth 1.8.0. Only applied during build. Part of #638
* Update expected JSON result in `TestRegressionGetTransactionReceipt()` and `TestCallRawResultGetTransactionReceipt()`. Part of #665
* Fix some failing e2e tests. Part of #638
* Address comments in PR #702. Part of #638
2018-02-27 11:39:30 +01:00
..
assets Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
README.md Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
assets.go Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
config.go Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
cpu.go Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
cpu_windows.go Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
dashboard.go Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00
message.go Update to go-ethereum 1.8.1 (#702) 2018-02-27 11:39:30 +01:00

README.md

Go Ethereum Dashboard

The dashboard is a data visualizer integrated into geth, intended to collect and visualize useful information of an Ethereum node. It consists of two parts:

  • The client visualizes the collected data.
  • The server collects the data, and updates the clients.

The client's UI uses React with JSX syntax, which is validated by the ESLint linter mostly according to the Airbnb React/JSX Style Guide. The style is defined in the .eslintrc configuration file. The resources are bundled into a single bundle.js file using Webpack, which relies on the webpack.config.js. The bundled file is referenced from dashboard.html and takes part in the assets.go too. The necessary dependencies for the module bundler are gathered by Node.js.

Development and bundling

As the dashboard depends on certain NPM packages (which are not included in the go-ethereum repo), these need to be installed first:

$ (cd dashboard/assets && npm install)
$ (cd dashboard/assets && ./node_modules/.bin/flow-typed install)

Normally the dashboard assets are bundled into Geth via go-bindata to avoid external dependencies. Rebuilding Geth after each UI modification however is not feasible from a developer perspective. Instead, we can run webpack in watch mode to automatically rebundle the UI, and ask geth to use external assets to not rely on compiled resources:

$ (cd dashboard/assets && ./node_modules/.bin/webpack --watch)
$ geth --dashboard --dashboard.assets=dashboard/assets --vmodule=dashboard=5

To bundle up the final UI into Geth, run go generate:

$ go generate ./dashboard

Static type checking

Since JavaScript doesn't provide type safety, Flow is used to check types. These are only useful during development, so at the end of the process Babel will strip them.

To take advantage of static type checking, your IDE needs to be prepared for it. In case of Atom a configuration guide can be found here: Install the Nuclide package for Flow support, making sure it installs all of its support packages by enabling Install Recommended Packages on Startup, and set the path of the flow-bin which were installed previously by npm.

For more IDE support install the linter-eslint package too, which finds the .eslintrc file, and provides real-time linting. Atom warns, that these two packages are incompatible, but they seem to work well together. For third-party library errors and auto-completion flow-typed is used.

Have fun

Webpack offers handy tools for visualizing the bundle's dependency tree and space usage.

  • Generate the bundle's profile running webpack --profile --json > stats.json
  • For the dependency tree go to Webpack Analyze, and import stats.json
  • For the space usage go to Webpack Visualizer, and import stats.json