From 7cac689a9530a317237beeba8338b0323aa4a08d Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sun, 10 Sep 2017 17:51:32 +0300 Subject: [PATCH] kmd passive disable daemon down modal; switch toaster message --- react/src/actions/actions/nativeSyncInfo.js | 33 ++++++++++++++----- .../coindDownModal/coindDownModal.js | 17 +++++++++- .../importKeyModal/importKeyModal.js | 2 +- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index 86ffcee..d4689da 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -149,14 +149,31 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) { } else { if (!json && Config.cli.default) { - dispatch( - triggerToaster( - 'Komodod is down', - 'Critical Error', - 'error', - true - ) - ); + let _kmdMainPassiveMode; + + try { + _kmdMainPassiveMode = window.require('electron').remote.getCurrentWindow().kmdMainPassiveMode; + } catch (e) {} + + if (!_kmdMainPassiveMode) { + dispatch( + triggerToaster( + 'Komodod is down', + 'Critical Error', + 'error', + true + ) + ); + } else { + dispatch( + triggerToaster( + 'Please make sure to run komodod manually', + 'Connection error', + 'warning', + true + ) + ); + } if (coin === 'KMD') { dispatch(getDebugLog('komodo', 50)); diff --git a/react/src/components/dashboard/coindDownModal/coindDownModal.js b/react/src/components/dashboard/coindDownModal/coindDownModal.js index f468156..b18fbfb 100644 --- a/react/src/components/dashboard/coindDownModal/coindDownModal.js +++ b/react/src/components/dashboard/coindDownModal/coindDownModal.js @@ -11,6 +11,7 @@ class CoindDownModal extends React.Component { this.state = { display: false, debugLogCrash: null, + kmdMainPassiveMode: false, }; this.dismiss = this.dismiss.bind(this); } @@ -19,6 +20,18 @@ class CoindDownModal extends React.Component { Store.dispatch(toggleCoindDownModal(false)); } + componentWillMount() { + let _kmdMainPassiveMode; + + try { + _kmdMainPassiveMode = window.require('electron').remote.getCurrentWindow().kmdMainPassiveMode; + } catch (e) {} + + this.setState(Object.assign({}, this.state, { + kmdMainPassiveMode: _kmdMainPassiveMode, + })); + } + componentWillReceiveProps(nextProps) { if (this.props.displayCoindDownModal !== nextProps.displayCoindDownModal) { this.setState(Object.assign({}, this.state, { @@ -28,13 +41,15 @@ class CoindDownModal extends React.Component { } render() { - if (this.state.display) { + if (this.state.display && + !this.state.kmdMainPassiveMode) { return CoindDownModalRender.call(this); } return null; } } + const mapStateToProps = (state) => { return { ActiveCoin: { diff --git a/react/src/components/dashboard/importKeyModal/importKeyModal.js b/react/src/components/dashboard/importKeyModal/importKeyModal.js index d4e2014..7244ca4 100755 --- a/react/src/components/dashboard/importKeyModal/importKeyModal.js +++ b/react/src/components/dashboard/importKeyModal/importKeyModal.js @@ -142,7 +142,7 @@ class ImportKeyModal extends React.Component { Store.dispatch(getDashboardUpdateState(null, this.props.ActiveCoin.coin, true)); Store.dispatch( triggerToaster( - 'Address imported. Wallet rescan is in progress. Please wait until it\s finished.', + 'Address imported. Wallet rescan is in progress. Please wait until it is finished.', translate('TOASTR.WALLET_NOTIFICATION'), 'info', false