aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/assets/components/Dashboard.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard/assets/components/Dashboard.jsx')
-rw-r--r--dashboard/assets/components/Dashboard.jsx32
1 files changed, 19 insertions, 13 deletions
diff --git a/dashboard/assets/components/Dashboard.jsx b/dashboard/assets/components/Dashboard.jsx
index 63c2186ad..944d50090 100644
--- a/dashboard/assets/components/Dashboard.jsx
+++ b/dashboard/assets/components/Dashboard.jsx
@@ -17,14 +17,16 @@
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
import React, {Component} from 'react';
+import {hot} from 'react-hot-loader';
-import withStyles from 'material-ui/styles/withStyles';
+import withStyles from '@material-ui/core/styles/withStyles';
-import Header from './Header';
-import Body from './Body';
+import Header from 'Header';
+import Body from 'Body';
+import {inserter as logInserter, SAME} from 'Logs';
+import {inserter as peerInserter} from 'Network';
import {MENU} from '../common';
import type {Content} from '../types/content';
-import {inserter as logInserter} from './Logs';
// deepUpdate updates an object corresponding to the given update data, which has
// the shape of the same structure as the original object. updater also has the same
@@ -37,7 +39,6 @@ import {inserter as logInserter} from './Logs';
// of the update.
const deepUpdate = (updater: Object, update: Object, prev: Object): $Shape<Content> => {
if (typeof update === 'undefined') {
- // TODO (kurkomisi): originally this was deep copy, investigate it.
return prev;
}
if (typeof updater === 'function') {
@@ -88,8 +89,13 @@ const defaultContent: () => Content = () => ({
home: {},
chain: {},
txpool: {},
- network: {},
- system: {
+ network: {
+ peers: {
+ bundles: {},
+ },
+ diff: [],
+ },
+ system: {
activeMemory: [],
virtualMemory: [],
networkIngress: [],
@@ -103,8 +109,8 @@ const defaultContent: () => Content = () => ({
chunks: [],
endTop: false,
endBottom: true,
- topChanged: 0,
- bottomChanged: 0,
+ topChanged: SAME,
+ bottomChanged: SAME,
},
});
@@ -119,7 +125,7 @@ const updaters = {
home: null,
chain: null,
txpool: null,
- network: null,
+ network: peerInserter(200),
system: {
activeMemory: appender(200),
virtualMemory: appender(200),
@@ -186,8 +192,8 @@ class Dashboard extends Component<Props, State> {
// reconnect establishes a websocket connection with the server, listens for incoming messages
// and tries to reconnect on connection loss.
reconnect = () => {
- // PROD is defined by webpack.
- const server = new WebSocket(`${((window.location.protocol === 'https:') ? 'wss://' : 'ws://')}${PROD ? window.location.host : 'localhost:8080'}/api`);
+ const host = process.env.NODE_ENV === 'production' ? window.location.host : 'localhost:8080';
+ const server = new WebSocket(`${((window.location.protocol === 'https:') ? 'wss://' : 'ws://')}${host}/api`);
server.onopen = () => {
this.setState({content: defaultContent(), shouldUpdate: {}, server});
};
@@ -249,4 +255,4 @@ class Dashboard extends Component<Props, State> {
}
}
-export default withStyles(themeStyles)(Dashboard);
+export default hot(module)(withStyles(themeStyles)(Dashboard));