cryptonote-universal-pool/website/pages/admin/userslist.html

78 lines
2.2 KiB
HTML

<style>
td {
text-align: center
}
</style>
<!-- /// define Handlebars template /// -->
<script id="usersListTable" type="text/x-handlebars-template">
{{#each users}}
<tr>
<td><a href="./?wallet={{this.number}}">{{this.number}}</a></td>
<td data-sort="{{this.wallet.hashrate}}">{{this.readableHashrate}}</td>
<td data-sort="{{this.wallet.hashes}}">{{this.readableHashes}}</td>
<td data-sort="{{this.wallet.pending}}">{{this.wallet.pending}}</td>
<td data-sort="{{this.wallet.paid}}">{{this.wallet.paid}}</td>
<td data-sort="{{this.wallet.lastShare}}">{{this.timeago}}</td>
</tr>
{{/each}}
</script>
<script>
function parseUsers(wallets) {
var walletsArray = [],
properObject = {};
for(var wallet in wallets) {
if(wallets.hasOwnProperty(wallet)) {
walletsArray.push({
number: wallet,
wallet: wallets[wallet],
timeago: $.timeago(new Date(wallets[wallet].lastShare * 1000).toISOString()),
readableHashrate: getReadableHashRateString(wallets[wallet].hashrate) + '/s',
readableHashes: getReadableHashRateString(wallets[wallet].hashes)
});
}
}
properObject['users'] = walletsArray.sort(function(a, b) {
return a.wallet.hashrate - b.wallet.hashrate
}).reverse();
return properObject;
}
function cretaUserTable() {
$.ajax({
url: api + '/admin_users',
data: {password: docCookies.getItem('password')},
cache: false,
dataType: 'json',
success: function(data) {
renderTemplate(parseUsers(data), '#usersListTable', '#template');
}
});
}
$(function() {
$('[data-toggle="tooltip"]').tooltip();
$('.usersList th.sort').on('click', sortTable);
cretaUserTable();
});
</script>
<div class="table-responsive">
<table class="table table-hover table-striped usersList">
<thead>
<tr>
<th>Wallet</th>
<th class="sort" style="width:10%;">Hashrate <i class="fa fa-sort"></i></th>
<th class="sort" style="width:10%;">Hashes <i class="fa fa-sort"></i></th>
<th class="sort" style="width:16%;">Pending <i class="fa fa-sort"></i></th>
<th class="sort" style="width:10%;">Paid <i class="fa fa-sort"></i></th>
<th class="sort" style="width:14%;">Last share <i class="fa fa-sort"></i></th>
</tr>
</thead>
<tbody id="template">
</tbody>
</table>
</div>