Browse Source

app runtime log fetch

all-modes
pbca26 7 years ago
parent
commit
ec200d9f32
  1. 7
      react/src/components/dashboard/loginSettingsModal/loginSettingsModal.scss
  2. 2
      react/src/components/dashboard/navbar/navbar.render.js
  3. 2
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  4. 46
      react/src/components/dashboard/settings/settings.js
  5. 103
      react/src/components/dashboard/settings/settings.render.js
  6. 6
      react/src/components/dashboard/settings/settings.scss
  7. 2
      react/src/components/dashboard/walletsNav/walletsNav.js
  8. 15
      react/src/components/dashboard/walletsNav/walletsNav.render.js
  9. 2
      react/src/components/login/login.render.js
  10. 1
      react/src/styles/index.scss
  11. 3
      react/src/translate/en.js

7
react/src/components/dashboard/loginSettingsModal/loginSettingsModal.scss

@ -0,0 +1,7 @@
.login-settings-modal {
form {
width: 100%;
margin: 0;
margin-top: 25px;
}
}

2
react/src/components/dashboard/navbar/navbar.render.js

@ -113,7 +113,7 @@ const NavbarRender = function() {
</li>
<li>
<a onClick={ () => this.dashboardChangeSection('about') }>
<i className="icon fa-users"></i> { translate('INDEX.ABOUT_IGUANA') }
<i className="icon fa-users"></i> { translate('ABOUT.ABOUT_AGAMA') }
</a>
</li>
<li className={ this.state.nativeOnly ? 'hide' : 'divider' }></li>

2
react/src/components/dashboard/receiveCoin/receiveCoin.js

@ -233,7 +233,7 @@ const mapStateToProps = (state, props) => {
if (props &&
props.activeSection &&
props.renderTableOnly) {
_mappedProps.ActiveCoin.activeSection = props.activeSection;
_mappedProps.activeSection = props.activeSection;
_mappedProps.renderTableOnly = props.renderTableOnly;
}

46
react/src/components/dashboard/settings/settings.js

@ -21,7 +21,7 @@ import {
skipFullDashboardUpdate,
} from '../../../actions/actionCreators';
import Store from '../../../store';
import { secondsToString } from '../../../util/time';
import {
AppInfoTabRender,
SettingsRender,
@ -67,6 +67,8 @@ class Settings extends React.Component {
wifkeysPassphrase: '',
trimPassphraseTimer: null,
disableWalletSpecificUI: null,
appRuntimeLog: [],
toggleAppRuntimeLog: false,
};
this.exportWifKeys = this.exportWifKeys.bind(this);
this.updateInput = this.updateInput.bind(this);
@ -84,6 +86,48 @@ class Settings extends React.Component {
this._updateUIPromise = this._updateUIPromise.bind(this);
this.updateTabDimensions = this.updateTabDimensions.bind(this);
this._skipFullDashboardUpdate = this._skipFullDashboardUpdate.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(
<p key={ `app-runtime-log-entry-${i}` }>
<span>{ secondsToString(_appRuntimeLog[i].time, true) }</span>
<span className="padding-left-30">{ JSON.stringify(_appRuntimeLog[i].msg, null, '').replace('\\n', ' ') }</span>
</p>
);
}
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,
}));
});
}
_skipFullDashboardUpdate() {

103
react/src/components/dashboard/settings/settings.render.js

@ -472,47 +472,68 @@ export const SettingsRender = function() {
style={{ height: this.state.activeTab === 6 ? `${this.state.activeTabHeight}px` : '0' }}>
<div className="panel-body">
<p>{ translate('INDEX.DEBUG_LOG_DESC') }</p>
<div className="col-sm-12"></div>
<form
className="read-debug-log-import-form"
method="post"
action="javascript:"
autoComplete="off">
<div className="form-group form-material floating">
<input
type="text"
className="form-control"
name="debugLinesCount"
id="readDebugLogLines"
value={ this.state.debugLinesCount }
onChange={ this.updateInput } />
<label
className="floating-label"
htmlFor="readDebugLogLines">{ translate('INDEX.DEBUG_LOG_LINES') }</label>
</div>
<div className="form-group form-material floating">
<select
className="form-control form-material"
name="debugTarget"
id="settingsDelectDebugLogOptions"
onChange={ this.updateInput }>
<option value="iguana" className={ this.state.nativeOnly ? 'hide' : '' }>Iguana</option>
<option value="komodo">Komodo</option>
</select>
<label
className="floating-label"
htmlFor="settingsDelectDebugLogOptions">{ translate('INDEX.TARGET') }</label>
</div>
<div className="col-sm-12 col-xs-12 text-align-center">
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }</button>
</div>
<div className="col-sm-12 col-xs-12 text-align-left">
<div className="padding-top-40 padding-bottom-20 horizontal-padding-0">{ this.renderDebugLogData() }</div>
</div>
</form>
<div className="margin-top-30">
<span className="pointer toggle">
<label className="switch">
<input
type="checkbox"
name="settings-app-debug-toggle"
value={ this.state.toggleAppRuntimeLog }
checked={ this.state.toggleAppRuntimeLog } />
<div
className="slider"
onClick={ this.toggleAppRuntimeLog }></div>
</label>
<span
className="title"
onClick={ this.toggleAppRuntimeLog }>Show app runtime log</span>
</span>
</div>
{ !this.state.toggleAppRuntimeLog &&
<form
className="read-debug-log-import-form"
method="post"
action="javascript:"
autoComplete="off">
<div className="form-group form-material floating">
<input
type="text"
className="form-control"
name="debugLinesCount"
id="readDebugLogLines"
value={ this.state.debugLinesCount }
onChange={ this.updateInput } />
<label
className="floating-label"
htmlFor="readDebugLogLines">{ translate('INDEX.DEBUG_LOG_LINES') }</label>
</div>
<div className="form-group form-material floating">
<select
className="form-control form-material"
name="debugTarget"
id="settingsDelectDebugLogOptions"
onChange={ this.updateInput }>
<option value="iguana" className={ this.state.nativeOnly ? 'hide' : '' }>Iguana</option>
<option value="komodo">Komodo</option>
</select>
<label
className="floating-label"
htmlFor="settingsDelectDebugLogOptions">{ translate('INDEX.TARGET') }</label>
</div>
<div className="col-sm-12 col-xs-12 text-align-center">
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }</button>
</div>
<div className="col-sm-12 col-xs-12 text-align-left">
<div className="padding-top-40 padding-bottom-20 horizontal-padding-0">{ this.renderDebugLogData() }</div>
</div>
</form>
}
{ this.state.toggleAppRuntimeLog &&
<div className="margin-top-20">{ this.renderAppRuntimeLog() }</div>
}
</div>
</div>
</div>

