);
});
@@ -118,8 +100,8 @@ export default class Debug extends Component {
}
renderActions () {
- const { devLogsEnabled } = this.props.nodeStatus;
- const toggleButton = devLogsEnabled
+ const { logsEnabled } = this.debugStore;
+ const toggleButton = logsEnabled
?
: ;
@@ -143,21 +125,14 @@ export default class Debug extends Component {
}
clear = () => {
- const { clearStatusLogs } = this.props.actions;
-
- clearStatusLogs();
- }
+ this.debugStore.clearLogs();
+ };
toggle = () => {
- const { devLogsEnabled } = this.props.nodeStatus;
- const { toggleStatusLogs } = this.props.actions;
-
- toggleStatusLogs(!devLogsEnabled);
- }
+ this.debugStore.toggle();
+ };
reverse = () => {
- const { reversed } = this.state;
-
- this.setState({ reversed: !reversed });
- }
+ this.debugStore.reverse();
+ };
}
diff --git a/js/src/views/Status/components/Debug/index.js b/js/src/views/Status/Debug/index.js
similarity index 100%
rename from js/src/views/Status/components/Debug/index.js
rename to js/src/views/Status/Debug/index.js
diff --git a/js/src/views/Status/Debug/store.js b/js/src/views/Status/Debug/store.js
new file mode 100644
index 000000000..22466b7f9
--- /dev/null
+++ b/js/src/views/Status/Debug/store.js
@@ -0,0 +1,128 @@
+// Copyright 2015-2017 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import { action, observable, transaction } from 'mobx';
+
+const LOG_DATE_REGEX = /^(\d{4}.\d{2}.\d{2}.\d{2}.\d{2}.\d{2})(.*)$/i;
+const MAX_LOGS = 25;
+
+export default class DebugStore {
+ @observable logs = [];
+ @observable logsLevels = null;
+ @observable logsEnabled = false;
+ @observable reversed = false;
+
+ api = null;
+ _lastLogAdded = null;
+ _timeoutId = null;
+
+ constructor (api) {
+ this.api = api;
+ }
+
+ @action clearLogs () {
+ this.logs = [];
+ }
+
+ @action setLogs (logs, logsLevels) {
+ let newLogs = [];
+
+ if (this._lastLogAdded) {
+ const sliceIndex = logs.findIndex((log) => log === this._lastLogAdded);
+
+ newLogs = logs.slice(0, sliceIndex);
+ } else {
+ newLogs = logs.slice();
+ }
+
+ this._lastLogAdded = logs[0];
+
+ const parsedLogs = newLogs
+ .map((log) => {
+ const logDate = LOG_DATE_REGEX.exec(log);
+
+ if (!logDate) {
+ return null;
+ }
+
+ return {
+ date: new Date(logDate[1]),
+ log: logDate[2]
+ };
+ })
+ .filter((log) => log);
+
+ transaction(() => {
+ if (!this.reversed) {
+ this.logs = [].concat(parsedLogs, this.logs.slice()).slice(0, MAX_LOGS);
+ } else {
+ parsedLogs.reverse();
+ this.logs = [].concat(this.logs.slice(), parsedLogs).slice(-1 * MAX_LOGS);
+ }
+
+ this.logsLevels = logsLevels;
+ });
+ }
+
+ @action toggle () {
+ this.logsEnabled = !this.logsEnabled;
+
+ if (this.logsEnabled) {
+ this.initPolling();
+ } else {
+ this.stopPolling();
+ }
+ }
+
+ @action reverse () {
+ transaction(() => {
+ this.reversed = !this.reversed;
+ this.logs = this.logs.reverse();
+ });
+ }
+
+ initPolling () {
+ this._pollLogs();
+ }
+
+ stopPolling () {
+ if (this._timeoutId) {
+ clearTimeout(this._timeoutId);
+ }
+ }
+
+ _pollLogs = () => {
+ const nextTimeout = (timeout = 1000) => {
+ this.stopPolling();
+ this._timeoutId = setTimeout(this._pollLogs, timeout);
+ };
+
+ return Promise
+ .all([
+ this.api.parity.devLogs(),
+ this.api.parity.devLogsLevels()
+ ])
+ .then(([ devLogs, devLogsLevels ]) => {
+ this.setLogs(devLogs, devLogsLevels);
+ })
+ .catch((error) => {
+ console.error('_pollLogs', error);
+ })
+ .then(() => {
+ return nextTimeout();
+ });
+ }
+}
diff --git a/js/src/views/Status/components/MiningSettings/decodeExtraData.js b/js/src/views/Status/MiningSettings/decodeExtraData.js
similarity index 100%
rename from js/src/views/Status/components/MiningSettings/decodeExtraData.js
rename to js/src/views/Status/MiningSettings/decodeExtraData.js
diff --git a/js/src/views/Status/components/MiningSettings/decodeExtraData.spec.js b/js/src/views/Status/MiningSettings/decodeExtraData.spec.js
similarity index 100%
rename from js/src/views/Status/components/MiningSettings/decodeExtraData.spec.js
rename to js/src/views/Status/MiningSettings/decodeExtraData.spec.js
diff --git a/js/src/views/Status/components/MiningSettings/index.js b/js/src/views/Status/MiningSettings/index.js
similarity index 100%
rename from js/src/views/Status/components/MiningSettings/index.js
rename to js/src/views/Status/MiningSettings/index.js
diff --git a/js/src/views/Status/components/MiningSettings/miningSettings.js b/js/src/views/Status/MiningSettings/miningSettings.js
similarity index 76%
rename from js/src/views/Status/components/MiningSettings/miningSettings.js
rename to js/src/views/Status/MiningSettings/miningSettings.js
index 6e51b891a..32209cd24 100644
--- a/js/src/views/Status/components/MiningSettings/miningSettings.js
+++ b/js/src/views/Status/MiningSettings/miningSettings.js
@@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
+import formatNumber from 'format-number';
import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
-import formatNumber from 'format-number';
-import { ContainerTitle, Input } from '~/ui';
+import { ContainerTitle, Input, TypedInput } from '~/ui';
import { numberFromString } from './numberFromString';
import { decodeExtraData } from './decodeExtraData';
@@ -28,21 +28,23 @@ const toNiceNumber = formatNumber();
export default class MiningSettings extends Component {
static contextTypes = {
api: PropTypes.object
- }
+ };
static propTypes = {
- nodeStatus: PropTypes.object
- }
+ coinbase: PropTypes.string,
+ defaultExtraData: PropTypes.string,
+ extraData: PropTypes.string,
+ gasFloorTarget: PropTypes.object,
+ minGasPrice: PropTypes.object,
+ onUpdateSetting: PropTypes.func.isRequired
+ };
render () {
- const { nodeStatus } = this.props;
- const { coinbase, defaultExtraData, extraData, gasFloorTarget, minGasPrice } = nodeStatus;
-
- const extradata = extraData
+ const { coinbase, defaultExtraData, extraData, gasFloorTarget, minGasPrice } = this.props;
+ const decodedExtraData = extraData
? decodeExtraData(extraData)
: '';
-
- const defaultExtradata = defaultExtraData
+ const decodedDefaultExtraData = defaultExtraData
? decodeExtraData(defaultExtraData)
: '';
@@ -56,7 +58,7 @@ export default class MiningSettings extends Component {
/>
}
/>
-
}
+ param='address'
value={ coinbase }
- onSubmit={ this.onAuthorChange }
+ onChange={ this.onAuthorChange }
allowCopy
- floatCopy
- { ...this._test('author') }
/>
}
- value={ extradata }
+ value={ decodedExtraData }
onSubmit={ this.onExtraDataChange }
- defaultValue={ defaultExtradata }
allowCopy
- floatCopy
- { ...this._test('extra-data') }
/>
);
@@ -143,29 +139,36 @@ export default class MiningSettings extends Component {
onMinGasPriceChange = (newVal) => {
const { api } = this.context;
- api.parity.setMinGasPrice(numberFromString(newVal));
+ api.parity
+ .setMinGasPrice(numberFromString(newVal))
+ .then(() => this.updateMiningSettings());
};
- onExtraDataChange = (newVal, isResetToDefault) => {
+ onExtraDataChange = (value) => {
const { api } = this.context;
- const { nodeStatus } = this.props;
- // In case of resetting to default we are just using raw bytes from defaultExtraData
- // When user sets new value we can safely send a string that will be converted to hex by formatter.
- const val = isResetToDefault ? nodeStatus.defaultExtraData : newVal;
-
- api.parity.setExtraData(val);
+ api.parity
+ .setExtraData(value)
+ .then(() => this.updateMiningSettings());
};
onAuthorChange = (newVal) => {
const { api } = this.context;
- api.parity.setAuthor(newVal);
+ api.parity
+ .setAuthor(newVal)
+ .then(() => this.updateMiningSettings());
};
onGasFloorTargetChange = (newVal) => {
const { api } = this.context;
- api.parity.setGasFloorTarget(numberFromString(newVal));
+ api.parity
+ .setGasFloorTarget(numberFromString(newVal))
+ .then(() => this.updateMiningSettings());
};
+
+ updateMiningSettings () {
+ this.props.onUpdateSetting();
+ }
}
diff --git a/js/src/views/Status/components/MiningSettings/numberFromString.js b/js/src/views/Status/MiningSettings/numberFromString.js
similarity index 100%
rename from js/src/views/Status/components/MiningSettings/numberFromString.js
rename to js/src/views/Status/MiningSettings/numberFromString.js
diff --git a/js/src/views/Status/components/MiningSettings/numberFromString.spec.js b/js/src/views/Status/MiningSettings/numberFromString.spec.js
similarity index 100%
rename from js/src/views/Status/components/MiningSettings/numberFromString.spec.js
rename to js/src/views/Status/MiningSettings/numberFromString.spec.js
diff --git a/js/src/views/Status/containers/StatusPage/index.js b/js/src/views/Status/Peers/index.js
similarity index 95%
rename from js/src/views/Status/containers/StatusPage/index.js
rename to js/src/views/Status/Peers/index.js
index 403c5f08b..a223af63c 100644
--- a/js/src/views/Status/containers/StatusPage/index.js
+++ b/js/src/views/Status/Peers/index.js
@@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
-export default from './statusPage';
+export default from './peers';
diff --git a/js/src/views/Status/Peers/peers.css b/js/src/views/Status/Peers/peers.css
new file mode 100644
index 000000000..854d91cb0
--- /dev/null
+++ b/js/src/views/Status/Peers/peers.css
@@ -0,0 +1,47 @@
+/* Copyright 2015-2017 Parity Technologies (UK) Ltd.
+/* This file is part of Parity.
+/*
+/* Parity is free software: you can redistribute it and/or modify
+/* it under the terms of the GNU General Public License as published by
+/* the Free Software Foundation, either version 3 of the License, or
+/* (at your option) any later version.
+/*
+/* Parity is distributed in the hope that it will be useful,
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+/* GNU General Public License for more details.
+/*
+/* You should have received a copy of the GNU General Public License
+/* along with Parity. If not, see .
+*/
+
+.peers {
+ margin-top: 0.5em;
+ overflow: auto;
+ width: 100%;
+
+ table {
+ border-collapse: collapse;
+ width: 100%;
+ }
+
+ th {
+ padding: 0.5em;
+ text-align: left;
+ white-space: nowrap;
+ }
+}
+
+.peer {
+ &:nth-child(odd) {
+ background-color: rgba(200, 200, 200, 0.1);
+ }
+
+ td {
+ border-top: 1px solid #333;
+ font-size: 0.9em;
+ overflow: hidden;
+ padding: 0.5em 0.25em;
+ white-space: nowrap;
+ }
+}
diff --git a/js/src/views/Status/Peers/peers.js b/js/src/views/Status/Peers/peers.js
new file mode 100644
index 000000000..43fcbff30
--- /dev/null
+++ b/js/src/views/Status/Peers/peers.js
@@ -0,0 +1,163 @@
+// Copyright 2015-2017 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import React, { Component, PropTypes } from 'react';
+import { FormattedMessage } from 'react-intl';
+import { connect } from 'react-redux';
+
+import { Container, ContainerTitle, ScrollableText, ShortenedHash } from '~/ui';
+
+import styles from './peers.css';
+
+class Peers extends Component {
+ static propTypes = {
+ peers: PropTypes.array.isRequired
+ };
+
+ render () {
+ const { peers } = this.props;
+
+ return (
+
+
+ }
+ />
+
@@ -268,3 +278,24 @@ export default class Status extends Component {
);
}
}
+
+function mapStateToProps (state) {
+ const {
+ blockNumber,
+ blockTimestamp,
+ netChain,
+ netPeers
+ } = state.nodeStatus;
+
+ return {
+ blockNumber,
+ blockTimestamp,
+ netChain,
+ netPeers
+ };
+}
+
+export default connect(
+ mapStateToProps,
+ null
+)(Status);
diff --git a/js/src/views/Status/Status/store.js b/js/src/views/Status/Status/store.js
new file mode 100644
index 000000000..22fe20070
--- /dev/null
+++ b/js/src/views/Status/Status/store.js
@@ -0,0 +1,160 @@
+// Copyright 2015-2017 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import BigNumber from 'bignumber.js';
+import { action, observable, transaction } from 'mobx';
+
+export default class StatusStore {
+ @observable defaultExtraData = '';
+ @observable enode = '';
+ @observable hashrate = new BigNumber(0);
+ @observable netPort = new BigNumber(0);
+ @observable nodeName = '';
+ @observable rpcSettings = {};
+
+ @observable coinbase = '';
+ @observable extraData = '';
+ @observable gasFloorTarget = new BigNumber(0);
+ @observable minGasPrice = new BigNumber(0);
+
+ api = null;
+ _timeoutIds = {};
+
+ constructor (api) {
+ this.api = api;
+ }
+
+ @action setLongStatus ({ defaultExtraData, enode, netPort, rpcSettings }) {
+ transaction(() => {
+ this.defaultExtraData = defaultExtraData;
+ this.enode = enode;
+ this.netPort = netPort;
+ this.rpcSettings = rpcSettings;
+ });
+ }
+
+ @action setStatus ({ hashrate }) {
+ transaction(() => {
+ this.hashrate = hashrate;
+ });
+ }
+
+ @action setMinerSettings ({ coinbase, extraData, gasFloorTarget, minGasPrice }) {
+ transaction(() => {
+ this.coinbase = coinbase;
+ this.extraData = extraData;
+ this.gasFloorTarget = gasFloorTarget;
+ this.minGasPrice = minGasPrice;
+ });
+ }
+
+ startPolling () {
+ this._pollStatus();
+ this._pollLongStatus();
+ }
+
+ stopPolling () {
+ Object.keys(this._timeoutIds).forEach((key) => clearTimeout(this._timeoutIds[key]));
+ }
+
+ /**
+ * Miner settings should never changes unless
+ * Parity is restarted, or if the values are changed
+ * from the UI
+ */
+ _pollMinerSettings () {
+ return Promise
+ .all([
+ this.api.eth.coinbase(),
+ this.api.parity.extraData(),
+ this.api.parity.gasFloorTarget(),
+ this.api.parity.minGasPrice()
+ ])
+ .then(([
+ coinbase, extraData, gasFloorTarget, minGasPrice
+ ]) => {
+ const minerSettings = {
+ coinbase,
+ extraData,
+ gasFloorTarget,
+ minGasPrice
+ };
+
+ this.setMinerSettings(minerSettings);
+ })
+ .catch((error) => {
+ console.error('_pollMinerSettings', error);
+ });
+ }
+
+ _pollStatus () {
+ const nextTimeout = (timeout = 1000) => {
+ clearTimeout(this._timeoutIds.short);
+ this._timeoutIds.short = setTimeout(() => this._pollStatus(), timeout);
+ };
+
+ return Promise
+ .all([
+ this.api.eth.hashrate()
+ ])
+ .then(([
+ hashrate
+ ]) => {
+ this.setStatus({
+ hashrate
+ });
+ })
+ .catch((error) => {
+ console.error('_pollStatus', error);
+ })
+ .then(() => {
+ nextTimeout();
+ });
+ }
+
+ _pollLongStatus () {
+ const nextTimeout = (timeout = 30000) => {
+ clearTimeout(this._timeoutIds.long);
+ this._timeoutIds.long = setTimeout(() => this._pollLongStatus(), timeout);
+ };
+
+ this._pollMinerSettings();
+ return Promise
+ .all([
+ this.api.parity.defaultExtraData(),
+ this.api.parity.enode().then((enode) => enode).catch(() => '-'),
+ this.api.parity.netPort(),
+ this.api.parity.rpcSettings()
+ ])
+ .then(([
+ defaultExtraData, enode, netPort, rpcSettings
+ ]) => {
+ this.setLongStatus({
+ defaultExtraData, enode, netPort, rpcSettings
+ });
+ })
+ .catch((error) => {
+ console.error('_pollLongStatus', error);
+ })
+ .then(() => {
+ nextTimeout();
+ });
+ }
+
+ handleUpdateSetting = () => {
+ return this._pollMinerSettings();
+ };
+}
diff --git a/js/src/views/Status/actions/clipboard.js b/js/src/views/Status/actions/clipboard.js
deleted file mode 100644
index c58f1ef52..000000000
--- a/js/src/views/Status/actions/clipboard.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { createAction } from 'redux-actions';
-
-import { identity } from '../util';
-import { withError } from '~/redux/util';
-
-export const copyToClipboard = createAction('copy toClipboard', identity, withError(identity));
diff --git a/js/src/views/Status/actions/debug.js b/js/src/views/Status/actions/debug.js
deleted file mode 100644
index b1ace8e63..000000000
--- a/js/src/views/Status/actions/debug.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { createAction } from 'redux-actions';
-
-export const error = createAction('error');
-export const updateDevLogs = createAction('update devLogs');
-export const removeDevLogs = createAction('remove devLogs');
-export const updateDevLogging = createAction('update devLogging');
-export const updateDevLogsLevels = createAction('update devLogsLevels');
diff --git a/js/src/views/Status/actions/mining.js b/js/src/views/Status/actions/mining.js
deleted file mode 100644
index 5a1ff11c7..000000000
--- a/js/src/views/Status/actions/mining.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { createAction } from 'redux-actions';
-
-export const error = createAction('error');
-export const updateAuthor = createAction('update author');
-export const updateMinGasPrice = createAction('update minGasPrice');
-export const updateGasFloorTarget = createAction('update gasFloorTarget');
-export const updateExtraData = createAction('update extraData');
-export const updateDefaultExtraData = createAction('update defaultExtraData');
diff --git a/js/src/views/Status/actions/modify-mining.js b/js/src/views/Status/actions/modify-mining.js
deleted file mode 100644
index e61ce4586..000000000
--- a/js/src/views/Status/actions/modify-mining.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { createAction } from 'redux-actions';
-
-export const modifyMinGasPrice = createAction('modify minGasPrice');
-export const modifyGasFloorTarget = createAction('modify gasFloorTarget');
-export const modifyAuthor = createAction('modify author');
-export const modifyExtraData = createAction('modify extraData');
-export const resetExtraData = createAction('reset extraData');
diff --git a/js/src/views/Status/actions/status.js b/js/src/views/Status/actions/status.js
deleted file mode 100644
index 38261e84f..000000000
--- a/js/src/views/Status/actions/status.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { createAction } from 'redux-actions';
-
-export const error = createAction('error');
-export const updateHashrate = createAction('update hashrate');
-export const updateBlockNumber = createAction('update blockNumber');
-export const updateVersion = createAction('update version');
-export const updatePeerCount = createAction('update peerCount');
-export const updateNetPeers = createAction('update netPeers');
-export const updateNetChain = createAction('update netChain');
-export const updateNetPort = createAction('update netPort');
-export const updateRpcSettings = createAction('update rpcSettings');
-export const updateNodeName = createAction('update nodeName');
-export const updateAccounts = createAction('update accounts');
diff --git a/js/src/views/Status/containers/StatusPage/statusPage.js b/js/src/views/Status/containers/StatusPage/statusPage.js
deleted file mode 100644
index 704a27684..000000000
--- a/js/src/views/Status/containers/StatusPage/statusPage.js
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import React, { Component, PropTypes } from 'react';
-import { bindActionCreators } from 'redux';
-import { connect } from 'react-redux';
-
-import { clearStatusLogs, toggleStatusLogs, toggleStatusRefresh } from '~/redux/actions';
-
-import Debug from '../../components/Debug';
-import Status from '../../components/Status';
-
-import styles from './statusPage.css';
-
-class StatusPage extends Component {
- static propTypes = {
- nodeStatus: PropTypes.object.isRequired,
- actions: PropTypes.object.isRequired
- }
-
- componentWillMount () {
- this.props.actions.toggleStatusRefresh(true);
- }
-
- componentWillUnmount () {
- this.props.actions.toggleStatusRefresh(false);
- }
-
- render () {
- return (
-
-
-
-
- );
- }
-}
-
-function mapStateToProps (state) {
- return state;
-}
-
-function mapDispatchToProps (dispatch) {
- return {
- actions: bindActionCreators({
- clearStatusLogs,
- toggleStatusLogs,
- toggleStatusRefresh
- }, dispatch)
- };
-}
-
-export default connect(
- mapStateToProps,
- mapDispatchToProps
-)(StatusPage);
diff --git a/js/src/views/Status/reducers/debug.js b/js/src/views/Status/reducers/debug.js
deleted file mode 100644
index ead2db49c..000000000
--- a/js/src/views/Status/reducers/debug.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { handleActions } from 'redux-actions';
-import { union } from 'lodash';
-
-const initialState = {
- levels: '',
- logging: true,
- logs: []
-};
-
-const maxLogs = 1024;
-
-export const actionHandlers = {
-
- 'update devLogsLevels' (state, action) {
- return {
- ...state,
- levels: `${action.payload}`
- };
- },
-
- 'remove devLogs' (state, action) {
- return {
- ...state,
- logs: []
- };
- },
-
- 'update devLogging' (state, action) {
- return {
- ...state,
- logging: action.payload
- };
- },
-
- 'update devLogs' (state, action) {
- if (!state.logging) {
- return { ...state };
- }
-
- let newLogs = union(state.logs, action.payload.reverse());
-
- return {
- ...state,
- logs: newLogs.slice(newLogs.length - maxLogs)
- };
- }
-
-};
-
-export default handleActions(actionHandlers, initialState);
diff --git a/js/src/views/Status/reducers/index.js b/js/src/views/Status/reducers/index.js
deleted file mode 100644
index 7e749694c..000000000
--- a/js/src/views/Status/reducers/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import status from './status';
-import settings from './settings';
-import mining from './mining';
-import debug from './debug';
-import rpc from './rpc';
-import logger from './logger';
-
-export {
- status,
- settings,
- mining,
- rpc,
- logger,
- debug
-};
diff --git a/js/src/views/Status/reducers/mining.js b/js/src/views/Status/reducers/mining.js
deleted file mode 100644
index 7a7b17dc4..000000000
--- a/js/src/views/Status/reducers/mining.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { handleActions } from 'redux-actions';
-
-const initialState = {
- author: 'loading...',
- extraData: 'loading...',
- defaultExtraData: '0x01',
- minGasPrice: 'loading...',
- gasFloorTarget: 'loading...'
-};
-
-export const actionHandlers = {
-
- 'update author' (state, action) {
- return {
- ...state,
- author: `${action.payload}`
- };
- },
-
- 'update minGasPrice' (state, action) {
- return {
- ...state,
- minGasPrice: `${action.payload}`
- };
- },
-
- 'update gasFloorTarget' (state, action) {
- return {
- ...state,
- gasFloorTarget: `${action.payload}`
- };
- },
-
- 'update extraData' (state, action) {
- return {
- ...state,
- extraData: `${action.payload}`
- };
- },
-
- 'update defaultExtraData' (state, action) {
- return {
- ...state,
- defaultExtraData: `${action.payload}`
- };
- }
-
-};
-
-export default handleActions(actionHandlers, initialState);
diff --git a/js/src/views/Status/reducers/settings.js b/js/src/views/Status/reducers/settings.js
deleted file mode 100644
index 80f2ec36f..000000000
--- a/js/src/views/Status/reducers/settings.js
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { handleActions } from 'redux-actions';
-
-const initialState = {
- chain: 'loading...',
- networkPort: 0,
- maxPeers: 0,
- rpcEnabled: false,
- rpcInterface: '-',
- rpcPort: 0
-};
-
-export default handleActions({
- 'update netChain' (state, action) {
- return {
- ...state,
- chain: action.payload
- };
- },
-
- 'update netPort' (state, action) {
- return {
- ...state,
- networkPort: action.payload
- };
- },
-
- 'update netPeers' (state, action) {
- return {
- ...state,
- maxPeers: action.payload.max
- };
- },
-
- 'update rpcSettings' (state, action) {
- const rpc = action.payload;
-
- return {
- ...state,
- rpcEnabled: rpc.enabled,
- rpcInterface: rpc.interface,
- rpcPort: rpc.port
- };
- }
-}, initialState);
diff --git a/js/src/views/Status/reducers/status.js b/js/src/views/Status/reducers/status.js
deleted file mode 100644
index fdce3bd29..000000000
--- a/js/src/views/Status/reducers/status.js
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity. If not, see .
-
-import { handleActions } from 'redux-actions';
-
-const initialState = {
- error: false,
- noOfErrors: 0,
- name: 'My node',
- bestBlock: 'loading...',
- hashrate: 'loading...',
- connectedPeers: 0,
- activePeers: 0,
- peers: 0,
- accounts: [],
- version: '-'
-};
-
-export default handleActions({
- error (state, action) {
- return {
- ...state,
- disconnected: (action.payload.message === 'Invalid JSON RPC response: ""'),
- noOfErrors: state.noOfErrors + 1
- };
- },
-
- 'update blockNumber' (state, action) {
- return {
- ...resetError(state),
- bestBlock: `${action.payload}`
- };
- },
-
- 'update hashrate' (state, action) {
- return {
- ...resetError(state),
- hashrate: `${action.payload}`
- };
- },
-
- 'update netPeers' (state, action) {
- return {
- ...state,
- connectedPeers: action.payload.connected,
- activePeers: action.payload.active
- };
- },
-
- 'update version' (state, action) {
- return {
- ...resetError(state),
- version: action.payload
- };
- },
-
- 'update accounts' (state, action) {
- return {
- ...resetError(state),
- accounts: action.payload
- };
- },
-
- 'update nodeName' (state, action) {
- return {
- ...resetError(state),
- name: action.payload || ' '
- };
- }
-
-}, initialState);
-
-function resetError (state) {
- return {
- ...state,
- disconnected: false,
- noOfErrors: 0
- };
-}
diff --git a/js/src/views/Status/containers/StatusPage/statusPage.css b/js/src/views/Status/status.css
similarity index 100%
rename from js/src/views/Status/containers/StatusPage/statusPage.css
rename to js/src/views/Status/status.css
diff --git a/js/src/views/Status/status.js b/js/src/views/Status/status.js
index 68621fe9b..0f4c0fce6 100644
--- a/js/src/views/Status/status.js
+++ b/js/src/views/Status/status.js
@@ -14,26 +14,30 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
-import React, { Component } from 'react';
+import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Page } from '~/ui';
-import StatusPage from './containers/StatusPage';
+import Debug from './Debug';
+import Peers from './Peers';
+import Status from './Status';
-export default class Status extends Component {
- render () {
- return (
-
- }
- >
-
-
- );
- }
-}
+import styles from './status.css';
+
+export default () => (
+
+ }
+ >
+