From b03d830ef2f2660356d1c1757ed4a5e8c9c424fb Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 25 Jul 2017 06:08:37 -0700 Subject: [PATCH 1/5] display debug.log data if komodod is crashed/exited --- react/src/actions/actionCreators.js | 8 ++++ react/src/actions/actions/nativeSyncInfo.js | 7 ++- react/src/actions/storeType.js | 3 +- .../dashboard/coinTile/coinTileItem.js | 3 +- .../coindDownModal/coindDownModal.js | 47 +++++++++++++++++++ .../coindDownModal/coindDownModal.render.js | 46 ++++++++++++++++++ .../dashboard/main/dashboard.render.js | 2 + react/src/components/overrides.scss | 22 +++++++++ react/src/reducers/dashboard.js | 9 +++- 9 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 react/src/components/dashboard/coindDownModal/coindDownModal.js create mode 100644 react/src/components/dashboard/coindDownModal/coindDownModal.render.js diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index 667896d..baf8d37 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -25,6 +25,7 @@ import { DASHBOARD_ACTIVE_COIN_CHANGE, ACTIVE_COIN_GET_ADDRESSES, DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY, + DISPLAY_COIND_DOWN_MODAL, START_INTERVAL, STOP_INTERVAL } from './storeType'; @@ -350,4 +351,11 @@ export function stopInterval(name, intervals) { type: STOP_INTERVAL, name, } +} + +export function toggleCoindDownModal(display) { + return { + type: DISPLAY_COIND_DOWN_MODAL, + displayCoindDownModal: display, + } } \ No newline at end of file diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index fe3b154..ed7c6cb 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -2,7 +2,8 @@ import { SYNCING_NATIVE_MODE } from '../storeType'; import { triggerToaster, getPassthruAgent, - getDebugLog + getDebugLog, + toggleCoindDownModal } from '../actionCreators'; import { logGuiHttp, @@ -157,9 +158,11 @@ export function getSyncInfoNative(coin, skipDebug) { 'Komodod is down', 'Critical Error', 'error', - false + true ) ); + dispatch(getDebugLog('komodo', 50)); + dispatch(toggleCoindDownModal(true)); } else { json = JSON.parse(json); } diff --git a/react/src/actions/storeType.js b/react/src/actions/storeType.js index e38874a..d00021b 100644 --- a/react/src/actions/storeType.js +++ b/react/src/actions/storeType.js @@ -43,4 +43,5 @@ export const DASHBOARD_ACTIVE_ADDRESS = 'DASHBOARD_ACTIVE_ADDRESS'; export const LOAD_APP_INFO = 'LOAD_APP_INFO'; export const LOG_GUI_HTTP = 'LOG_GUI_HTTP'; export const CLI = 'CLI'; -export const LOGOUT = 'LOGOUT'; \ No newline at end of file +export const LOGOUT = 'LOGOUT'; +export const DISPLAY_COIND_DOWN_MODAL = 'DISPLAY_COIND_DOWN_MODAL'; \ No newline at end of file diff --git a/react/src/components/dashboard/coinTile/coinTileItem.js b/react/src/components/dashboard/coinTile/coinTileItem.js index 70960f4..89ba633 100644 --- a/react/src/components/dashboard/coinTile/coinTileItem.js +++ b/react/src/components/dashboard/coinTile/coinTileItem.js @@ -46,7 +46,8 @@ class CoinTileItem extends React.Component { const _propsDashboard = this.props.Dashboard; const syncPercentage = _propsDashboard && _propsDashboard.progress && (parseFloat(parseInt(_propsDashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2)).replace('NaN', 0); - if (syncPercentage < 100) { + if (syncPercentage < 100 && + !this.props.Dashboard.displayCoindDownModal) { Store.dispatch(getDebugLog('komodo', 10)); } if (_propsDashboard.progress && diff --git a/react/src/components/dashboard/coindDownModal/coindDownModal.js b/react/src/components/dashboard/coindDownModal/coindDownModal.js new file mode 100644 index 0000000..7d082a2 --- /dev/null +++ b/react/src/components/dashboard/coindDownModal/coindDownModal.js @@ -0,0 +1,47 @@ +import React from 'react'; +import { toggleCoindDownModal } from '../../../actions/actionCreators'; +import Store from '../../../store'; + +import CoindDownModalRender from './coindDownModal.render'; + +class CoindDownModal extends React.Component { + constructor(props) { + super(props); + this.state = { + display: false, + debugLogCrash: null, + }; + this.dismiss = this.dismiss.bind(this); + } + + dismiss() { + Store.dispatch(toggleCoindDownModal(false)); + } + + componentWillReceiveProps(props) { + const coindDownModalProps = props ? props.Dashboard : null; + + if (coindDownModalProps && + coindDownModalProps.displayCoindDownModal !== this.state.display) { + this.setState(Object.assign({}, this.state, { + display: coindDownModalProps.displayCoindDownModal, + })); + + setTimeout(() => { + this.setState(Object.assign({}, this.state, { + display: coindDownModalProps.displayCoindDownModal, + })); + }, 100); + } + } + + render() { + if (this.state.display) { + return CoindDownModalRender.call(this); + } + + return null; + } +} + +export default CoindDownModal; diff --git a/react/src/components/dashboard/coindDownModal/coindDownModal.render.js b/react/src/components/dashboard/coindDownModal/coindDownModal.render.js new file mode 100644 index 0000000..548e661 --- /dev/null +++ b/react/src/components/dashboard/coindDownModal/coindDownModal.render.js @@ -0,0 +1,46 @@ +import React from 'react'; +import { translate } from '../../../translate/translate'; + +const CoindDownModalRender = function () { + return ( +
+
+
+
+
+ +

Komodod is down!

+
+
+
+
+ Debug.log (last 50 lines) +
+ +
+ +
+
+
+
+
+
+
+
+ ); +}; + +export default CoindDownModalRender; \ No newline at end of file diff --git a/react/src/components/dashboard/main/dashboard.render.js b/react/src/components/dashboard/main/dashboard.render.js index 0d201a2..89ae040 100644 --- a/react/src/components/dashboard/main/dashboard.render.js +++ b/react/src/components/dashboard/main/dashboard.render.js @@ -15,6 +15,7 @@ import ReceiveCoin from '../receiveCoin/receiveCoin'; import About from '../about/about'; import WalletsNative from '../walletsNative/walletsNative'; import WalletsTxInfo from '../walletsTxInfo/walletsTxInfo'; +import CoindDownModal from '../coindDownModal/coindDownModal'; const DashboardRender = function() { return ( @@ -23,6 +24,7 @@ const DashboardRender = function() { className={ this.isSectionActive('wallets') ? 'page-main' : '' } id="section-dashboard"> +
diff --git a/react/src/components/overrides.scss b/react/src/components/overrides.scss index 5a16904..a7d18ea 100644 --- a/react/src/components/overrides.scss +++ b/react/src/components/overrides.scss @@ -615,4 +615,26 @@ select{ margin-left: 10px; margin-top: -2px; } +} + +.clipboard-edexaddr { + margin-left: 10px; +} + +.coind-down-modal { + .modal-body { + height: 60vh; + + > div { + height: 100%; + } + .page-content { + width: 90%; + height: 100%; + + textarea { + min-height: 200px; + } + } + } } \ No newline at end of file diff --git a/react/src/reducers/dashboard.js b/react/src/reducers/dashboard.js index a57c8a2..98df82e 100644 --- a/react/src/reducers/dashboard.js +++ b/react/src/reducers/dashboard.js @@ -8,7 +8,8 @@ import { DASHBOARD_CONNECT_NOTARIES, VIEW_CACHE_DATA, LOG_GUI_HTTP, - TOGGLE_NOTIFICATIONS_MODAL + TOGGLE_NOTIFICATIONS_MODAL, + DISPLAY_COIND_DOWN_MODAL } from '../actions/storeType'; const HTTP_STACK_MAX_ENTRIES = 150; // limit stack mem length to N records per type @@ -36,6 +37,7 @@ export function Dashboard(state = { failedToConnectNodes: null, }, guiLog: {}, + displayCoindDownModal: false, }, action) { switch (action.type) { case DASHBOARD_SECTION_CHANGE: @@ -97,6 +99,11 @@ export function Dashboard(state = { return Object.assign({}, state, { guiLog: newLogState, }); + case DISPLAY_COIND_DOWN_MODAL: + return Object.assign({}, state, { + displayCoindDownModal: action.displayCoindDownModal, + }); + break; default: return state; } From b672b5914ea608b79a3cbbad3ac4625ad02500af Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 25 Jul 2017 07:05:39 -0700 Subject: [PATCH 2/5] gray background height fix --- react/src/components/dashboard/atomic/atomic.render.js | 2 +- react/src/components/dashboard/coinTile/coinTileItem.js | 3 ++- react/src/components/dashboard/main/dashboard.render.js | 2 +- .../components/dashboard/walletsData/walletsData.render.js | 2 +- react/src/components/overrides.scss | 4 ++++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/react/src/components/dashboard/atomic/atomic.render.js b/react/src/components/dashboard/atomic/atomic.render.js index 7de3c3c..d15343f 100644 --- a/react/src/components/dashboard/atomic/atomic.render.js +++ b/react/src/components/dashboard/atomic/atomic.render.js @@ -7,7 +7,7 @@ import AddCoinOptionsACFiat from '../../addcoin/addcoinOptionsACFiat'; const AtomicRender = function () { return ( -
+
diff --git a/react/src/components/dashboard/coinTile/coinTileItem.js b/react/src/components/dashboard/coinTile/coinTileItem.js index 89ba633..3e41952 100644 --- a/react/src/components/dashboard/coinTile/coinTileItem.js +++ b/react/src/components/dashboard/coinTile/coinTileItem.js @@ -50,7 +50,8 @@ class CoinTileItem extends React.Component { !this.props.Dashboard.displayCoindDownModal) { Store.dispatch(getDebugLog('komodo', 10)); } - if (_propsDashboard.progress && + if (!this.props.Dashboard.displayCoindDownModal && + _propsDashboard.progress && _propsDashboard.progress.blocks && _propsDashboard.progress.longestchain && syncPercentage && diff --git a/react/src/components/dashboard/main/dashboard.render.js b/react/src/components/dashboard/main/dashboard.render.js index 89ae040..580f60e 100644 --- a/react/src/components/dashboard/main/dashboard.render.js +++ b/react/src/components/dashboard/main/dashboard.render.js @@ -39,7 +39,7 @@ const DashboardRender = function() {
-
+
diff --git a/react/src/components/dashboard/walletsData/walletsData.render.js b/react/src/components/dashboard/walletsData/walletsData.render.js index d3afe4a..d304d3f 100644 --- a/react/src/components/dashboard/walletsData/walletsData.render.js +++ b/react/src/components/dashboard/walletsData/walletsData.render.js @@ -144,7 +144,7 @@ export const WalletsDataRender = function() {
-
+
diff --git a/react/src/components/overrides.scss b/react/src/components/overrides.scss index a7d18ea..55cd8a3 100644 --- a/react/src/components/overrides.scss +++ b/react/src/components/overrides.scss @@ -637,4 +637,8 @@ select{ } } } +} + +.backround-gray { + background: #f3f4f5; } \ No newline at end of file From 7360cf0e370b874a7432bf13378ea0e84198db89 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 25 Jul 2017 12:32:02 -0700 Subject: [PATCH 3/5] round values --- .../walletsBalance/walletsBalance.render.js | 26 +++++++++++++------ .../dashboard/walletsData/walletsData.js | 7 ++++- .../walletsData/walletsData.render.js | 9 ++++++- .../walletsTxInfo/walletsTxInfo.render.js | 4 ++- react/src/config.js | 1 + 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/react/src/components/dashboard/walletsBalance/walletsBalance.render.js b/react/src/components/dashboard/walletsBalance/walletsBalance.render.js index 1ccd9af..5a97998 100644 --- a/react/src/components/dashboard/walletsBalance/walletsBalance.render.js +++ b/react/src/components/dashboard/walletsBalance/walletsBalance.render.js @@ -1,5 +1,7 @@ import React from 'react'; import { translate } from '../../../translate/translate'; +import { formatValue } from '../../../util/formatValue'; +import Config from '../../../config'; const WalletsBalanceRender = function() { return ( @@ -30,12 +32,14 @@ const WalletsBalanceRender = function() { { this.isNativeMode() ? translate('INDEX.TRANSPARENT_BALANCE') : translate('INDEX.BALANCE') }
- + { this.isNativeMode() ? this.props.ActiveCoin.balance.transparent ? this.props.ActiveCoin.balance.transparent : '-' : - { this.renderBalance('main') } { this.props.ActiveCoin.coin } + { Config.roundValues ? formatValue('round', this.renderBalance('main'), -6) : this.renderBalance('main') } { this.props.ActiveCoin.coin } } @@ -54,8 +58,10 @@ const WalletsBalanceRender = function() { { translate('INDEX.Z_BALANCE') }
- - { this.props.ActiveCoin.balance.private ? this.props.ActiveCoin.balance.private : '-' } + + { this.props.ActiveCoin.balance.private ? (Config.roundValues ? formatValue('round', this.props.ActiveCoin.balance.private, -6) : this.props.ActiveCoin.balance.private) : '-' }
@@ -73,13 +79,15 @@ const WalletsBalanceRender = function() { { translate('INDEX.INTEREST_EARNED') }
- + { this.isNativeMode() ? this.props.Dashboard.progress && this.props.Dashboard.progress.interest ? this.props.Dashboard.progress.interest : '-' : - {this.renderBalance('interest')} {this.props.ActiveCoin.coin} + { Config.roundValues ? formatValue('round', this.renderBalance('interest'), -6) : this.renderBalance('interest') } { this.props.ActiveCoin.coin } } @@ -99,12 +107,14 @@ const WalletsBalanceRender = function() { { translate('INDEX.TOTAL_BALANCE') }
- + { this.isNativeMode() ? this.props.ActiveCoin.balance.total ? this.props.ActiveCoin.balance.total : '-' : - { this.renderBalance('total') } { this.props.ActiveCoin.coin } + { Config.roundValues ? formatValue('round', this.renderBalance('total'), -6) : this.renderBalance('total') } { this.props.ActiveCoin.coin } } diff --git a/react/src/components/dashboard/walletsData/walletsData.js b/react/src/components/dashboard/walletsData/walletsData.js index a0527b1..2dffcd5 100644 --- a/react/src/components/dashboard/walletsData/walletsData.js +++ b/react/src/components/dashboard/walletsData/walletsData.js @@ -1,6 +1,7 @@ import React from 'react'; import { translate } from '../../../translate/translate'; import { sortByDate } from '../../../util/sort'; +import { formatValue } from '../../../util/formatValue'; import Config from '../../../config'; import { basiliskRefresh, @@ -448,6 +449,8 @@ class WalletsData extends React.Component { _amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; } + _amount = formatValue('round', _amount, -6); + items.push(
  • this.updateAddressSelection(address, type, _amount) }> @@ -484,7 +487,9 @@ class WalletsData extends React.Component { return _addresses.public[i].amount; } else { const address = _addresses.public[i].address; - const _amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; + let _amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; + + _amount = formatValue('round', _amount, -6); return _amount; } diff --git a/react/src/components/dashboard/walletsData/walletsData.render.js b/react/src/components/dashboard/walletsData/walletsData.render.js index d304d3f..f7e6fbb 100644 --- a/react/src/components/dashboard/walletsData/walletsData.render.js +++ b/react/src/components/dashboard/walletsData/walletsData.render.js @@ -5,6 +5,8 @@ import WalletsBasiliskConnection from '../walletsBasiliskConnection/walletsBasil import WalletsNotariesList from '../walletsNotariesList/walletsNotariesList'; import WalletsCacheData from '../walletsCacheData/walletsCacheData'; import { secondsToString } from '../../../util/time'; +import { formatValue } from '../../../util/formatValue'; +import Config from '../../../config'; // TODO: clean basilisk dropdown menu @@ -87,7 +89,12 @@ export const TxHistoryListRender = function(tx, index) { } { this.renderTxType(tx.category || tx.type) } { tx.confirmations } - { tx.amount || translate('DASHBOARD.UNKNOWN') } + { Config.roundValues && + { formatValue('round', tx.amount, -6) || translate('DASHBOARD.UNKNOWN') } + } + { !Config.roundValues && + { tx.amount || translate('DASHBOARD.UNKNOWN') } + } { secondsToString(tx.blocktime || tx.timestamp || tx.time) } { tx.address } { this.renderAddress(tx) } diff --git a/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js b/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js index bd7ea05..7b9643b 100644 --- a/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js +++ b/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js @@ -1,6 +1,8 @@ import React from 'react'; import { translate } from '../../../translate/translate'; import { secondsToString } from '../../../util/time'; +import { formatValue } from '../../../util/formatValue'; +import Config from '../../../config'; const WalletsTxInfoRender = function(txInfo) { return ( @@ -55,7 +57,7 @@ const WalletsTxInfoRender = function(txInfo) { { translate('TX_INFO.AMOUNT') } - { txInfo.amount } + { Config.roundValues ? formatValue('round', txInfo.amount, -10) : txInfo.amount } diff --git a/react/src/config.js b/react/src/config.js index c8c7a8e..858ceb0 100644 --- a/react/src/config.js +++ b/react/src/config.js @@ -12,6 +12,7 @@ let _config = { default: true }, iguanaLessMode: true, + roundValues: true, }; try { From a7e6cd1917ed7a45f74b167c9872d9616da9b231 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 25 Jul 2017 13:25:07 -0700 Subject: [PATCH 4/5] addcoin modal multi ui reflow fix --- react/change.log | 3 +++ .../src/components/addcoin/addcoin.render.js | 4 ++-- react/src/components/addcoin/addcoin.scss | 2 +- .../addcoin/coin-selectors.render.js | 24 ++++++++++++++++--- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/react/change.log b/react/change.log index 983003c..534043b 100644 --- a/react/change.log +++ b/react/change.log @@ -7,6 +7,9 @@ UI: - fixed logout bug - minor placeholders fixes - hide address dropdown if wallet has only one address +- komodod crash report modal +- values rounding (up to 6 decimals) +- add coin multi ui reflow fix v0.2.0.21a-beta -------------- diff --git a/react/src/components/addcoin/addcoin.render.js b/react/src/components/addcoin/addcoin.render.js index 1e56a08..110ab88 100644 --- a/react/src/components/addcoin/addcoin.render.js +++ b/react/src/components/addcoin/addcoin.render.js @@ -42,7 +42,7 @@ const AddCoinRender = function() { { this.renderCoinSelectors() } -
    +
    -
    +