From 6631f12e10cc6ffcd34544a03e42a4e3ae1031bf Mon Sep 17 00:00:00 2001 From: pbca26 Date: Fri, 14 Jul 2017 21:39:21 +0300 Subject: [PATCH] cli render fix --- .../components/dashboard/settings/settings.js | 27 ++++++++++++++----- .../dashboard/settings/settings.render.js | 2 +- .../walletsProgress/walletsProgress.js | 3 ++- react/src/translate/en.js | 2 ++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/react/src/components/dashboard/settings/settings.js b/react/src/components/dashboard/settings/settings.js index a7aa827..386b3e7 100644 --- a/react/src/components/dashboard/settings/settings.js +++ b/react/src/components/dashboard/settings/settings.js @@ -103,7 +103,7 @@ class Settings extends React.Component { if (this.state.seedInputVisibility) { document.querySelector('#wifkeysPassphraseTextarea').style.height = '1px'; document.querySelector('#wifkeysPassphraseTextarea').style.height = `${(15 + document.querySelector('#wifkeysPassphraseTextarea').scrollHeight)}px`; - } + } }, 100); } @@ -416,11 +416,10 @@ class Settings extends React.Component { } updateInput(e) { - console.log(e.target.name); if (e.target.name === 'wifkeysPassphrase') { // remove any empty chars from the start/end of the string const newValue = e.target.value; - + clearTimeout(this.state.trimPassphraseTimer); const _trimPassphraseTimer = setTimeout(() => { @@ -430,7 +429,7 @@ class Settings extends React.Component { }, 2000); this.resizeLoginTextarea(); - + this.setState({ trimPassphraseTimer: _trimPassphraseTimer, [e.target.name]: newValue, @@ -486,12 +485,26 @@ class Settings extends React.Component { _cliResponseParsed = _cliResponse.result; } - const __cliResponseParsed = _cliResponseParsed.split('\r\n'); + let __cliResponseParsed; + if (_cliResponseParsed.indexOf('\r\n') > -1) { + _cliResponseParsed = _cliResponseParsed.split('\r\n') ; + } else if (_cliResponseParsed.indexOf('\n') > -1) { + __cliResponseParsed = _cliResponseParsed.split('\n') ; + } else { + __cliResponseParsed = _cliResponseParsed; + } + let _items = []; - for (let i = 0; i < __cliResponseParsed.length; i++) { + if (__cliResponseParsed.length) { + for (let i = 0; i < __cliResponseParsed.length; i++) { + _items.push( +
{ typeof __cliResponseParsed[i] === 'object' ? JSON.stringify(__cliResponseParsed[i], null, '\t') : __cliResponseParsed[i] }
+ ); + } + } else { _items.push( -
{ __cliResponseParsed[i] }
+ translate('INDEX.NO_DATA_AVAILABLE') ); } diff --git a/react/src/components/dashboard/settings/settings.render.js b/react/src/components/dashboard/settings/settings.render.js index 319f4dc..9b40e82 100644 --- a/react/src/components/dashboard/settings/settings.render.js +++ b/react/src/components/dashboard/settings/settings.render.js @@ -570,7 +570,7 @@ export const SettingsRender = function() { name="cliCoin" id="settingsCliOptions" onChange={ this.updateInput }> - + { this.renderActiveCoinsList('native') }