diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index e721fdb..14d83a3 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -268,7 +268,28 @@ function logoutState(json, dispatch) {
export function logout() {
return dispatch => {
- dispatch(logoutState());
+ dispatch(walletLock());
+ }
+}
+
+function walletLock() {
+ const payload = {
+ 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
+ 'agent': 'bitcoinrpc',
+ 'method': 'walletlock',
+ };
+
+ return dispatch => {
+ return fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
+ method: 'POST',
+ body: JSON.stringify(payload),
+ })
+ .catch(function(error) {
+ console.log(error);
+ dispatch(triggerToaster(true, 'walletLock', 'Error', 'error'));
+ })
+ .then(response => response.json())
+ .then(json => dispatch(logoutState(json)))
}
}
@@ -2501,14 +2522,14 @@ export function saveAppConfig(_payload) {
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify(_payload),
+ body: JSON.stringify({ 'payload': _payload }),
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'saveAppConfig', 'Error', 'error'));
})
.then(response => response.json())
- .then(json => dispatch(getAppConfigState(json)))
+ .then(json => dispatch(getAppConfig()))
}
}
diff --git a/react/src/components/addcoin/addcoin.js b/react/src/components/addcoin/addcoin.js
index 1761764..4f55e92 100644
--- a/react/src/components/addcoin/addcoin.js
+++ b/react/src/components/addcoin/addcoin.js
@@ -4,7 +4,8 @@ import {
addCoin,
toggleAddcoinModal,
shepherdGetCoinList,
- shepherdPostCoinList
+ shepherdPostCoinList,
+ triggerToaster
} from '../../actions/actionCreators';
import Store from '../../store';
import AddCoinOptionsCrypto from './addcoinOptionsCrypto';
@@ -55,10 +56,14 @@ class AddCoin extends React.Component {
loadCoinSelection() {
shepherdGetCoinList()
.then(function(json) {
- this.setState(Object.assign({}, this.state, {
- coins: json.result,
- actionsMenu: false,
- }));
+ if (json.msg !== 'error') {
+ this.setState(Object.assign({}, this.state, {
+ coins: json.result,
+ actionsMenu: false,
+ }));
+ } else {
+ Store.dispatch(triggerToaster(true, 'Local coin list is not found', 'Coin Selection', 'info'));
+ }
}.bind(this));
}
@@ -121,7 +126,7 @@ class AddCoin extends React.Component {
}
this.setState(Object.assign({}, this.state, {
- coins: _coins
+ coins: _coins,
}));
}
@@ -159,6 +164,11 @@ class AddCoin extends React.Component {
this.state.coins[0].mode,
this.state.coins[0].syncOnly
));
+
+ this.removeCoin();
+ this.addNewItem();
+
+ Store.dispatch(toggleAddcoinModal(false, false));
}
dismiss() {
@@ -199,7 +209,18 @@ class AddCoin extends React.Component {
_item.mode,
_item.syncOnly
));
- }, 2000 * i);
+
+ if (i === this.state.coins.length - 1) {
+ let _coins = [];
+ _coins.push(this.state.defaultCoinState);
+
+ this.setState(Object.assign({}, this.state, {
+ coins: _coins,
+ }));
+
+ Store.dispatch(toggleAddcoinModal(false, false));
+ }
+ }.bind(this), 2000 * i);
}
}
diff --git a/react/src/components/addcoin/payload.js b/react/src/components/addcoin/payload.js
index 5268cc1..51f41d2 100644
--- a/react/src/components/addcoin/payload.js
+++ b/react/src/components/addcoin/payload.js
@@ -132,7 +132,7 @@ export function checkCoinType(coin) {
export function startCrypto(confpath, coin, mode) {
var tmpinternval = 0,
AddCoinData = {},
- tmpPendValue = 4, // TODO: hook up to shepherd sysinfo
+ tmpPendValue = 1, // TODO: hook up to shepherd sysinfo
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') {
@@ -174,7 +174,7 @@ export function startCrypto(confpath, coin, mode) {
export function startCurrencyAssetChain(confpath, coin, mode) {
var AddCoinDataPayload = {},
- tmpPendValue,
+ tmpPendValue = 1,
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') {
diff --git a/react/src/components/dashboard/atomic.js b/react/src/components/dashboard/atomic.js
index a532f7e..5036aad 100644
--- a/react/src/components/dashboard/atomic.js
+++ b/react/src/components/dashboard/atomic.js
@@ -6,6 +6,10 @@ import AddCoinOptionsCrypto from '../addcoin/addcoinOptionsCrypto';
import AddCoinOptionsAC from '../addcoin/addcoinOptionsAC';
import AddCoinOptionsACFiat from '../addcoin/addcoinOptionsACFiat';
+/*
+ TODO:
+ pre-select active coin
+*/
class Atomic extends React.Component {
constructor(props) {
super(props);
@@ -41,7 +45,7 @@ class Atomic extends React.Component {
getAtomicData() {
const tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
- var ExplorerInputData;
+ let ExplorerInputData;
switch (this.state.api) {
case 'history':
diff --git a/react/src/components/dashboard/jumblr.js b/react/src/components/dashboard/jumblr.js
index 460ec59..e2e20db 100644
--- a/react/src/components/dashboard/jumblr.js
+++ b/react/src/components/dashboard/jumblr.js
@@ -17,6 +17,17 @@ class Jumblr extends React.Component {
}));
}
+ renderLB(_translationID) {
+ const _translationComponents = translate(_translationID).split('
');
+
+ return _translationComponents.map((_translation) =>
+
+ {_translation}
+
+
+ );
+ }
+
render() {
return (
{translate('JUMBLR.EG')}
+{this.renderLB('JUMBLR.EG')}
{translate('JUMBLR.93_KMD')}
{translate('JUMBLR.TO_CLEAR_THEM')}
{translate('JUMBLR.WHEN_IT_TOTALS')}
diff --git a/react/src/components/dashboard/navbar.js b/react/src/components/dashboard/navbar.js index 42e7dea..9ef399f 100644 --- a/react/src/components/dashboard/navbar.js +++ b/react/src/components/dashboard/navbar.js @@ -1,6 +1,11 @@ import React from 'react'; import { translate } from '../../translate/translate'; -import { dashboardChangeSection, toggleAddcoinModal, logout } from '../../actions/actionCreators'; +import { + dashboardChangeSection, + toggleAddcoinModal, + logout, + stopInterval +} from '../../actions/actionCreators'; import Store from '../../store'; class Navbar extends React.Component { @@ -28,6 +33,8 @@ class Navbar extends React.Component { } logout() { + Store.dispatch(stopInterval('sync', this.props.Interval.interval)); + Store.dispatch(stopInterval('basilisk', this.props.Interval.interval)); Store.dispatch(logout()); } @@ -82,14 +89,14 @@ class Navbar extends React.Component {{translate('INDEX.KEY')} | diff --git a/react/src/components/dashboard/settings.js b/react/src/components/dashboard/settings.js index 8c123bc..256f364 100644 --- a/react/src/components/dashboard/settings.js +++ b/react/src/components/dashboard/settings.js @@ -20,9 +20,9 @@ import AddCoinOptionsACFiat from '../addcoin/addcoinOptionsACFiat'; /* TODO: 1) pre-select active coin in add node tab - 2) add agama config section - 3) add fiat section - 4) kickstart section + 2) add fiat section + 3) kickstart section + 4) batch export/import wallet addresses */ class Settings extends React.Component { constructor(props) { @@ -32,16 +32,18 @@ class Settings extends React.Component { debugLinesCount: 10, debugTarget: 'iguana', activeTabHeight: '10px', - appSettings: [], + appSettings: {}, }; this.exportWifKeys = this.exportWifKeys.bind(this); this.updateInput = this.updateInput.bind(this); + this.updateInputSettings = this.updateInputSettings.bind(this); this.importWifKey = this.importWifKey.bind(this); this.readDebugLog = this.readDebugLog.bind(this); this.checkNodes = this.checkNodes.bind(this); this.addNode = this.addNode.bind(this); this.renderPeersList = this.renderPeersList.bind(this); this.renderSNPeersList = this.renderSNPeersList.bind(this); + this._saveAppConfig = this._saveAppConfig.bind(this); } componentDidMount() { @@ -50,10 +52,6 @@ class Settings extends React.Component { Store.dispatch(getAppInfo()); } - _saveAppConfig() { - Store.dispatch(saveAppConfig); - } - openTab(elemId, tab) { const _height = document.querySelector('#' + elemId + ' .panel-collapse .panel-body').offsetHeight; @@ -201,13 +199,42 @@ class Settings extends React.Component { } } + updateInputSettings(e) { + let _appSettings = this.state.appSettings; + _appSettings[e.target.name] = e.target.value; + + this.setState({ + appSettings: _appSettings, + }); + + console.log(this.state.appSettings); + } + + _saveAppConfig() { + const _appSettings = this.state.appSettings; + let _appSettingsPristine = Object.assign({}, this.props.Settings.appSettings); + + for (let key in _appSettings) { + if (key.indexOf('__') === -1) { + _appSettingsPristine[key] = _appSettings[key]; + // console.log('key changed: ' + key + ', value: ' + _appSettings[key]); + } else { + const _nestedKey = key.split('__'); + _appSettingsPristine[_nestedKey[0]][_nestedKey[1]] = _appSettings[key]; + // console.log('key changed: ' + _nestedKey[0] + '.' + _nestedKey[1] + ', value: ' + _appSettings[key]); + } + } + + // console.log('changed settings obj', _appSettingsPristine); + Store.dispatch(saveAppConfig(_appSettingsPristine)); + } + renderConfigEditForm() { - console.log(this.props.Settings.appSettings); let items = []; const _appConfig = this.props.Settings.appSettings; - for (let key in this.props.Settings.appSettings) { - if (Object.keys(this.props.Settings.appSettings[key]).length && key !== 'host') { + for (let key in _appConfig) { + if (typeof _appConfig[key] === 'object') { items.push(|
---|---|
@@ -217,14 +244,14 @@ class Settings extends React.Component { | |
{_key} | - + | - + | ); @@ -252,19 +279,30 @@ class Settings extends React.Component { }); } + renderLB(_translationID) { + const _translationComponents = translate(_translationID).split('