6
react/src/components/dashboard/settings/settings.scss

@ -69,6 +69,12 @@
.toggle {
position: relative;
top: 4px;
.title {
position: relative;
top: -12px;
left: 12px;
}
}
table {
width: 100%;

2
react/src/components/dashboard/walletsNav/walletsNav.js

@ -132,7 +132,7 @@ const mapStateToProps = (state) => {
balance: state.ActiveCoin.balance,
cache: state.ActiveCoin.cache,
activeSection: state.ActiveCoin.activeSection,
activeAddress: state.ActiveCoin.activeAddress
activeAddress: state.ActiveCoin.activeAddress,
},
Dashboard: {
activeHandle: state.Dashboard.activeHandle,

15
react/src/components/dashboard/walletsNav/walletsNav.render.js

@ -52,14 +52,13 @@ export const WalletsNavWithWalletRender = function() {
onClick={ this.props.ActiveCoin.mode !== 'native' ? this.toggleSendReceiveCoinForms : this.toggleNativeWalletTransactions }>
<i className="icon md-view-dashboard"></i> { translate('INDEX.TRANSACTIONS') }
</button>
{ (((this.props.ActiveCoin.mode === 'full' || this.props.ActiveCoin.mode === 'native') && this.checkTotalBalance() > 0) || this.props.ActiveCoin.mode === 'basilisk') &&
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ () => this.toggleSendCoinForm(!this.props.ActiveCoin.send) }>
<i className="icon fa-send"></i> { translate('INDEX.SEND') }
</button>
}
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ () => this.toggleSendCoinForm(!this.props.ActiveCoin.send) }
disabled={ ((this.props.ActiveCoin.mode === 'full' || this.props.ActiveCoin.mode === 'native') && this.checkTotalBalance() <= 0) }>
<i className="icon fa-send"></i> { translate('INDEX.SEND') }
</button>
<button
type="button"
className="btn btn-success waves-effect waves-light"

2
react/src/components/login/login.render.js

@ -41,7 +41,7 @@ const LoginRender = function () {
</li>
<li>
<a onClick={ () => this.toggleLoginSettingsDropdownSection('about') }>
<i className="icon fa-users"></i> { translate('INDEX.ABOUT_IGUANA') }
<i className="icon fa-users"></i> { translate('ABOUT.ABOUT_AGAMA') }
</a>
</li>
</ul>

1
react/src/styles/index.scss

@ -42,5 +42,6 @@
@import '../components/dashboard/qrModal/qrModal.scss';
@import '../components/dashboard/coindDownModal/coindDownModal.scss';
@import '../components/dashboard/syncOnly/syncOnly.scss';
@import '../components/dashboard/loginSettingsModal/loginSettingsModal.scss';
@import '../components/toaster/toaster.scss';
@import '~react-table/react-table.css';

3
react/src/translate/en.js

@ -165,7 +165,6 @@ export const _lang = {
'TOGGLE_SEARCH': 'Toggle Search',
'TOGGLE_MENUBAR': 'Toggle menubar',
'SETTINGS': 'Settings',
'ABOUT_IGUANA': 'About Iguana',
'LOGOUT': 'Logout',
'DASHBOARD': 'Dashboard',
'WALLET_SETTINGS': 'Wallet Settings',
@ -293,7 +292,7 @@ export const _lang = {
'It is normal.',
'INPUT_PRIV_KEY': 'Input Private Key',
'IMPORT_PRIV_KEY': 'Import Private Key',
'DEBUG_LOG': 'Debug Log',
'DEBUG_LOG': 'Debug',
'DEBUG_LOG_DESC': 'This section allows you to read last N lines from debug log file.',
'DEBUG_LOG_LINES': 'Input number of lines to read',
'TARGET': 'Target',

Loading…
Cancel
Save