Kurkó Mihály 39c16c8a1e cmd, ethdb, vendor: integrate leveldb iostats (#16277) | 6 年 前 | |
---|---|---|
.. | ||
assets | 6 年 前 | |
README.md | 6 年 前 | |
assets.go | 6 年 前 | |
config.go | 6 年 前 | |
cpu.go | 7 年 前 | |
cpu_windows.go | 7 年 前 | |
dashboard.go | 6 年 前 | |
message.go | 6 年 前 |
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'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.
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 && yarn install && yarn flow)
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 yarn dev
to watch for file system changes and refresh the browser automatically.
$ geth --dashboard --vmodule=dashboard=5
$ (cd dashboard/assets && yarn dev)
To bundle up the final UI into Geth, run go generate
:
$ (cd dashboard && go generate)
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 yarn
.
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.
Webpack offers handy tools for visualizing the bundle's dependency tree and space usage.
yarn stats
stats.json
stats.json