mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-10 14:57:53 +00:00
api: update sample rig ui
totals, readable uptime, autorefresh
This commit is contained in:
parent
3dcfa5d84f
commit
63eb163e32
@ -27,11 +27,11 @@ function translateField($key)
|
|||||||
$intl['VER'] = 'Version';
|
$intl['VER'] = 'Version';
|
||||||
|
|
||||||
$intl['ALGO'] = 'Algorithm';
|
$intl['ALGO'] = 'Algorithm';
|
||||||
$intl['KHS'] = 'Hashrate (kH/s)';
|
$intl['KHS'] = 'Hash rate (kH/s)';
|
||||||
$intl['ACC'] = 'Accepted shares';
|
$intl['ACC'] = 'Accepted shares';
|
||||||
$intl['ACCMN'] = 'Accepted / mn';
|
$intl['ACCMN'] = 'Accepted / mn';
|
||||||
$intl['REJ'] = 'Rejected';
|
$intl['REJ'] = 'Rejected';
|
||||||
$intl['UPTIME'] = 'Miner uptime';
|
$intl['UPTIME'] = 'Miner up time';
|
||||||
|
|
||||||
$intl['TEMP'] = 'T°c';
|
$intl['TEMP'] = 'T°c';
|
||||||
$intl['FAN'] = 'Fan %';
|
$intl['FAN'] = 'Fan %';
|
||||||
@ -42,27 +42,50 @@ function translateField($key)
|
|||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function translateValue($key,$val)
|
||||||
|
{
|
||||||
|
if ($key == 'UPTIME') {
|
||||||
|
$min = floor(intval($val) / 60);
|
||||||
|
$sec = intval($val) % 60;
|
||||||
|
$val = "${min}mn ${sec}s";
|
||||||
|
}
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
function displayData($data)
|
function displayData($data)
|
||||||
{
|
{
|
||||||
$htm = '';
|
$htm = '';
|
||||||
|
$totals = array();
|
||||||
foreach ($data as $name => $stats) {
|
foreach ($data as $name => $stats) {
|
||||||
$htm .= '<table id="tb_'.$name.'" class="stats">'."\n";
|
$htm .= '<table id="tb_'.$name.'" class="stats">'."\n";
|
||||||
$htm .= '<tr><th class="machine" colspan="2">'.$name."</th></tr>\n";
|
$htm .= '<tr><th class="machine" colspan="2">'.$name."</th></tr>\n";
|
||||||
foreach ($stats['summary'] as $key=>$val) {
|
if (!empty($stats)) {
|
||||||
if (!empty($val))
|
$summary = $stats['summary'];
|
||||||
$htm .= '<tr><td class="key">'.translateField($key).'</td>'.
|
foreach ($summary as $key=>$val) {
|
||||||
'<td class="val">'.$val."</td></tr>\n";
|
|
||||||
}
|
|
||||||
foreach ($stats['stats'] as $g=>$gpu) {
|
|
||||||
$htm .= '<tr><th class="gpu" colspan="2">'.$g."</th></tr>\n";
|
|
||||||
foreach ($gpu as $key=>$val) {
|
|
||||||
if (!empty($val))
|
if (!empty($val))
|
||||||
$htm .= '<tr><td class="key">'.translateField($key).'</td>'.
|
$htm .= '<tr><td class="key">'.translateField($key).'</td>'.
|
||||||
'<td class="val">'.$val."</td></tr>\n";
|
'<td class="val">'.translateValue($key, $val)."</td></tr>\n";
|
||||||
|
}
|
||||||
|
$totals[$summary['ALGO']] += floatval($summary['KHS']);
|
||||||
|
foreach ($stats['stats'] as $g=>$gpu) {
|
||||||
|
$htm .= '<tr><th class="gpu" colspan="2">'.$g."</th></tr>\n";
|
||||||
|
foreach ($gpu as $key=>$val) {
|
||||||
|
if (!empty($val))
|
||||||
|
$htm .= '<tr><td class="key">'.translateField($key).'</td>'.
|
||||||
|
'<td class="val">'.translateValue($key, $val)."</td></tr>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$htm .= "</table>\n";
|
$htm .= "</table>\n";
|
||||||
}
|
}
|
||||||
|
// totals
|
||||||
|
if (!empty($totals)) {
|
||||||
|
$htm .= '<div class="totals"><h2>Total Hash rate</h2>'."\n";
|
||||||
|
foreach ($totals as $algo => $hashrate) {
|
||||||
|
$htm .= '<li><span class="algo">'.$algo.":</span>$hashrate kH/s</li>\n";
|
||||||
|
}
|
||||||
|
$htm .= '</div>';
|
||||||
|
}
|
||||||
return $htm;
|
return $htm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,12 +94,18 @@ $data = getdataFromPears();
|
|||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>ccminer rig api sample</title>
|
<title>ccminer rig api sample</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta http-equiv="refresh" content="10">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body { color:#cccccc; background:#1d1d1d; margin:30px 30px 0px 30px; padding:0px; font-size:.8em; font-family:Arial,Helvetica,sans-serif; }
|
body {
|
||||||
|
color:#cccccc; background:#1d1d1d; margin:30px 30px 0px 30px; padding:0px;
|
||||||
|
font-size:.8em; font-family:Arial,Helvetica,sans-serif;
|
||||||
|
}
|
||||||
a { color:#aaaaaa; text-decoration: none; }
|
a { color:#aaaaaa; text-decoration: none; }
|
||||||
a:focus { outline-style:none; }
|
a:focus { outline-style:none; }
|
||||||
.clear { clear: both; }
|
.clear { clear: both; }
|
||||||
|
|
||||||
div#page, div#header, div#footer {
|
div#page, div#header, div#footer {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 950px;
|
width: 950px;
|
||||||
@ -100,7 +129,6 @@ div#footer {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
text-shadow: rgba(0, 0, 0, 0.8) 0px 1px 0px;
|
text-shadow: rgba(0, 0, 0, 0.8) 0px 1px 0px;
|
||||||
padding-top: 8px;
|
|
||||||
}
|
}
|
||||||
#header h1 { padding: 12px; font-size: 20px; }
|
#header h1 { padding: 12px; font-size: 20px; }
|
||||||
#footer p { margin: 12px 24px; }
|
#footer p { margin: 12px 24px; }
|
||||||
@ -111,6 +139,11 @@ th.gpu { color: white; padding: 3px 3px; font: bolder; text-align: left; backgro
|
|||||||
td.key { width: 40px; max-width: 120px; }
|
td.key { width: 40px; max-width: 120px; }
|
||||||
td.val { width: 70px; max-width: 180px; color: white; }
|
td.val { width: 70px; max-width: 180px; color: white; }
|
||||||
|
|
||||||
|
div.totals { margin: 16px; }
|
||||||
|
div.totals h2 { color: darkcyan; font-size: 16px; margin-bottom: 4px; }
|
||||||
|
div.totals li { list-style-type: none; font-size: 16px; margin-left: 4px; margin-bottom: 8px; }
|
||||||
|
li span.algo { display: inline-block; width: 50px; max-width: 120px; }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -127,4 +160,4 @@ td.val { width: 70px; max-width: 180px; color: white; }
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user