Skip to content

Added a simple http+json server option for monitoring purposes #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added a footer row and some styling to the main datatable
  • Loading branch information
mike-teehan committed Feb 20, 2018
commit 3e3719bbbe14886e792d08b88d948adc4ec8154e
44 changes: 39 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
</head>
<body>
<table id="displaytable" width="100%"><table>
<table id="displaytable" width="100%" class="display" cellspacing="0"><tfoot><td></td><td></td><td></td></tfoot><table>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script>
Expand All @@ -19,9 +19,43 @@
dataSrc: parseJSON
},
columns: [
{ title: "Name", data: "name", className: "dt-body-right" },
{ title: "Hashrate", data: "hashrate" }
]
{ title: "Name", data: "name" },
{ title: "Hashrate", data: "hashrate" },
{ title: "Difficulty", data: "diff" }
],
footerCallback: function(row, data, start, end, display) {
var api = this.api(), data;

// converting to interger to find total
var intVal = function (i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};

var minerCount = api.column(0).data().length;

var hashTotal = api
.column(1)
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0);

var totDiff = api
.column(2)
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0);
var avgDiff = Math.floor(totDiff / api.column(2).data().length);

// Update footer by showing the total with the reference of the column index
$(api.column(0).footer()).html("Count: " + minerCount);
$(api.column(1).footer()).html("Total: " + hashTotal);
$(api.column(2).footer()).html("Avg: " + avgDiff);
}
})
setInterval(() => { $disp.ajax.reload(); }, 15000);

Expand All @@ -35,7 +69,7 @@
miner = worker[minerid];
if(miner.length == 0) continue;
name = (miner["password"].length > 0) ? miner["password"] : miner["id"];
row = { name: name, hashrate: miner["avgSpeed"] }
row = { name: name, hashrate: miner["avgSpeed"], diff: miner["diff"] }
res.push(row);
}
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy