Browse Source

kmd native progress fix 2

all-modes
pbca26 8 years ago
parent
commit
cea040a99b
  1. 54
      react/src/components/dashboard/walletsProgress/walletsProgress.js

54
react/src/components/dashboard/walletsProgress/walletsProgress.js

@ -62,23 +62,25 @@ class WalletsProgress extends React.Component {
_debugLogLine = this.props.Settings.debugLog; _debugLogLine = this.props.Settings.debugLog;
} }
const temp = _debugLogLine.split(' '); if (_debugLogLine) {
let currentBestChain; const temp = _debugLogLine.split(' ');
let currentProgress; let currentBestChain;
let currentProgress;
for (let i = 0; i < temp.length; i++) {
if (temp[i].indexOf('height=') > -1) { for (let i = 0; i < temp.length; i++) {
currentBestChain = temp[i].replace('height=', ''); if (temp[i].indexOf('height=') > -1) {
} currentBestChain = temp[i].replace('height=', '');
if (temp[i].indexOf('progress=') > -1) { }
currentProgress = Number(temp[i].replace('progress=', '')) * 1000; if (temp[i].indexOf('progress=') > -1) {
currentProgress = Number(temp[i].replace('progress=', '')) * 1000;
}
} }
}
return [ return [
currentBestChain, currentBestChain,
currentProgress currentProgress
]; ];
}
} }
renderSyncPercentagePlaceholder() { renderSyncPercentagePlaceholder() {
@ -87,7 +89,14 @@ class WalletsProgress extends React.Component {
this.props.Dashboard.progress.code && this.props.Dashboard.progress.code &&
this.props.Dashboard.progress.code === -28 && this.props.Dashboard.progress.code === -28 &&
this.props.Settings.debugLog) { this.props.Settings.debugLog) {
return SyncPercentageRender.call(this, this.parseActivatingBestChainProgress()[1].toFixed(2)); const _progress = this.parseActivatingBestChainProgress();
if (_progress &&
_progress[1]) {
return SyncPercentageRender.call(this, _progress[1].toFixed(2));
} else {
return LoadingBlocksRender.call(this);
}
} }
if (this.props.Dashboard.progress && if (this.props.Dashboard.progress &&
@ -167,9 +176,16 @@ class WalletsProgress extends React.Component {
this.props.Dashboard.progress.code && this.props.Dashboard.progress.code &&
this.props.Dashboard.progress.code === -28 && this.props.Dashboard.progress.code === -28 &&
this.props.Settings.debugLog) { this.props.Settings.debugLog) {
return ( const _blocks = this.parseActivatingBestChainProgress();
`: ${this.parseActivatingBestChainProgress()[0]} (current block)`
); if (_blocks &&
_blocks[0]) {
return (
`: ${_blocks[0]} (current block)`
);
} else {
return null;
}
} else { } else {
if (currentProgress) { if (currentProgress) {
return ( return (

Loading…
Cancel
Save