|
|
@ -18,13 +18,13 @@ $(function() { |
|
|
|
minerIndex++; |
|
|
|
var workerstat = stats.pools[pool].miners[addr]; |
|
|
|
sharesTotal += parseFloat(workerstat.shares); |
|
|
|
var existingRow = document.querySelector('#workers' + pool + ' #worker' + minerIndex); |
|
|
|
var existingRow = document.querySelector('#workers' + pool + ' #miner-' + minerIndex); |
|
|
|
var minerEfficiency = ( workerstat.shares > 0 ) ? Math.floor(10000 * workerstat.shares / (workerstat.shares + workerstat.invalidshares)) / 100 : 0; |
|
|
|
|
|
|
|
if (existingRow == null) { |
|
|
|
//Add new
|
|
|
|
var insertMinerTr = document.createElement('tr'); |
|
|
|
insertMinerTr.id = 'worker' + minerIndex; |
|
|
|
insertMinerTr.id = 'miner-' + minerIndex; |
|
|
|
insertMinerTr.setAttribute('data-hashrate', workerstat.hashrate); |
|
|
|
insertMinerTr.innerHTML = '<td><span class="responsiveTableLabel"><i class="far fa-address-card fa-fw"></i></span>Miner #'+ minerIndex +'</td>'; |
|
|
|
insertMinerTr.innerHTML += '<td><span class="responsiveTableLabel"><i class="fas fa-cog fa-fw"></i> Shares: </span><span>' + bigNumber(workerstat.shares) + '</span></td>'; |
|
|
@ -36,10 +36,10 @@ $(function() { |
|
|
|
console.log('Added new miner! [' + minerIndex + ']'); |
|
|
|
} else { |
|
|
|
//Update existing
|
|
|
|
document.querySelector('#workers' + pool + ' #worker' + minerIndex + ' td:nth-child(2) span:nth-child(2)').innerHTML = bigNumber(workerstat.shares); |
|
|
|
document.querySelector('#workers' + pool + ' #worker' + minerIndex + ' td:nth-child(3) span:nth-child(2)').innerHTML = minerEfficiency + '%'; |
|
|
|
document.querySelector('#workers' + pool + ' #worker' + minerIndex + ' td:nth-child(4) span:nth-child(2)').innerHTML = workerstat.hashrateString; |
|
|
|
document.querySelector('#workers' + pool + ' #worker' + minerIndex).setAttribute('data-hashrate', workerstat.hashrate); |
|
|
|
document.querySelector('#workers' + pool + ' #miner-' + minerIndex + ' td:nth-child(2) span:nth-child(2)').innerHTML = bigNumber(workerstat.shares); |
|
|
|
document.querySelector('#workers' + pool + ' #miner-' + minerIndex + ' td:nth-child(3) span:nth-child(2)').innerHTML = minerEfficiency + '%'; |
|
|
|
document.querySelector('#workers' + pool + ' #miner-' + minerIndex + ' td:nth-child(4) span:nth-child(2)').innerHTML = workerstat.hashrateString; |
|
|
|
document.querySelector('#workers' + pool + ' #miner-' + minerIndex).setAttribute('data-hashrate', workerstat.hashrate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -48,9 +48,7 @@ $(function() { |
|
|
|
//Remove inactive
|
|
|
|
var workerList = document.querySelectorAll('#workers' + pool + ' .poolMinerTable tbody tr'); |
|
|
|
for ( var i = workerList.length-1; i >= 0; i--) { |
|
|
|
var workerTrID = workerList[i].id.substring(6); |
|
|
|
|
|
|
|
if( typeof stats.pools[pool].miners[workerTrID] == 'undefined') { |
|
|
|
if( typeof stats.pools[pool].miners[workerList[i].id] == 'undefined') { |
|
|
|
console.log('Removing miner :( [' + workerTrID + ']'); |
|
|
|
workerList[i].parentNode.removeChild(workerList[i]); |
|
|
|
} |
|
|
|