Added "hide offline miners" toggle

This commit is contained in:
BenDroid 2017-11-10 21:10:00 +01:00
parent 10a08e1ccf
commit 9c03bd3705
2 changed files with 28 additions and 1 deletions

View file

@ -11,6 +11,7 @@
.left{text-align:left;}
.right{text-align:right;}
.center{text-align:center;}
.toolbar { float: right; padding-left: 10pt;}
</style>
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.4.js"></script>
@ -20,9 +21,28 @@
<script src="https://use.fontawesome.com/6b3cdfc597.js"></script>
<script type="text/javascript">
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var hide = document.getElementById("hideOffline").checked;
var lastStatus = settings.aoData[dataIndex]._aData.client_status.last_status_update * 1000;
var threshold = new Date().getTime() - 10*60*1000;
console.log("lastStatus: " + new Date(lastStatus));
console.log("threshold: " + new Date(threshold));
if (lastStatus > threshold || !hide) {
return true;
}
else {
return false;
}
}
);
$(document).ready(function() {
var table = $('#clientStatusList').DataTable({
dom: 'Bfrtip',
dom: '<"toolbar">frtip',
processing : true,
bPaginate : false,
ajax : {
@ -129,6 +149,8 @@ $(document).ready(function() {
}
});
$("div.toolbar").html('<input type="checkbox" id="hideOffline" value="hide" checked style="margin-right: 5pt"><label>Hide offline miners</label>');
$('#clientStatusList tbody').on( 'click', 'button', function () {
var data = table.row( $(this).parents('tr') ).data();
var clientId = data['client_status']['client_id'];
@ -190,6 +212,10 @@ $(document).ready(function() {
});
});
$('#hideOffline').click( function() {
table.draw();
} );
setInterval(function () {
table.ajax.reload();
}, 10000);

View file

@ -5,6 +5,7 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.com>
* Copyright 2017- BenDr0id <ben@graef.in>
*
*
* This program is free software: you can redistribute it and/or modify