Browse Source

clear and fetch cache data

all-modes
pbca26 8 years ago
parent
commit
dbdea21eaf
  1. 41
      react/src/actions/actionCreators.js
  2. 15
      react/src/components/dashboard/walletsData.js
  3. 1
      react/src/components/dashboard/walletsNotariesList.js
  4. 14
      react/src/index.js

41
react/src/actions/actionCreators.js

@ -1753,6 +1753,47 @@ export function createNewWallet(_passphrase) {
} }
} }
export function deleteCacheFile(_payload) {
return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/groom?', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'filename': _payload.pubkey }),
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'deleteCacheFile', 'Error', 'error'))
})
.then(response => response.json())
.then(json => dispatch(fetchNewCacheData(_payload)));
}
}
export function fetchNewCacheData(_payload) {
const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
const _pubkey = '&pubkey=' + _payload.pubkey;
const _route = _payload.allcoins ? 'cache-all' : 'cache-one';
const _coin = '&coin=' + _payload.coin;
const _calls = '&calls=' + _payload.calls;
return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'fetchNewCacheData', 'Error', 'error'));
})
.then(response => response.json())
.then(json => console.log(json))
}
}
/*function Shepherd_SendPendValue() { /*function Shepherd_SendPendValue() {
Shepherd_SysInfo().then(function(result){ Shepherd_SysInfo().then(function(result){
var ram_data = formatBytes(result.totalmem_bytes) var ram_data = formatBytes(result.totalmem_bytes)

15
react/src/components/dashboard/walletsData.js

@ -8,7 +8,8 @@ import {
toggleDashboardTxInfoModal, toggleDashboardTxInfoModal,
getBasiliskTransactionsList, getBasiliskTransactionsList,
changeMainBasiliskAddress, changeMainBasiliskAddress,
displayNotariesModal displayNotariesModal,
deleteCacheFile
} from '../../actions/actionCreators'; } from '../../actions/actionCreators';
import Store from '../../store'; import Store from '../../store';
@ -41,6 +42,7 @@ class WalletsData extends React.Component {
this.getDexNotariesAction = this.getDexNotariesAction.bind(this); this.getDexNotariesAction = this.getDexNotariesAction.bind(this);
this.openDropMenu = this.openDropMenu.bind(this); this.openDropMenu = this.openDropMenu.bind(this);
this.refreshTxList = this.refreshTxList.bind(this); this.refreshTxList = this.refreshTxList.bind(this);
this.removeAndfetchNewCache = this.removeAndfetchNewCache.bind(this);
socket.on('messages', msg => this.updateSocketsData(msg)); socket.on('messages', msg => this.updateSocketsData(msg));
} }
@ -64,6 +66,15 @@ class WalletsData extends React.Component {
} }
} }
removeAndfetchNewCache() {
Store.dispatch(deleteCacheFile({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': this.props.ActiveCoin.coin,
'calls': 'listtransactions:getbalance',
}));
}
toggleBasiliskActionsMenu() { toggleBasiliskActionsMenu() {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
basiliskActionsMenu: !this.state.basiliskActionsMenu, basiliskActionsMenu: !this.state.basiliskActionsMenu,
@ -374,7 +385,7 @@ class WalletsData extends React.Component {
</a> </a>
</li> </li>
<li data-edexcoin="COIN" role="presentation"> <li data-edexcoin="COIN" role="presentation">
<a className="btn_edexcoin_dashboard_refetchdata" data-edexcoin="COIN" id="btn_edexcoin_dashboard_refetchdata" role="menuitem"> <a className="btn_edexcoin_dashboard_refetchdata" data-edexcoin="COIN" id="btn_edexcoin_dashboard_refetchdata" role="menuitem" onClick={this.removeAndfetchNewCache}>
<i className="icon fa-cloud-download" aria-hidden="true"></i> {translate('INDEX.REFETCH_WALLET_DATA')} <i className="icon fa-cloud-download" aria-hidden="true"></i> {translate('INDEX.REFETCH_WALLET_DATA')}
</a> </a>
</li> </li>

1
react/src/components/dashboard/walletsNotariesList.js

@ -4,6 +4,7 @@ import { secondsToString } from '../../util/time';
import { toggleDashboardTxInfoModal, displayNotariesModal } from '../../actions/actionCreators'; import { toggleDashboardTxInfoModal, displayNotariesModal } from '../../actions/actionCreators';
import Store from '../../store'; import Store from '../../store';
import Tree, { TreeNode } from 'rc-tree'; import Tree, { TreeNode } from 'rc-tree';
import cssAnimation from 'css-animation';
function animate(node, show, done) { function animate(node, show, done) {
let height = node.offsetHeight; let height = node.offsetHeight;

14
react/src/index.js

@ -5,22 +5,8 @@ import { Provider } from 'react-redux';
import store from './store'; import store from './store';
import App from './components/app/app'; import App from './components/app/app';
//import Wallets from './components/wallets/wallets';
//import AtomicExplorer from './components/atomicExplorer/AtomicExplorer';
//import EasyDEX from './components/easyDex/easyDex';
//import Jumblr from './components/jumblr/jumblr';
//import Settings from './components/settings/settings';
//import About from './components/settings/about';
import './styles/index.scss'; import './styles/index.scss';
//<IndexRoute component={Wallets} />
//<Route path="/atomicexplorer" component={AtomicExplorer} />
//<Route path="/easydex" component={EasyDEX} />
//<Route path="/jumblr" component={Jumblr} />
//<Route path="/settings" component={Settings} />
//<Route path="/about" component={About} />
const router = ( const router = (
<Provider store={store}> <Provider store={store}>
<Router history={hashHistory}> <Router history={hashHistory}>

Loading…
Cancel
Save