Commit 61972b61 authored by zeroleak's avatar zeroleak
Browse files

System: add resync button

parent c917c41f
......@@ -212,10 +212,10 @@ export default class ConfigPage extends Component<Props> {
<div className="form-group row">
<div className="col-sm-5">
<button type='button' className='btn btn-danger' onClick={this.onResetConfig}><FontAwesomeIcon icon={Icons.faExclamationTriangle} /> Reset {cliService.getResetLabel()}</button>
<button type='button' className='btn btn-danger btn-sm' onClick={this.onResetConfig}><FontAwesomeIcon icon={Icons.faExclamationTriangle} /> Reset {cliService.getResetLabel()}</button>
</div>
<div className="col-sm-5">
<button type="submit" className="btn btn-primary">Save</button>
<button type="submit" className="btn btn-primary">Save &amp; restart</button>
</div>
</div>
</form>
......
......@@ -18,6 +18,7 @@ import LinkExternal from '../components/Utils/LinkExternal';
import { Card } from 'react-bootstrap';
import utils from '../services/utils';
import guiConfig from '../mainProcess/guiConfig';
import walletService from '../services/walletService';
type Props = {};
......@@ -28,6 +29,7 @@ export default class StatusPage extends Component<Props> {
this.onResetConfig = this.onResetConfig.bind(this)
this.onRestartCli = this.onRestartCli.bind(this)
this.onResync = this.onResync.bind(this)
this.cliLogFile = CLI_LOG_FILE
this.cliLogErrorFile = CLI_LOG_ERROR_FILE
......@@ -46,6 +48,12 @@ export default class StatusPage extends Component<Props> {
}
}
onResync() {
if (confirm('This will resync mix counters. Are you sure?')) {
walletService.resync()
}
}
render() {
const cliStatusIcon = cliService.getStatusIcon((icon,text)=><div>{icon} {text}</div>)
......@@ -65,7 +73,7 @@ export default class StatusPage extends Component<Props> {
</Card.Header>
<Card.Body>
<div style={{'float':'right'}}>
<button type='button' className='btn btn-danger' onClick={this.onResetConfig}><FontAwesomeIcon icon={Icons.faExclamationTriangle} /> Reset {cliService.getResetLabel()}</button>
<button type='button' className='btn btn-danger btn-sm' onClick={this.onResetConfig}><FontAwesomeIcon icon={Icons.faExclamationTriangle} /> Reset {cliService.getResetLabel()}</button>
</div>
<div className='row'>
<div className='col-sm-2'>
......@@ -123,8 +131,9 @@ export default class StatusPage extends Component<Props> {
</div>
</Card.Header>
<Card.Body>
<div style={{'float':'right'}}>
<button type='button' className='btn btn-danger' onClick={this.onRestartCli}>Restart CLI</button>
<div className='float-right text-right'>
<button type='button' className='btn btn-primary btn-sm' onClick={this.onRestartCli}>Restart CLI</button>{' '}
{walletService.isReady() && <button type='button' className='btn btn-secondary btn-sm' onClick={this.onResync}>Resync mix counters</button>}
</div>
<div className='row'>
<div className='col-sm-2'>
......
......@@ -87,6 +87,11 @@ class BackendService {
this.fetchBackendAsJson('/rest/cli/restart', 'POST')
, 'cli.restart')
},
resync: () => {
return this.withStatus('CLI', 'Resynchronize', () =>
this.fetchBackend('/rest/cli/resync', 'POST')
, 'cli.resync')
},
getConfig: () => {
return this.withStatus('CLI', 'Fetch configuration', () =>
this.fetchBackendAsJson('/rest/cli/config', 'GET')
......
......@@ -118,6 +118,14 @@ class WalletService {
})
}
resync() {
// resync
backendService.cli.resync()
// fetch updated utxos
return this.fetchState()
}
// deposit
fetchDepositAddress (increment=false) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment