Browse Source

jumblr pause/resume

v0.25
pbca26 7 years ago
parent
commit
16a634253b
  1. 2
      assets/mainWindow/css/loading.css
  2. 2
      assets/mainWindow/js/loading.js
  3. 76
      react/src/actions/actions/jumblr.js
  4. 54
      react/src/components/dashboard/jumblr/jumblr.js
  5. 19
      react/src/components/dashboard/jumblr/jumblr.render.js
  6. 12
      react/src/components/dashboard/jumblr/jumblr.scss

2
assets/mainWindow/css/loading.css

@ -480,7 +480,7 @@ small {
font-size: 14px;
text-align: left;
padding: 10px;
top: 60px;
top: 45px;
left: 40px;
z-index: 1000;
}

2
assets/mainWindow/js/loading.js

@ -295,5 +295,7 @@ function init() {
$('.dropdown-menu.native').css('right', '165px');
$('#nativeOnlyBtnCarret').css('margin-right', '0');
$('#settingsBtn').css('margin', '0');
$('.mode-desc.spv').hide();
$('.mode-desc.native').css('left', '180px');
}
}

76
react/src/actions/actions/jumblr.js

@ -79,6 +79,82 @@ export function setJumblrAddress(coin, type, address) {
});
}
export function pauseJumblr(coin) {
return new Promise((resolve, reject) => {
const payload = {
mode: null,
chain: coin,
cmd: 'jumblr_pause',
params: [],
};
const _fetchConfig = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
};
fetch(
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
.catch((error) => {
console.log(error);
dispatch(
triggerToaster(
'pauseJumblr',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(json => {
resolve(json);
});
});
}
export function resumeJumblr(coin) {
return new Promise((resolve, reject) => {
const payload = {
mode: null,
chain: coin,
cmd: 'jumblr_resume',
params: [],
};
const _fetchConfig = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
};
fetch(
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
.catch((error) => {
console.log(error);
dispatch(
triggerToaster(
'resumeJumblr',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(json => {
resolve(json);
});
});
}
function dumpPrivkey(coin, key) {
return new Promise((resolve, reject) => {
const payload = {

54
react/src/components/dashboard/jumblr/jumblr.js

@ -10,7 +10,9 @@ import {
setJumblrAddress,
importPrivkey,
copyCoinAddress,
copyString
copyString,
resumeJumblr,
pauseJumblr,
} from '../../../actions/actionCreators';
import Store from '../../../store';
import Config from '../../../config';
@ -69,9 +71,59 @@ class Jumblr extends React.Component {
this.copyPassphrase = this.copyPassphrase.bind(this);
this.checkPassphraseValid = this.checkPassphraseValid.bind(this);
this.importJumblrSecretAddress = this.importJumblrSecretAddress.bind(this);
this._pauseJumblr = this._pauseJumblr.bind(this);
this._resumeJumblr = this._resumeJumblr.bind(this);
this.onChange = this.onChange.bind(this);
}
_pauseJumblr() {
pauseJumblr(this.props.ActiveCoin.coin)
.then((json) => {
if (json.error &&
json.error.code) {
Store.dispatch(
triggerToaster(
json.error.message,
'Error',
'error'
)
);
} else if (json.result && json.result.result && json.result.result === 'paused') {
Store.dispatch(
triggerToaster(
'Jumblr paused',
'Jumblr',
'success'
)
);
}
});
}
_resumeJumblr() {
resumeJumblr(this.props.ActiveCoin.coin)
.then((json) => {
if (json.error &&
json.error.code) {
Store.dispatch(
triggerToaster(
json.error.message,
'Error',
'error'
)
);
} else if (json.result && json.result.result && json.result.result === 'resumed') {
Store.dispatch(
triggerToaster(
'Jumblr resumed',
'Jumblr',
'success'
)
);
}
});
}
generateKeys(passphrase) {
if (!passphrase) {
const key = new Bitcoin.ECKey(false).setCompressed(true);

19
react/src/components/dashboard/jumblr/jumblr.render.js

@ -128,6 +128,25 @@ export const JumblrRender = function() {
</span>
</label>
</div>
<div
className="form-group col-lg-3 col-md-3 col-sm-3 col-xs-3"
style={{ padding: 0 }}>
<button
type="button"
className="btn btn-jumblr-warning waves-effect waves-light"
onClick={ this._pauseJumblr }>
<i className="fa fa-pause margin-right-10"></i>
Pause
</button>
<button
type="button"
className="btn btn-success waves-effect waves-light margin-left-20"
onClick={ this._resumeJumblr }>
<i className="fa fa-play margin-right-10"></i>
Resume
</button>
</div>
</div>
<div className="col-xlg-12 col-md-12">

12
react/src/components/dashboard/jumblr/jumblr.scss

@ -89,4 +89,16 @@
padding: 0;
}
}
}
.btn-jumblr-warning {
background: rgba(255, 152, 0, 0.8);
color: #fff;
&:hover,
&:active,
&:focus {
color: #fff;
background: #ff9800;
}
}
Loading…
Cancel
Save