Browse Source

basilisk refresh btn (wip)

all-modes
pbca26 8 years ago
parent
commit
a9f08f50da
  1. 3
      react/src/actions/actions/basiliskCache.js
  2. 28
      react/src/components/dashboard/walletsBalance/walletsBalance.js
  3. 3
      react/src/components/dashboard/walletsBalance/walletsBalance.render.js
  4. 6
      react/src/components/overrides.scss

3
react/src/actions/actions/basiliskCache.js

@ -67,10 +67,11 @@ export function fetchNewCacheData(_payload) {
_coin = `&coin=${_payload.coin}`,
_calls = `&calls=${_payload.calls}`,
_address = _payload.address ? (`&address=${_payload.address}`) : '',
_skip = _payload.skip ? (`&skip=${_payload.skip}`) : '',
_iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : '';
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_iguanaInstancePort}`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_skip}${_iguanaInstancePort}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

28
react/src/components/dashboard/walletsBalance/walletsBalance.js

@ -1,12 +1,27 @@
import React from 'react';
import { translate } from '../../../translate/translate';
import { fetchNewCacheData } from '../../../actions/actionCreators';
import Store from '../../../store';
import WalletsBalanceRender from './walletsBalance.render';
class WalletsBalance extends React.Component {
constructor(props) {
super(props);
this.state = {
currentAddress: null,
};
this.isFullySynced = this.isFullySynced.bind(this);
this.refreshBalance = this.refreshBalance.bind(this);
}
componentWillReceiveProps(props) {
if (!this.state.currentAddress &&
this.props.ActiveCoin.activeAddress) {
this.setState(Object.assign({}, this.state, {
currentAddress: this.props.ActiveCoin.activeAddress,
}));
}
}
isFullySynced() {
@ -21,6 +36,19 @@ class WalletsBalance extends React.Component {
}
}
refreshBalance() {
if (this.props.ActiveCoin.mode === 'basilisk') {
Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': this.props.ActiveCoin.coin,
'calls': 'getbalance',
'skip': true,
'address': this.state.currentAddress,
}));
}
}
renderBalance(type) {
let _balance = '0';
const _mode = this.props.ActiveCoin.mode;

3
react/src/components/dashboard/walletsBalance/walletsBalance.render.js

@ -26,6 +26,9 @@ const WalletsBalanceRender = function() {
<div className={ this.isNativeMode() ? 'col-lg-3 col-xs-12' : this.isBasiliskMode() ? 'col-lg-4 col-xs-12' : 'col-lg-12 col-xs-12'}>
<div className="widget widget-shadow">
<div className="widget-content">
<i
className="icon fa-refresh manual-balance-refresh"
onClick={ this.refreshBalance }></i>
<div className="padding-20 padding-top-10">
<div className="clearfix">
<div className="pull-left padding-vertical-10">

6
react/src/components/overrides.scss

@ -641,4 +641,10 @@ select{
.backround-gray {
background: #f3f4f5;
}
.manual-balance-refresh {
position: absolute;
right: 4px;
top: 3px;
}
Loading…
Cancel
Save