Embed payout settings in worker stats
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 28s
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 28s
This commit is contained in:
@@ -805,38 +805,43 @@ settings methods
|
||||
*/
|
||||
|
||||
function settings_Setup(api, stats) {
|
||||
|
||||
var address = getCurrentAddress(stats.config.coin);
|
||||
if (address){
|
||||
$(`#yourAddress${stats.config.coin}`).val(address);
|
||||
if (address) {
|
||||
if ($(`#yourAddress${stats.config.coin}`).length) {
|
||||
$(`#yourAddress${stats.config.coin}`).val(address);
|
||||
}
|
||||
settings_GetPayoutLevel(api, address, stats);
|
||||
settings_GetEmailAddress(api, address, stats);
|
||||
if ($(`#yourEmail${stats.config.coin}`).length) {
|
||||
settings_GetEmailAddress(api, address, stats);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle click on Set button
|
||||
$(`#payoutSetButton${stats.config.coin}`).click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).val().trim();
|
||||
$(`#payoutSetButton${stats.config.coin}`).off('click').click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).length
|
||||
? $(`#yourAddress${stats.config.coin}`).val().trim()
|
||||
: getCurrentAddress(stats.config.coin);
|
||||
if (!address || address == '') {
|
||||
settings_ShowError('noMinerAddress', 'No miner address specified', '', false);
|
||||
settings_ShowError('noMinerAddress', 'No miner address specified', '', stats);
|
||||
return;
|
||||
}
|
||||
|
||||
var ip = $(`#yourIP${stats.config.coin}`).val().trim();
|
||||
if (!ip || ip == '') {
|
||||
settings_ShowError('noMinerIP', 'No miner IP address specified', '', false);
|
||||
settings_ShowError('noMinerIP', 'No miner IP address specified', '', stats);
|
||||
return;
|
||||
}
|
||||
|
||||
var level = $(`#yourPayoutRate${stats.config.coin}`).val().trim();
|
||||
if (!level || level < 0) {
|
||||
settings_ShowError('noPayoutLevel', 'No payout level specified', '', false);
|
||||
settings_ShowError('noPayoutLevel', 'No payout level specified', '', stats);
|
||||
return;
|
||||
}
|
||||
settings_SetPayoutLevel(api, address, ip, level, stats);
|
||||
});
|
||||
|
||||
// Handle click on Enable button
|
||||
$(`#enableButton${stats.config.coin}`).click(function(){
|
||||
$(`#enableButton${stats.config.coin}`).off('click').click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).val().trim();
|
||||
var ip = $(`#yourIP${stats.config.coin}`).val().trim();
|
||||
var email = $(`#yourEmail${stats.config.coin}`).val();
|
||||
@@ -844,7 +849,7 @@ function settings_Setup(api, stats) {
|
||||
});
|
||||
|
||||
// Handle click on Disable button
|
||||
$(`#disableButton${stats.config.coin}`).click(function(){
|
||||
$(`#disableButton${stats.config.coin}`).off('click').click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).val().trim();
|
||||
var ip = $(`#yourIP${stats.config.coin}`).val().trim();
|
||||
var email = $(`#yourEmail${stats.config.coin}`).val();
|
||||
@@ -2054,7 +2059,8 @@ function workerstats_InitTemplate(ranOnce, addressTimeout, xhrAddressPoll, xhrGe
|
||||
Mustache.parse(template)
|
||||
rendered = Mustache.render(template, {coin:coin, active: 'active'})
|
||||
$('#tab-content').append(rendered)
|
||||
workerstats_Setup(lastStats, api, addressTimeout, xhrAddressPoll, xhrGetPayments)
|
||||
workerstats_Setup(lastStats, api, addressTimeout, xhrAddressPoll, xhrGetPayments)
|
||||
settings_Setup(api, lastStats)
|
||||
}
|
||||
|
||||
if (!ranOnce)
|
||||
|
||||
@@ -92,6 +92,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Settings -->
|
||||
<div class="yourStats{{coin}} push-up-20">
|
||||
<h4><i class="fa fa-sliders"></i> Miner Settings</h4>
|
||||
<div class="card settings-card">
|
||||
<div class="getting-started-inner">
|
||||
<p class="hero-copy-text">These settings apply to the wallet address currently loaded in worker statistics.</p>
|
||||
<div id="action_update_message{{coin}}" role="alert"></div>
|
||||
<div class="row push-down-5">
|
||||
<div class="col-sm-6">
|
||||
<label for="yourIP{{coin}}">Miner IP Address</label>
|
||||
<input class="form-control" id="yourIP{{coin}}" type="text" data-tkey="enterYourMinerIP" placeholder="An IP address your miners use (any)">
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label for="yourPayoutRate{{coin}}"><span data-tkey="minimumPayout">Minimum payout</span></label>
|
||||
<input class="form-control" id="yourPayoutRate{{coin}}" type="number" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="push-up-15">
|
||||
<button class="btn btn-default" type="button" id="payoutSetButton{{coin}}">
|
||||
<i class="fa fa-check"></i> <span data-tkey="set">Set</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Workers -->
|
||||
<h4 class="yourStats{{coin}} yourWorkers{{coin}} push-up-20"><i class="fa fa-server"></i> <span data-tkey="workerStats">Workers Statistics</span></h4>
|
||||
<div class="yourStats{{coin}} yourWorkers{{coin}} card">
|
||||
|
||||
@@ -256,6 +256,20 @@ footer a {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.settings-card label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
color: var(--text-dim);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.settings-card #action_update_message {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.getting-started-inner {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user