From 08589ae17c5451eab15652abeee570aa96fe91b7 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Fri, 15 Sep 2017 21:49:53 +0300 Subject: [PATCH 1/4] rename instantdex to dex --- react/src/translate/en.js | 2 +- react/src/util/coinHelper.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react/src/translate/en.js b/react/src/translate/en.js index 88f1910..99d6cd0 100644 --- a/react/src/translate/en.js +++ b/react/src/translate/en.js @@ -693,7 +693,7 @@ export const _lang = { 'COQUI': 'COQUI (COQUI)', 'CRYPTO': 'CRYPTO (CRYPTO)', 'HODL': 'HODL (HODL)', - 'DEX': 'InstantDEX (DEX)', + 'DEX': 'DEX (DEX)', 'JUMBLR': 'JUMBLR (JUMBLR)', 'KV': 'KV (KV)', 'MGW': 'MultiGateway (MGW)', diff --git a/react/src/util/coinHelper.js b/react/src/util/coinHelper.js index 6c0ad3f..5d582ee 100644 --- a/react/src/util/coinHelper.js +++ b/react/src/util/coinHelper.js @@ -36,7 +36,7 @@ export function getCoinTitle(coin) { break; case 'DEX': coinlogo = 'dex'; - coinname = 'InstantDEX'; + coinname = 'DEX'; break; case 'DOGE': coinlogo = 'dogecoin'; From 9feb422edcd1b6a0c8e645bced01c7c3329e143a Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 16 Sep 2017 09:05:41 +0300 Subject: [PATCH 2/4] coind down modal min error threshold --- react/src/actions/actions/nativeSyncInfo.js | 16 +++++++++++++--- react/src/actions/storeType.js | 5 +++-- .../dashboard/coindDownModal/coindDownModal.js | 6 +++++- react/src/reducers/activeCoin.js | 10 ++++++++++ react/src/translate/en.js | 2 +- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index d4689da..21fcabc 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -1,4 +1,7 @@ -import { SYNCING_NATIVE_MODE } from '../storeType'; +import { + SYNCING_NATIVE_MODE, + DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE +} from '../storeType'; import { triggerToaster, getPassthruAgent, @@ -7,6 +10,12 @@ import { } from '../actionCreators'; import Config from '../../config'; +export function nativeGetinfoFailureState() { + return { + type: DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE, + } +} + // TODO: use debug.log instead export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { if (skipRemote) { @@ -156,14 +165,15 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) { } catch (e) {} if (!_kmdMainPassiveMode) { - dispatch( + dispatch(nativeGetinfoFailureState()); + /* dispatch( triggerToaster( 'Komodod is down', 'Critical Error', 'error', true ) - ); + ); */ } else { dispatch( triggerToaster( diff --git a/react/src/actions/storeType.js b/react/src/actions/storeType.js index 7599e0e..7a7bdfb 100644 --- a/react/src/actions/storeType.js +++ b/react/src/actions/storeType.js @@ -20,8 +20,8 @@ export const BASILISK_CONNECTION = 'BASILISK_CONNECTION'; export const SYNCING_FULL_MODE = 'SYNCING_FULL_MODE'; export const SYNCING_NATIVE_MODE = 'SYNCING_NATIVE_MODE'; export const ACTIVE_COIN_GET_ADDRESSES = 'ACTIVE_COIN_GET_ADDRESSES'; -export const START_INTERVAL= 'START_INTERVAL'; -export const STOP_INTERVAL= 'STOP_INTERVAL'; +export const START_INTERVAL = 'START_INTERVAL'; +export const STOP_INTERVAL = 'STOP_INTERVAL'; export const DASHBOARD_ACTIVE_SECTION = 'DASHBOARD_ACTIVE_SECTION'; export const DASHBOARD_ACTIVE_TXINFO_MODAL = 'DASHBOARD_ACTIVE_TXINFO_MODAL'; export const DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE = 'DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE'; @@ -30,6 +30,7 @@ export const DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS = 'DASHBOARD_ACTIVE_COIN_NATIVE_ export const DASHBOARD_ACTIVE_COIN_SENDTO = 'DASHBOARD_ACTIVE_COIN_SENDTO'; export const DASHBOARD_ACTIVE_COIN_GET_CACHE = 'DASHBOARD_ACTIVE_COIN_GET_CACHE'; export const DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR = 'DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR'; +export const DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE = 'DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE'; export const DASHBOARD_UPDATE = 'DASHBOARD_UPDATE'; export const DASHBOARD_SYNC_ONLY_UPDATE = 'DASHBOARD_SYNC_ONLY_UPDATE'; export const VIEW_CACHE_DATA = 'VIEW_CACHE_DATA'; diff --git a/react/src/components/dashboard/coindDownModal/coindDownModal.js b/react/src/components/dashboard/coindDownModal/coindDownModal.js index b18fbfb..1c5937c 100644 --- a/react/src/components/dashboard/coindDownModal/coindDownModal.js +++ b/react/src/components/dashboard/coindDownModal/coindDownModal.js @@ -5,6 +5,8 @@ import Store from '../../../store'; import CoindDownModalRender from './coindDownModal.render'; +const COIND_DOWN_MODAL_FETCH_FAILURES_THRESHOLD = 5; + class CoindDownModal extends React.Component { constructor() { super(); @@ -42,7 +44,8 @@ class CoindDownModal extends React.Component { render() { if (this.state.display && - !this.state.kmdMainPassiveMode) { + !this.state.kmdMainPassiveMode && + this.props.ActiveCoin.getinfoFetchFailures >= COIND_DOWN_MODAL_FETCH_FAILURES_THRESHOLD) { return CoindDownModalRender.call(this); } @@ -55,6 +58,7 @@ const mapStateToProps = (state) => { ActiveCoin: { mode: state.ActiveCoin.mode, coin: state.ActiveCoin.coin, + getinfoFetchFailures: state.ActiveCoin.getinfoFetchFailures, }, displayCoindDownModal: state.Dashboard.displayCoindDownModal, debugLog: state.Settings.debugLog, diff --git a/react/src/reducers/activeCoin.js b/react/src/reducers/activeCoin.js index 914bc3f..5df873d 100644 --- a/react/src/reducers/activeCoin.js +++ b/react/src/reducers/activeCoin.js @@ -14,6 +14,7 @@ import { DASHBOARD_ACTIVE_COIN_GET_CACHE, DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR, DASHBOARD_ACTIVE_ADDRESS, + DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE, SYNCING_FULL_MODE, SYNCING_NATIVE_MODE, DASHBOARD_UPDATE, @@ -39,6 +40,7 @@ export function ActiveCoin(state = { activeAddress: null, progress: null, rescanInProgress: false, + getinfoFetchFailures: 0, }, action) { switch (action.type) { case DASHBOARD_ACTIVE_COIN_CHANGE: @@ -223,6 +225,14 @@ export function ActiveCoin(state = { return { ...state, progress: action.progress, + getinfoFetchFailures: !action.progress ? state.getinfoFetchFailures + 1 : 0, + }; + case DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE: + console.warn('_getinfoFetchFailures', state.getinfoFetchFailures + 1); + + return { + ...state, + getinfoFetchFailures: state.getinfoFetchFailures + 1, }; case DASHBOARD_UPDATE: if (state.coin === action.coin) { diff --git a/react/src/translate/en.js b/react/src/translate/en.js index 99d6cd0..fc02070 100644 --- a/react/src/translate/en.js +++ b/react/src/translate/en.js @@ -378,7 +378,7 @@ export const _lang = { 'THIS_SCREEN_DOESNT_REFRESH': 'This screen does not auto refresh. ' + 'You will need to hit the Refresh button on the top right corner of the screen to get latest Jumblr data.', 'FEW_SECURITY_NOTES': 'Few Security Notes for your Privacy and Anonymity of funds', - 'FEW_SECURITY_NOTES_DESC1': 'Jumblr addresses addresses are your Private Addresses.', + 'FEW_SECURITY_NOTES_DESC1': 'Jumblr addresses are your Private Addresses.', 'FEW_SECURITY_NOTES_DESC2': 'DO NOT SHARE your Jumblr addresses with anyone.', 'FEW_SECURITY_NOTES_DESC3': 'Jumblr addresses are like YOUR PASSWORD. Keep them safe, secure and hidden.', 'FEW_SECURITY_NOTES_DESC4': 'Only YOU should know your Jumblr Address. Nobody else.', From 32c33cb4e1c65793d2106e2cbb2bb2f00393513d Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 16 Sep 2017 17:37:12 +0300 Subject: [PATCH 3/4] activating best chain progress handling fix --- react/src/actions/actions/nativeSyncInfo.js | 49 +++++++++++++------ .../walletsProgress/walletsProgress.js | 25 +++++++--- .../walletsProgress/walletsProgress.render.js | 5 +- react/src/reducers/activeCoin.js | 2 - 4 files changed, 55 insertions(+), 26 deletions(-) diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index 21fcabc..783fbe5 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -18,6 +18,8 @@ export function nativeGetinfoFailureState() { // TODO: use debug.log instead export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { + let _json = json; + if (skipRemote) { return dispatch => { dispatch(getSyncInfoNativeState(Config.iguanaLessMode ? json.info : json )); @@ -44,11 +46,15 @@ export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { ) );*/ console.warn('remote kmd node fetch failed', true); - dispatch(getSyncInfoNativeState({ remoteKMDNode: null })); + _json = _json.error; + _json['remoteKMDNode'] = null; + dispatch(getSyncInfoNativeState(_json)); }) .then(response => response.json()) .then(json => { - dispatch(getSyncInfoNativeState({ remoteKMDNode: Config.iguanaLessMode ? json.info : json })); + _json = _json.error; + _json['remoteKMDNode'] = json.info; + dispatch(getSyncInfoNativeState(_json)); }) .then(function() { if (!skipDebug) { @@ -60,23 +66,34 @@ export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { } function getSyncInfoNativeState(json, coin, skipDebug, skipRemote) { - if (coin === 'KMD' && - json && - json.error && - json.error.message.indexOf('Activating best') === -1) { - return getSyncInfoNativeKMD(skipDebug, json, skipRemote); + /*if (!json.remoteKMDNode) { + json = { error: { code: -28, message: 'Activating best chain...' } }; + }*/ + + if (json.remoteKMDNode) { + return { + type: SYNCING_NATIVE_MODE, + progress: json, + } } else { - if (json && + if (coin === 'KMD' && + json && json.error && - Config.cli.default) { - return { - type: SYNCING_NATIVE_MODE, - progress: json.error, - } + json.error.message.indexOf('Activating best') > -1) { + return getSyncInfoNativeKMD(skipDebug, json, skipRemote); } else { - return { - type: SYNCING_NATIVE_MODE, - progress: json.result ? json.result : json, + if (json && + json.error && + Config.cli.default) { + return { + type: SYNCING_NATIVE_MODE, + progress: json.error, + } + } else { + return { + type: SYNCING_NATIVE_MODE, + progress: json.result ? json.result : json, + } } } } diff --git a/react/src/components/dashboard/walletsProgress/walletsProgress.js b/react/src/components/dashboard/walletsProgress/walletsProgress.js index 81efe7c..7daaf05 100644 --- a/react/src/components/dashboard/walletsProgress/walletsProgress.js +++ b/react/src/components/dashboard/walletsProgress/walletsProgress.js @@ -107,14 +107,27 @@ class WalletsProgress extends React.Component { } if (temp[i].indexOf('progress=') > -1) { currentProgress = Number(temp[i].replace('progress=', '')) * 1000; - currentProgress = currentProgress >= 100 ? 100 : currentProgress; + if (currentProgress > 100) { + currentProgress = Number(temp[i].replace('progress=', '')) * 100; + } } } - return [ - currentBestChain, - currentProgress - ]; + if (this.props.ActiveCoin.progress.remoteKMDNode && + this.props.ActiveCoin.progress.remoteKMDNode.blocks) { + const longestHeight = this.props.ActiveCoin.progress.remoteKMDNode.blocks; + + return [ + currentBestChain, + currentProgress, + longestHeight + ]; + } else { + return [ + currentBestChain, + currentProgress + ]; + } } } @@ -131,7 +144,7 @@ class WalletsProgress extends React.Component { if (_parseProgress && _parseProgress[1]) { - return SyncPercentageRender.call(this, _parseProgress[1] === 1000 ? 100 : _parseProgress[1].toFixed(2)); + return SyncPercentageRender.call(this, _parseProgress[1].toFixed(2) + '%', _parseProgress[0], _parseProgress[2] ? _parseProgress[2] : null); } else { return LoadingBlocksRender.call(this); } diff --git a/react/src/components/dashboard/walletsProgress/walletsProgress.render.js b/react/src/components/dashboard/walletsProgress/walletsProgress.render.js index c4ce931..a3d6dfe 100644 --- a/react/src/components/dashboard/walletsProgress/walletsProgress.render.js +++ b/react/src/components/dashboard/walletsProgress/walletsProgress.render.js @@ -17,7 +17,7 @@ export const SyncErrorBlocksRender = function() { ); }; -export const SyncPercentageRender = function(syncPercentage) { +export const SyncPercentageRender = function(syncPercentage, currentBlock, maxHeight) { if (this.props.ActiveCoin.rescanInProgress) { return (
); } else { + // if (this.props.ActiveCoin.progress) return (
- { syncPercentage === '100.00%' ? '100%' : syncPercentage } | { this.props.ActiveCoin.progress.blocks } / { this.props.ActiveCoin.progress.longestchain } | { translate('INDEX.CONNECTIONS') }: { this.props.ActiveCoin.progress.connections } + { syncPercentage === '100.00%' ? '100%' : syncPercentage } | { this.props.ActiveCoin.progress.blocks || currentBlock } / { this.props.ActiveCoin.progress.longestchain || maxHeight } | { translate('INDEX.CONNECTIONS') }: { this.props.ActiveCoin.progress.connections }
); } diff --git a/react/src/reducers/activeCoin.js b/react/src/reducers/activeCoin.js index 5df873d..57ee12a 100644 --- a/react/src/reducers/activeCoin.js +++ b/react/src/reducers/activeCoin.js @@ -228,8 +228,6 @@ export function ActiveCoin(state = { getinfoFetchFailures: !action.progress ? state.getinfoFetchFailures + 1 : 0, }; case DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE: - console.warn('_getinfoFetchFailures', state.getinfoFetchFailures + 1); - return { ...state, getinfoFetchFailures: state.getinfoFetchFailures + 1, From 49fb98887c251307147bcb41393cb3c70e67cbe1 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 16 Sep 2017 19:52:25 +0300 Subject: [PATCH 4/4] progress render hide blocks placeholder cond. --- .../dashboard/walletsProgress/walletsProgress.render.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/react/src/components/dashboard/walletsProgress/walletsProgress.render.js b/react/src/components/dashboard/walletsProgress/walletsProgress.render.js index a3d6dfe..96ae9e5 100644 --- a/react/src/components/dashboard/walletsProgress/walletsProgress.render.js +++ b/react/src/components/dashboard/walletsProgress/walletsProgress.render.js @@ -36,12 +36,11 @@ export const SyncPercentageRender = function(syncPercentage, currentBlock, maxHe
); } else { - // if (this.props.ActiveCoin.progress) return (
- { syncPercentage === '100.00%' ? '100%' : syncPercentage } | { this.props.ActiveCoin.progress.blocks || currentBlock } / { this.props.ActiveCoin.progress.longestchain || maxHeight } | { translate('INDEX.CONNECTIONS') }: { this.props.ActiveCoin.progress.connections } + { syncPercentage === '100.00%' ? '100%' : syncPercentage } | { this.props.ActiveCoin.progress.blocks || currentBlock } / { this.props.ActiveCoin.progress.longestchain || maxHeight } | { translate('INDEX.CONNECTIONS') }: { this.props.ActiveCoin.progress.connections }
); }