diff --git a/react/src/components/dashboard/settings/settings.debugLogPanel.js b/react/src/components/dashboard/settings/settings.debugLogPanel.js index a16e1bf..bb39fdc 100644 --- a/react/src/components/dashboard/settings/settings.debugLogPanel.js +++ b/react/src/components/dashboard/settings/settings.debugLogPanel.js @@ -11,12 +11,17 @@ class DebugLogPanel extends React.Component { constructor() { super(); this.state = { + appRuntimeLog: [], debugLinesCount: 10, debugTarget: 'iguana', nativeOnly: Config.iguanaLessMode, + toggleAppRuntimeLog: false, }; this.readDebugLog = this.readDebugLog.bind(this); this.updateInput = this.updateInput.bind(this); + this.getAppRuntimeLog = this.getAppRuntimeLog.bind(this); + this.toggleAppRuntimeLog = this.toggleAppRuntimeLog.bind(this); + this.renderAppRuntimeLog = this.renderAppRuntimeLog.bind(this); } readDebugLog() { @@ -28,6 +33,45 @@ class DebugLogPanel extends React.Component { ); } + renderAppRuntimeLog() { + let _items = []; + const _appRuntimeLog = this.state.appRuntimeLog; + + for (let i = 0; i < _appRuntimeLog.length; i++) { + _items.push( +

+ { secondsToString(_appRuntimeLog[i].time, true) } + { JSON.stringify(_appRuntimeLog[i].msg, null, '').replace('\\n', ' ') } +

+ ); + } + + return _items; + } + + toggleAppRuntimeLog() { + this.setState(Object.assign({}, this.state, { + toggleAppRuntimeLog: !this.state.toggleAppRuntimeLog, + })); + + this.getAppRuntimeLog(); + } + + getAppRuntimeLog() { + let _appRuntimeLog; + + try { + _appRuntimeLog = window.require('electron').remote.getCurrentWindow().getAppRuntimeLog; + } catch (e) {} + + _appRuntimeLog() + .then((json) => { + this.setState(Object.assign({}, this.state, { + appRuntimeLog: json, + })); + }); + } + renderDebugLogData() { if (this.props.Settings.debugLog) { const _debugLogDataRows = this.props.Settings.debugLog.split('\n'); @@ -59,47 +103,68 @@ class DebugLogPanel extends React.Component { return (

{ translate('INDEX.DEBUG_LOG_DESC') }

-
-
-
- - -
-
- - -
-
- -
-
-
{ this.renderDebugLogData() }
-
-
+
+ + + Show app runtime log + +
+ { !this.state.toggleAppRuntimeLog && +
+
+ + +
+
+ + +
+
+ +
+
+
{ this.renderDebugLogData() }
+
+
+ } + { this.state.toggleAppRuntimeLog && +
{ this.renderAppRuntimeLog() }
+ }
); }; diff --git a/react/src/components/dashboard/settings/settings.js b/react/src/components/dashboard/settings/settings.js index 8147b0f..4351455 100644 --- a/react/src/components/dashboard/settings/settings.js +++ b/react/src/components/dashboard/settings/settings.js @@ -47,52 +47,8 @@ class Settings extends React.Component { seedInputVisibility: false, nativeOnly: Config.iguanaLessMode, disableWalletSpecificUI: false, - appRuntimeLog: [], - toggleAppRuntimeLog: false, }; this.updateInput = this.updateInput.bind(this); - this.getAppRuntimeLog = this.getAppRuntimeLog.bind(this); - this.toggleAppRuntimeLog = this.toggleAppRuntimeLog.bind(this); - this.renderAppRuntimeLog = this.renderAppRuntimeLog.bind(this); - } - - renderAppRuntimeLog() { - let _items = []; - const _appRuntimeLog = this.state.appRuntimeLog; - - for (let i = 0; i < _appRuntimeLog.length; i++) { - _items.push( -

- { secondsToString(_appRuntimeLog[i].time, true) } - { JSON.stringify(_appRuntimeLog[i].msg, null, '').replace('\\n', ' ') } -

- ); - } - - return _items; - } - - toggleAppRuntimeLog() { - this.setState(Object.assign({}, this.state, { - toggleAppRuntimeLog: !this.state.toggleAppRuntimeLog, - })); - - this.getAppRuntimeLog(); - } - - getAppRuntimeLog() { - let _appRuntimeLog; - - try { - _appRuntimeLog = window.require('electron').remote.getCurrentWindow().getAppRuntimeLog; - } catch (e) {} - - _appRuntimeLog() - .then((json) => { - this.setState(Object.assign({}, this.state, { - appRuntimeLog: json, - })); - }); } componentDidMount(props) { diff --git a/react/src/components/dashboard/settings/settings.render.js b/react/src/components/dashboard/settings/settings.render.js index ac15a9c..33682a8 100644 --- a/react/src/components/dashboard/settings/settings.render.js +++ b/react/src/components/dashboard/settings/settings.render.js @@ -129,72 +129,8 @@ export const SettingsRender = function() {
-
-

{ translate('INDEX.DEBUG_LOG_DESC') }

-
- - - Show app runtime log - -
- { !this.state.toggleAppRuntimeLog && -
-
- - -
-
- - -
-
- -
-
-
{ this.renderDebugLogData() }
-
-
- } - { this.state.toggleAppRuntimeLog && -
{ this.renderAppRuntimeLog() }
- } -
+ style={{ height: this.state.activeTab === 6 ? `auto` : '0' }}> + { this.renderDebugLog() }