From c7317656d73dc3e89582026f9def5eca4fc38c7f Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 9 Jan 2018 15:35:25 +0300 Subject: [PATCH] settings debuglog fix --- .../settings/settings.addNodePanel.js | 179 ------------------ .../settings/settings.debugLogPanel.js | 13 +- .../dashboard/settings/settings.render.js | 1 - 3 files changed, 12 insertions(+), 181 deletions(-) delete mode 100644 react/src/components/dashboard/settings/settings.addNodePanel.js diff --git a/react/src/components/dashboard/settings/settings.addNodePanel.js b/react/src/components/dashboard/settings/settings.addNodePanel.js deleted file mode 100644 index 5c0c1a4..0000000 --- a/react/src/components/dashboard/settings/settings.addNodePanel.js +++ /dev/null @@ -1,179 +0,0 @@ -import React from 'react'; -import { translate } from '../../../translate/translate'; -import { connect } from 'react-redux'; - -import { - addPeerNode, - getPeersList, - getPeersListState, -} from '../../../actions/actionCreators'; -import Store from '../../../store'; - -import AddCoinOptionsCrypto from '../../addcoin/addcoinOptionsCrypto'; -import AddCoinOptionsAC from '../../addcoin/addcoinOptionsAC'; -import AddCoinOptionsACFiat from '../../addcoin/addcoinOptionsACFiat'; - -class AddNodePanel extends React.Component { - constructor() { - super(); - this.state = { - addNodeCoin: null, - addPeerIP: null, - getPeersCoin: null, - trimPassphraseTimer: null, - wifkeysPassphrase:'', - }; - this.renderSNPeersList = this.renderSNPeersList.bind(this); - this.renderPeersList = this.renderPeersList.bind(this); - this.checkNodes = this.checkNodes.bind(this); - this.addNode = this.addNode.bind(this); - this.updateInput = this.updateInput.bind(this); - } - - renderSNPeersList() { - if (this.state.getPeersCoin) { - const _getPeersCoin = this.state.getPeersCoin; - const _supernetPeers = this.props.Settings.supernetPeers; - const coin = _getPeersCoin.split('|')[0]; - - if (_supernetPeers && - _getPeersCoin && - _supernetPeers[coin]) { - return _supernetPeers[coin].map((ip) => -
{ ip }
- ); - } else { - return null; - } - } else { - return null; - } - } - - renderPeersList() { - if (this.state.getPeersCoin) { - const _getPeersCoin = this.state.getPeersCoin; - const _rawPeers = this.props.Settings.rawPeers; - const coin = _getPeersCoin.split('|')[0]; - - if (_rawPeers && - _getPeersCoin && - _rawPeers[coin]) { - return _rawPeers[coin].map((ip) => -
{ ip }
- ); - } else { - return null; - } - } else { - return null; - } - } - - checkNodes() { - if (this.state.getPeersCoin) { - console.warn(this.state.getPeersCoin.split('|')[0]); - Store.dispatch(getPeersList(this.state.getPeersCoin.split('|')[0])); - } - } - - addNode() { - if (this.state.addNodeCoin && - this.state.addPeerIP) { - Store.dispatch( - addPeerNode( - this.state.addNodeCoin.split('|')[0], - this.state.addPeerIP - ) - ); - } - } - - updateInput(e) { - this.setState({ - [e.target.name]: e.target.value, - }); - } - - render() { - return ( -
-
-
-

{ translate('INDEX.USE_THIS_SECTION') }

-
-
-
- -
-
-
- -
-
-
- SuperNET Peers: -
-
{ this.renderSNPeersList() }
-
- Raw Peers: -
-
{ this.renderPeersList() }
-
-
- -
-
-

{ translate('INDEX.USE_THIS_SECTION_PEER') }

-
-
-
- -
-
- -
-
-
- -
-
-
- ); - }; -} - -const mapStateToProps = (state) => { - return { - Settings: state.Settings, - }; -}; - -export default connect(mapStateToProps)(AddNodePanel); \ No newline at end of file diff --git a/react/src/components/dashboard/settings/settings.debugLogPanel.js b/react/src/components/dashboard/settings/settings.debugLogPanel.js index 58b2310..4a4a8bf 100644 --- a/react/src/components/dashboard/settings/settings.debugLogPanel.js +++ b/react/src/components/dashboard/settings/settings.debugLogPanel.js @@ -29,6 +29,17 @@ class DebugLogPanel extends React.Component { this.checkInputVals = this.checkInputVals.bind(this); } + componentWillMount() { + if (this.props.Main.coins && + this.props.Main.coins.native && + Object.keys(this.props.Main.coins.native).length === 0) { + this.setState({ + toggleAppRuntimeLog: true, + }); + this.getAppRuntimeLog(); + } + } + readDebugLog() { let _target = this.state.debugTarget; @@ -57,7 +68,7 @@ class DebugLogPanel extends React.Component { _items.push(

{ secondsToString(_appRuntimeLog[i].time, true) } - { JSON.stringify(_appRuntimeLog[i].msg, null, '') } + { _appRuntimeLog[i].msg.indexOf('{') === -1 ? _appRuntimeLog[i].msg : JSON.stringify(_appRuntimeLog[i].msg, null, '') }

); } diff --git a/react/src/components/dashboard/settings/settings.render.js b/react/src/components/dashboard/settings/settings.render.js index c9f8d4a..0dbe84d 100644 --- a/react/src/components/dashboard/settings/settings.render.js +++ b/react/src/components/dashboard/settings/settings.render.js @@ -5,7 +5,6 @@ import Panel from './settings.panel'; import AppUpdatePanel from './settings.appUpdatePanel'; import AppInfoPanel from './settings.appInfoPanel'; -// import AddNodePanel from './settings.addNodePanel'; import AppSettingsPanel from './settings.appSettingsPanel'; import CliPanel from './settings.cliPanel'; import DebugLogPanel from './settings.debugLogPanel';