From 2d54f8c351a878699c199c6d2fe2581e75a16a5e Mon Sep 17 00:00:00 2001
From: pbca26
Date: Wed, 6 Sep 2017 11:47:23 +0300
Subject: [PATCH 1/3] receive / send comp own props connect
---
.../components/dashboard/jumblr/jumblr.scss | 3 ++
.../dashboard/receiveCoin/receiveCoin.js | 38 +++++++++++++------
.../dashboard/walletsData/walletsData.js | 1 +
.../walletsNativeSend/walletsNativeSend.js | 13 ++++++-
4 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/react/src/components/dashboard/jumblr/jumblr.scss b/react/src/components/dashboard/jumblr/jumblr.scss
index 38953a2..80861e6 100644
--- a/react/src/components/dashboard/jumblr/jumblr.scss
+++ b/react/src/components/dashboard/jumblr/jumblr.scss
@@ -1,4 +1,7 @@
.jumblr {
+ .alert-info {
+ width: 100%;
+ }
p {
width: calc(100% - 100px);
}
diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.js b/react/src/components/dashboard/receiveCoin/receiveCoin.js
index 97d87cc..21b71f6 100644
--- a/react/src/components/dashboard/receiveCoin/receiveCoin.js
+++ b/react/src/components/dashboard/receiveCoin/receiveCoin.js
@@ -217,17 +217,33 @@ class ReceiveCoin extends React.Component {
return null;
}
}
-const mapStateToProps = (state) => {
- return {
- coin: state.ActiveCoin.coin,
- mode: state.ActiveCoin.mode,
- receive: state.ActiveCoin.receive,
- balance: state.ActiveCoin.balance,
- cache: state.ActiveCoin.cache,
- activeSection: state.ActiveCoin.activeSection,
- activeAddress: state.ActiveCoin.activeAddress,
- addresses: state.ActiveCoin.addresses,
- };
+const mapStateToProps = (state, props) => {
+ if (props &&
+ props.activeSection &&
+ props.renderTableOnly) {
+ return {
+ coin: state.ActiveCoin.coin,
+ mode: state.ActiveCoin.mode,
+ receive: state.ActiveCoin.receive,
+ balance: state.ActiveCoin.balance,
+ cache: state.ActiveCoin.cache,
+ activeSection: props.activeSection,
+ activeAddress: state.ActiveCoin.activeAddress,
+ addresses: state.ActiveCoin.addresses,
+ renderTableOnly: props.renderTableOnly,
+ };
+ } else {
+ return {
+ coin: state.ActiveCoin.coin,
+ mode: state.ActiveCoin.mode,
+ receive: state.ActiveCoin.receive,
+ balance: state.ActiveCoin.balance,
+ cache: state.ActiveCoin.cache,
+ activeSection: state.ActiveCoin.activeSection,
+ activeAddress: state.ActiveCoin.activeAddress,
+ addresses: state.ActiveCoin.addresses,
+ };
+ }
};
export default connect(mapStateToProps)(ReceiveCoin);
\ No newline at end of file
diff --git a/react/src/components/dashboard/walletsData/walletsData.js b/react/src/components/dashboard/walletsData/walletsData.js
index 12d5c25..c0975ec 100644
--- a/react/src/components/dashboard/walletsData/walletsData.js
+++ b/react/src/components/dashboard/walletsData/walletsData.js
@@ -335,6 +335,7 @@ class WalletsData extends React.Component {
}
// TODO: clean
+ // TODO: figure out why changing ActiveCoin props doesn't trigger comp update
if (this.props.ActiveCoin.txhistory &&
this.props.ActiveCoin.txhistory !== 'loading' &&
this.props.ActiveCoin.txhistory !== 'no data' &&
diff --git a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
index 7f6a850..567b272 100644
--- a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
+++ b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
@@ -453,8 +453,8 @@ class WalletsNativeSend extends React.Component {
}
}
-const mapStateToProps = (state) => {
- return {
+const mapStateToProps = (state, props) => {
+ let _mappedProps = {
ActiveCoin: {
addresses: state.ActiveCoin.addresses,
coin: state.ActiveCoin.coin,
@@ -464,6 +464,15 @@ const mapStateToProps = (state) => {
activeSection: state.ActiveCoin.activeSection,
},
};
+
+ if (props &&
+ props.activeSection &&
+ props.renderFormOnly) {
+ _mappedProps.ActiveCoin.activeSection = props.activeSection,
+ _mappedProps.renderFormOnly = props.renderFormOnly;
+ }
+
+ return _mappedProps;
};
export default connect(mapStateToProps)(WalletsNativeSend);
From 63ce2063b1fbdaedb04dda0f24371724d4600fb4 Mon Sep 17 00:00:00 2001
From: pbca26
Date: Thu, 7 Sep 2017 16:36:30 +0300
Subject: [PATCH 2/3] settings option to skip full dashboard update in kmd
native
---
assets/mainWindow/css/loading.css | 6 ++-
assets/mainWindow/js/loading.js | 21 +++++++++-
react/src/actions/actionCreators.js | 10 ++++-
react/src/actions/storeType.js | 1 +
.../claimInterestModal.render.js | 42 ++++++++++---------
.../dashboard/coinTile/coinTileItem.js | 5 ++-
.../dashboard/receiveCoin/receiveCoin.js | 38 +++++++----------
.../components/dashboard/settings/settings.js | 33 ++++++++++++++-
.../walletsNativeSend/walletsNativeSend.js | 2 +-
.../walletsNativeSend.render.js | 2 -
react/src/reducers/dashboard.js | 9 +++-
11 files changed, 117 insertions(+), 52 deletions(-)
diff --git a/assets/mainWindow/css/loading.css b/assets/mainWindow/css/loading.css
index a9ce385..50c3a92 100644
--- a/assets/mainWindow/css/loading.css
+++ b/assets/mainWindow/css/loading.css
@@ -33,7 +33,11 @@ body.agamaMode {
background-color: rgba(33, 33, 33, 0.85);
padding-top: 40px;
color: #fff;
- height: 335px;
+ height: 300px;
+}
+
+body.loading-window {
+ height: 355px;
}
body.agama-default-window-height {
diff --git a/assets/mainWindow/js/loading.js b/assets/mainWindow/js/loading.js
index 1522533..e35f48c 100644
--- a/assets/mainWindow/js/loading.js
+++ b/assets/mainWindow/js/loading.js
@@ -182,6 +182,21 @@ function openSettingsWindow() {
window.createAppSettingsWindow();
}
+function startKMDPassive() {
+ const remote = require('electron').remote;
+ const window = remote.getCurrentWindow();
+
+ $('.dropdown-menu').addClass('hide');
+ disableModeButtons();
+
+ window.startKMDNative('KMD', true);
+
+ setTimeout(function() {
+ window.createWindow('open');
+ window.hide();
+ }, 1000);
+}
+
function closeMainWindow(isKmdOnly, isCustom) {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
@@ -193,8 +208,10 @@ function closeMainWindow(isKmdOnly, isCustom) {
window.startKMDNative(isKmdOnly ? 'KMD' : null);
}
- window.createWindow('open');
- window.hide();
+ setTimeout(function() {
+ window.createWindow('open');
+ window.hide();
+ }, 3000);
}
function quitApp() {
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index b278b7d..32d6fed 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -28,7 +28,8 @@ import {
DISPLAY_COIND_DOWN_MODAL,
DISPLAY_CLAIM_INTEREST_MODAL,
START_INTERVAL,
- STOP_INTERVAL
+ STOP_INTERVAL,
+ DASHBOARD_SYNC_ONLY_UPDATE,
} from './storeType';
export * from './actions/nativeSyncInfo';
@@ -341,4 +342,11 @@ export function toggleClaimInterestModal(display) {
type: DISPLAY_CLAIM_INTEREST_MODAL,
displayClaimInterestModal: display,
}
+}
+
+export function skipFullDashboardUpdate(skip) {
+ return {
+ type: DASHBOARD_SYNC_ONLY_UPDATE,
+ skipFullDashboardUpdate: skip,
+ }
}
\ No newline at end of file
diff --git a/react/src/actions/storeType.js b/react/src/actions/storeType.js
index adb9141..f1812ac 100644
--- a/react/src/actions/storeType.js
+++ b/react/src/actions/storeType.js
@@ -31,6 +31,7 @@ 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_MAIN_BASILISK_ADDR = 'DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR';
export const DASHBOARD_UPDATE = 'DASHBOARD_UPDATE';
+export const DASHBOARD_SYNC_ONLY_UPDATE = 'DASHBOARD_SYNC_ONLY_UPDATE';
export const VIEW_CACHE_DATA = 'VIEW_CACHE_DATA';
export const SYNC_ONLY_MODAL_TOGGLE = 'SYNC_ONLY_MODAL_TOGGLE';
export const SYNC_ONLY_DATA = 'SYNC_ONLY_DATA';
diff --git a/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js b/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js
index ea4d0f8..419d603 100644
--- a/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js
+++ b/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js
@@ -46,27 +46,29 @@ export const _ClaimInterestTableRender = function() {
{ translate('CLAIM_INTEREST.TIP') }: { translate('CLAIM_INTEREST.TIP_DESC') }
-
-
+ }
@@ -109,7 +111,7 @@ export const ClaimInterestModalRender = function() {
onClick={ this.closeModal }>
×
- { translate('CLAIM_INTEREST.CLAIM_INTEREST') }
+ { translate('CLAIM_INTEREST.CLAIM_INTEREST', ' ') }
= NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD)) {
Store.dispatch(getSyncInfoNative(coin, true));
- Store.dispatch(getDashboardUpdate(coin, _propsDashboard));
+
+ if (!this.props.Dashboard.skipFullDashboardUpdate) {
+ Store.dispatch(getDashboardUpdate(coin, _propsDashboard));
+ }
} else {
Store.dispatch(getSyncInfoNative(coin));
}
diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.js b/react/src/components/dashboard/receiveCoin/receiveCoin.js
index 21b71f6..4b982e4 100644
--- a/react/src/components/dashboard/receiveCoin/receiveCoin.js
+++ b/react/src/components/dashboard/receiveCoin/receiveCoin.js
@@ -217,33 +217,27 @@ class ReceiveCoin extends React.Component {
return null;
}
}
+
const mapStateToProps = (state, props) => {
+ let _mappedProps = {
+ coin: state.ActiveCoin.coin,
+ mode: state.ActiveCoin.mode,
+ receive: state.ActiveCoin.receive,
+ balance: state.ActiveCoin.balance,
+ cache: state.ActiveCoin.cache,
+ activeSection: state.ActiveCoin.activeSection,
+ activeAddress: state.ActiveCoin.activeAddress,
+ addresses: state.ActiveCoin.addresses,
+ };
+
if (props &&
props.activeSection &&
props.renderTableOnly) {
- return {
- coin: state.ActiveCoin.coin,
- mode: state.ActiveCoin.mode,
- receive: state.ActiveCoin.receive,
- balance: state.ActiveCoin.balance,
- cache: state.ActiveCoin.cache,
- activeSection: props.activeSection,
- activeAddress: state.ActiveCoin.activeAddress,
- addresses: state.ActiveCoin.addresses,
- renderTableOnly: props.renderTableOnly,
- };
- } else {
- return {
- coin: state.ActiveCoin.coin,
- mode: state.ActiveCoin.mode,
- receive: state.ActiveCoin.receive,
- balance: state.ActiveCoin.balance,
- cache: state.ActiveCoin.cache,
- activeSection: state.ActiveCoin.activeSection,
- activeAddress: state.ActiveCoin.activeAddress,
- addresses: state.ActiveCoin.addresses,
- };
+ _mappedProps.ActiveCoin.activeSection = props.activeSection;
+ _mappedProps.renderTableOnly = props.renderTableOnly;
}
+
+ return _mappedProps;
};
export default connect(mapStateToProps)(ReceiveCoin);
\ No newline at end of file
diff --git a/react/src/components/dashboard/settings/settings.js b/react/src/components/dashboard/settings/settings.js
index a44c27d..bb4f501 100644
--- a/react/src/components/dashboard/settings/settings.js
+++ b/react/src/components/dashboard/settings/settings.js
@@ -18,6 +18,7 @@ import {
checkForUpdateUIPromise,
updateUIPromise,
triggerToaster,
+ skipFullDashboardUpdate,
} from '../../../actions/actionCreators';
import Store from '../../../store';
@@ -69,7 +70,6 @@ class Settings extends React.Component {
};
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);
@@ -83,6 +83,11 @@ class Settings extends React.Component {
this._checkForUpdateUIPromise = this._checkForUpdateUIPromise.bind(this);
this._updateUIPromise = this._updateUIPromise.bind(this);
this.updateTabDimensions = this.updateTabDimensions.bind(this);
+ this._skipFullDashboardUpdate = this._skipFullDashboardUpdate.bind(this);
+ }
+
+ _skipFullDashboardUpdate() {
+ Store.dispatch(skipFullDashboardUpdate(!this.props.Dashboard.skipFullDashboardUpdate));
}
updateTabDimensions() {
@@ -615,6 +620,31 @@ class Settings extends React.Component {
}
}
+ items.push(
+
+
+ KMD main sync only
+
+ |
+
+
+
+
+
+
+
+ |
+
+ );
+
return items;
}
@@ -856,6 +886,7 @@ const mapStateToProps = (state) => {
coin: state.ActiveCoin.coin,
},
Settings: state.Settings,
+ Dashboard: state.Dashboard,
};
};
diff --git a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
index 567b272..7efbcf0 100644
--- a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
+++ b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
@@ -468,7 +468,7 @@ const mapStateToProps = (state, props) => {
if (props &&
props.activeSection &&
props.renderFormOnly) {
- _mappedProps.ActiveCoin.activeSection = props.activeSection,
+ _mappedProps.ActiveCoin.activeSection = props.activeSection;
_mappedProps.renderFormOnly = props.renderFormOnly;
}
diff --git a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js
index da79af7..2804eeb 100644
--- a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js
+++ b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js
@@ -35,8 +35,6 @@ export const AddressListRender = function() {
);
};
-// { this.renderAddressByType('public') }
-
export const OASendUIRender = function() {
return (
diff --git a/react/src/reducers/dashboard.js b/react/src/reducers/dashboard.js
index 153cf9c..1bdf115 100644
--- a/react/src/reducers/dashboard.js
+++ b/react/src/reducers/dashboard.js
@@ -4,7 +4,8 @@ import {
VIEW_CACHE_DATA,
TOGGLE_NOTIFICATIONS_MODAL,
DISPLAY_COIND_DOWN_MODAL,
- DISPLAY_CLAIM_INTEREST_MODAL
+ DISPLAY_CLAIM_INTEREST_MODAL,
+ DASHBOARD_SYNC_ONLY_UPDATE
} from '../actions/storeType';
export function Dashboard(state = {
@@ -14,6 +15,7 @@ export function Dashboard(state = {
guiLog: {},
displayCoindDownModal: false,
displayClaimInterestModal: false,
+ skipFullDashboardUpdate: false,
}, action) {
switch (action.type) {
case DASHBOARD_SECTION_CHANGE:
@@ -43,6 +45,11 @@ export function Dashboard(state = {
displayClaimInterestModal: action.displayClaimInterestModal,
};
break;
+ case DASHBOARD_SYNC_ONLY_UPDATE:
+ return {
+ ...state,
+ skipFullDashboardUpdate: action.skipFullDashboardUpdate,
+ };
default:
return state;
}
From e70bd5611019486532b6e5154c525e5b093aa6f2 Mon Sep 17 00:00:00 2001
From: pbca26
Date: Thu, 7 Sep 2017 18:41:30 +0300
Subject: [PATCH 3/3] syncInfo action fix
---
react/src/actions/actions/nativeSyncInfo.js | 74 +++++++++++--------
.../dashboard/coinTile/coinTileItem.js | 4 +-
2 files changed, 45 insertions(+), 33 deletions(-)
diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js
index 30d8540..f718ec3 100644
--- a/react/src/actions/actions/nativeSyncInfo.js
+++ b/react/src/actions/actions/nativeSyncInfo.js
@@ -8,44 +8,54 @@ import {
import Config from '../../config';
// TODO: use debug.log instead
-export function getSyncInfoNativeKMD(skipDebug, json) {
- const coin = 'KMD';
- // https://www.kmd.host/
- return dispatch => {
- return fetch(
- Config.iguanaLessMode ? 'https://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, {
- method: 'GET',
- })
- .catch(function(error) {
- console.log(error);
- /*dispatch(
- triggerToaster(
- 'getSyncInfoNativeKMD',
- 'Error',
- 'error'
- )
- );*/
- console.warn('remote kmd node fetch failed', true);
- dispatch(getSyncInfoNativeState({ remoteKMDNode: null }));
- })
- .then(response => response.json())
- .then(json => {
- dispatch(getSyncInfoNativeState({ remoteKMDNode: Config.iguanaLessMode ? json.info : json }));
- })
- .then(function() {
+export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) {
+ if (skipRemote) {
+ return dispatch => {
+ dispatch(getSyncInfoNativeState(Config.iguanaLessMode ? json.info : json ));
+
if (!skipDebug) {
dispatch(getDebugLog('komodo', 1));
}
- })
+ }
+ } else {
+ const coin = 'KMD';
+ // https://www.kmd.host/
+ return dispatch => {
+ return fetch(
+ Config.iguanaLessMode ? 'https://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, {
+ method: 'GET',
+ })
+ .catch(function(error) {
+ console.log(error);
+ /*dispatch(
+ triggerToaster(
+ 'getSyncInfoNativeKMD',
+ 'Error',
+ 'error'
+ )
+ );*/
+ console.warn('remote kmd node fetch failed', true);
+ dispatch(getSyncInfoNativeState({ remoteKMDNode: null }));
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(getSyncInfoNativeState({ remoteKMDNode: Config.iguanaLessMode ? json.info : json }));
+ })
+ .then(function() {
+ if (!skipDebug) {
+ dispatch(getDebugLog('komodo', 1));
+ }
+ })
+ }
}
}
-function getSyncInfoNativeState(json, coin, skipDebug) {
+function getSyncInfoNativeState(json, coin, skipDebug, skipRemote) {
if (coin === 'KMD' &&
json &&
json.error &&
json.error.message.indexOf('Activating best') === -1) {
- return getSyncInfoNativeKMD(skipDebug, json);
+ return getSyncInfoNativeKMD(skipDebug, json, skipRemote);
} else {
if (json &&
json.error &&
@@ -63,7 +73,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) {
}
}
-export function getSyncInfoNative(coin, skipDebug) {
+export function getSyncInfoNative(coin, skipDebug, skipRemote) {
let payload = {
userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
agent: getPassthruAgent(coin),
@@ -125,7 +135,8 @@ export function getSyncInfoNative(coin, skipDebug) {
id: null
},
coin,
- skipDebug
+ skipDebug,
+ skipRemote
)
);
} else {
@@ -163,7 +174,8 @@ export function getSyncInfoNative(coin, skipDebug) {
getSyncInfoNativeState(
json,
coin,
- skipDebug
+ skipDebug,
+ skipRemote
)
);
}
diff --git a/react/src/components/dashboard/coinTile/coinTileItem.js b/react/src/components/dashboard/coinTile/coinTileItem.js
index 5869fad..42ba80d 100644
--- a/react/src/components/dashboard/coinTile/coinTileItem.js
+++ b/react/src/components/dashboard/coinTile/coinTileItem.js
@@ -85,13 +85,13 @@ class CoinTileItem extends React.Component {
_propsDashboard.progress.longestchain &&
syncPercentage &&
(Config.iguanaLessMode || syncPercentage >= NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD)) {
- Store.dispatch(getSyncInfoNative(coin, true));
+ Store.dispatch(getSyncInfoNative(coin, true, this.props.Dashboard.skipFullDashboardUpdate));
if (!this.props.Dashboard.skipFullDashboardUpdate) {
Store.dispatch(getDashboardUpdate(coin, _propsDashboard));
}
} else {
- Store.dispatch(getSyncInfoNative(coin));
+ Store.dispatch(getSyncInfoNative(coin, null, this.props.Dashboard.skipFullDashboardUpdate));
}
}
if (mode === 'full') {