Browse Source

coind down modal min error threshold

all-modes
pbca26 7 years ago
parent
commit
9feb422edc
  1. 16
      react/src/actions/actions/nativeSyncInfo.js
  2. 5
      react/src/actions/storeType.js
  3. 6
      react/src/components/dashboard/coindDownModal/coindDownModal.js
  4. 10
      react/src/reducers/activeCoin.js
  5. 2
      react/src/translate/en.js

16
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 { import {
triggerToaster, triggerToaster,
getPassthruAgent, getPassthruAgent,
@ -7,6 +10,12 @@ import {
} from '../actionCreators'; } from '../actionCreators';
import Config from '../../config'; import Config from '../../config';
export function nativeGetinfoFailureState() {
return {
type: DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE,
}
}
// TODO: use debug.log instead // TODO: use debug.log instead
export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) {
if (skipRemote) { if (skipRemote) {
@ -156,14 +165,15 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) {
} catch (e) {} } catch (e) {}
if (!_kmdMainPassiveMode) { if (!_kmdMainPassiveMode) {
dispatch( dispatch(nativeGetinfoFailureState());
/* dispatch(
triggerToaster( triggerToaster(
'Komodod is down', 'Komodod is down',
'Critical Error', 'Critical Error',
'error', 'error',
true true
) )
); ); */
} else { } else {
dispatch( dispatch(
triggerToaster( triggerToaster(

5
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_FULL_MODE = 'SYNCING_FULL_MODE';
export const SYNCING_NATIVE_MODE = 'SYNCING_NATIVE_MODE'; export const SYNCING_NATIVE_MODE = 'SYNCING_NATIVE_MODE';
export const ACTIVE_COIN_GET_ADDRESSES = 'ACTIVE_COIN_GET_ADDRESSES'; export const ACTIVE_COIN_GET_ADDRESSES = 'ACTIVE_COIN_GET_ADDRESSES';
export const START_INTERVAL= 'START_INTERVAL'; export const START_INTERVAL = 'START_INTERVAL';
export const STOP_INTERVAL= 'STOP_INTERVAL'; export const STOP_INTERVAL = 'STOP_INTERVAL';
export const DASHBOARD_ACTIVE_SECTION = 'DASHBOARD_ACTIVE_SECTION'; export const DASHBOARD_ACTIVE_SECTION = 'DASHBOARD_ACTIVE_SECTION';
export const DASHBOARD_ACTIVE_TXINFO_MODAL = 'DASHBOARD_ACTIVE_TXINFO_MODAL'; export const DASHBOARD_ACTIVE_TXINFO_MODAL = 'DASHBOARD_ACTIVE_TXINFO_MODAL';
export const DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE = 'DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE'; 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_SENDTO = 'DASHBOARD_ACTIVE_COIN_SENDTO';
export const DASHBOARD_ACTIVE_COIN_GET_CACHE = 'DASHBOARD_ACTIVE_COIN_GET_CACHE'; 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_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_UPDATE = 'DASHBOARD_UPDATE';
export const DASHBOARD_SYNC_ONLY_UPDATE = 'DASHBOARD_SYNC_ONLY_UPDATE'; export const DASHBOARD_SYNC_ONLY_UPDATE = 'DASHBOARD_SYNC_ONLY_UPDATE';
export const VIEW_CACHE_DATA = 'VIEW_CACHE_DATA'; export const VIEW_CACHE_DATA = 'VIEW_CACHE_DATA';

6
react/src/components/dashboard/coindDownModal/coindDownModal.js

@ -5,6 +5,8 @@ import Store from '../../../store';
import CoindDownModalRender from './coindDownModal.render'; import CoindDownModalRender from './coindDownModal.render';
const COIND_DOWN_MODAL_FETCH_FAILURES_THRESHOLD = 5;
class CoindDownModal extends React.Component { class CoindDownModal extends React.Component {
constructor() { constructor() {
super(); super();
@ -42,7 +44,8 @@ class CoindDownModal extends React.Component {
render() { render() {
if (this.state.display && if (this.state.display &&
!this.state.kmdMainPassiveMode) { !this.state.kmdMainPassiveMode &&
this.props.ActiveCoin.getinfoFetchFailures >= COIND_DOWN_MODAL_FETCH_FAILURES_THRESHOLD) {
return CoindDownModalRender.call(this); return CoindDownModalRender.call(this);
} }
@ -55,6 +58,7 @@ const mapStateToProps = (state) => {
ActiveCoin: { ActiveCoin: {
mode: state.ActiveCoin.mode, mode: state.ActiveCoin.mode,
coin: state.ActiveCoin.coin, coin: state.ActiveCoin.coin,
getinfoFetchFailures: state.ActiveCoin.getinfoFetchFailures,
}, },
displayCoindDownModal: state.Dashboard.displayCoindDownModal, displayCoindDownModal: state.Dashboard.displayCoindDownModal,
debugLog: state.Settings.debugLog, debugLog: state.Settings.debugLog,

10
react/src/reducers/activeCoin.js

@ -14,6 +14,7 @@ import {
DASHBOARD_ACTIVE_COIN_GET_CACHE, DASHBOARD_ACTIVE_COIN_GET_CACHE,
DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR, DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR,
DASHBOARD_ACTIVE_ADDRESS, DASHBOARD_ACTIVE_ADDRESS,
DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE,
SYNCING_FULL_MODE, SYNCING_FULL_MODE,
SYNCING_NATIVE_MODE, SYNCING_NATIVE_MODE,
DASHBOARD_UPDATE, DASHBOARD_UPDATE,
@ -39,6 +40,7 @@ export function ActiveCoin(state = {
activeAddress: null, activeAddress: null,
progress: null, progress: null,
rescanInProgress: false, rescanInProgress: false,
getinfoFetchFailures: 0,
}, action) { }, action) {
switch (action.type) { switch (action.type) {
case DASHBOARD_ACTIVE_COIN_CHANGE: case DASHBOARD_ACTIVE_COIN_CHANGE:
@ -223,6 +225,14 @@ export function ActiveCoin(state = {
return { return {
...state, ...state,
progress: action.progress, 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: case DASHBOARD_UPDATE:
if (state.coin === action.coin) { if (state.coin === action.coin) {

2
react/src/translate/en.js

@ -378,7 +378,7 @@ export const _lang = {
'THIS_SCREEN_DOESNT_REFRESH': 'This screen does not auto refresh. ' + '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.', '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': '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_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_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.', 'FEW_SECURITY_NOTES_DESC4': 'Only YOU should know your Jumblr Address. Nobody else.',

Loading…
Cancel
Save