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') }
- - +- { 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') }
-