Merge pull request #750 from TheSerapher/dashboard-updates
[IMPROVED] Look & Feel of basic Dashboard info
This commit is contained in:
commit
af533e35b6
@ -136,39 +136,39 @@ class Worker {
|
||||
* @param account_id int User ID
|
||||
* @return mixed array Workers and their settings or false
|
||||
**/
|
||||
public function getWorkers($account_id) {
|
||||
public function getWorkers($account_id, $interval) {
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT id, username, password, monitor,
|
||||
( SELECT COUNT(id) FROM " . $this->share->getTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS count_all,
|
||||
( SELECT COUNT(id) FROM " . $this->share->getArchiveTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS count_all_archive,
|
||||
( SELECT COUNT(id) FROM " . $this->share->getTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)) AS count_all,
|
||||
( SELECT COUNT(id) FROM " . $this->share->getArchiveTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)) AS count_all_archive,
|
||||
(
|
||||
SELECT
|
||||
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536/600/1000), 0), 0) AS hashrate
|
||||
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / ? / 1000), 0), 0) AS hashrate
|
||||
FROM " . $this->share->getTableName() . "
|
||||
WHERE
|
||||
username = w.username
|
||||
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
||||
AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||
) + (
|
||||
SELECT
|
||||
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536/600/1000), 0), 0) AS hashrate
|
||||
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / ? / 1000), 0), 0) AS hashrate
|
||||
FROM " . $this->share->getArchiveTableName() . "
|
||||
WHERE
|
||||
username = w.username
|
||||
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
||||
AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||
) AS hashrate,
|
||||
(
|
||||
SELECT IFNULL(ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) / count_all, 2), 0)
|
||||
FROM " . $this->share->getTableName() . "
|
||||
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
||||
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||
) + (
|
||||
SELECT IFNULL(ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) / count_all_archive, 2), 0)
|
||||
FROM " . $this->share->getArchiveTableName() . "
|
||||
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
||||
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||
) AS difficulty
|
||||
FROM $this->table AS w
|
||||
WHERE account_id = ?");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $account_id) && $stmt->execute() && $result = $stmt->get_result())
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiiiiii', $interval, $interval, $interval, $interval, $interval, $interval, $interval, $interval, $account_id) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_all(MYSQLI_ASSOC);
|
||||
// Catchall
|
||||
$this->setErrorMessage('Failed to fetch workers for your account');
|
||||
|
||||
@ -44,10 +44,16 @@ $dPersonalHashrateAdjusted = $dPersonalHashrate * $dPersonalHashrateModifier;
|
||||
$dPoolHashrateAdjusted = $dPoolHashrate * $dPoolHashrateModifier;
|
||||
$dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier;
|
||||
|
||||
// Worker information
|
||||
$aWorkers = $worker->getWorkers($user_id, $interval);
|
||||
|
||||
// Output JSON format
|
||||
$data = array(
|
||||
'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000 ) ),
|
||||
'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => array('valid' => $aUserRoundShares['valid'], 'invalid' => $aUserRoundShares['invalid']), 'balance' => $transaction->getBalance($user_id), 'estimates' => $aEstimates),
|
||||
'personal' => array (
|
||||
'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate,
|
||||
'shares' => array('valid' => $aUserRoundShares['valid'], 'invalid' => $aUserRoundShares['invalid']),
|
||||
'balance' => $transaction->getBalance($user_id), 'estimates' => $aEstimates, 'workers' => $aWorkers),
|
||||
'pool' => array( 'hashrate' => $dPoolHashrateAdjusted, 'shares' => $aRoundShares ),
|
||||
'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ),
|
||||
);
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<p>Please consider <a href="{$smarty.server.PHP_SELF}?page=account&action=edit">donating</a> some of your mined coins to the pool operator.</p>
|
||||
{/if}
|
||||
<table width="100%">
|
||||
<caption style="text-align: left;">{$GLOBAL.config.currency} Account Balance</caption>
|
||||
<caption style="text-align: left;"><b>{$GLOBAL.config.currency} Account Balance</b></caption>
|
||||
<tr>
|
||||
<th align="left">Confirmed</th>
|
||||
<td id="b-confirmed" align="right"></td>
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
{assign var=payout_system value=$GLOBAL.config.payout_system}
|
||||
{include file="dashboard/overview.tpl"}
|
||||
{include file="dashboard/round_data.tpl"}
|
||||
{include file="dashboard/account_data.tpl"}
|
||||
{include file="dashboard/default_$payout_system.tpl"}
|
||||
{include file="dashboard/account_data.tpl"}
|
||||
{include file="dashboard/workers.tpl"}
|
||||
{include file="dashboard/js.tpl"}
|
||||
{/if}
|
||||
|
||||
@ -1,23 +1,16 @@
|
||||
<article class="module width_half">
|
||||
<article class="module width_quarter">
|
||||
<header><h3>Dashboard</h3></header>
|
||||
<div class="module_content">
|
||||
<table width="100%">
|
||||
<table align="center" width="50%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>PPLNS Target</b></td>
|
||||
<td class="right">{$GLOBAL.pplns.target|number_format}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b><u>Your Stats</u></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Hashrate</b></td>
|
||||
<td class="right">{$GLOBAL.userdata.hashrate|number_format} KH/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Share Rate</b></td>
|
||||
<td class="right">{$GLOBAL.userdata.sharerate|number_format:"2"} S/s</td>
|
||||
<td>{$GLOBAL.pplns.target|number_format}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table align="left" width="50%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><b><u>Round Shares</u></b> <span id='tt'><img src='{$PATH}/images/questionmark.png' height='15px' width='15px' title='Submitted shares since last found block (ie. round shares)'></span></td>
|
||||
</tr>
|
||||
@ -37,6 +30,10 @@
|
||||
<td><b>Your Invalid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.userdata.shares.invalid|number_format}</i>{if $GLOBAL.roundshares.valid > 0}<font size='1px'> ({($GLOBAL.userdata.shares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%)</font>{/if}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table align="right" width="50%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><b><u>{$GLOBAL.config.currency} Round Estimate</u></b></td>
|
||||
</tr>
|
||||
@ -56,9 +53,6 @@
|
||||
<td><b>Payout</b></td>
|
||||
<td class="right">{$GLOBAL.userdata.est_payout|number_format:"3"}</td>
|
||||
</tr>
|
||||
<tr><td colspan="2"><b><u>{$GLOBAL.config.currency} Account Balance</u></b></td></tr>
|
||||
<tr><td>Confirmed</td><td class="right"><b>{$GLOBAL.userdata.balance.confirmed|default:"0"}</td></tr>
|
||||
<tr><td>Unconfirmed</td><td class="right"><b>{$GLOBAL.userdata.balance.unconfirmed|default:"0"}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -1,62 +1,54 @@
|
||||
<article class="module width_half">
|
||||
<header><h3>Dashboard</h3></header>
|
||||
<div class="module_content">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><b><u>Your Stats</u></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Hashrate</b></td>
|
||||
<td class="right">{$GLOBAL.userdata.hashrate|number_format} KH/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Share Rate</b></td>
|
||||
<td class="right">{$GLOBAL.userdata.sharerate|number_format:"2"} S/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>PPS Value</b></td>
|
||||
<td class="right">{$GLOBAL.ppsvalue}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b><u>Round Shares</u></b> <span id='tt'><img src='{$PATH}/images/questionmark.png' height='15px' width='15px' title='Submitted shares since last found block (ie. round shares)'></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Pool Valid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.roundshares.valid|number_format}</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Your Valid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.userdata.shares.valid|number_format}</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Pool Invalid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.roundshares.invalid|number_format}</i>{if $GLOBAL.roundshares.valid > 0}<font size='1px'> ({($GLOBAL.roundshares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%)</font>{/if}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Your Invalid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.userdata.shares.invalid|number_format}</i>{if $GLOBAL.roundshares.valid > 0}<font size='1px'> ({($GLOBAL.userdata.shares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%)</font>{/if}</td>
|
||||
</tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td colspan="2"><b><u>{$GLOBAL.config.currency} Estimates</u></b></td></tr>
|
||||
<tr>
|
||||
<td><b>in 24 hours</b></td>
|
||||
<td class="right">{($GLOBAL.userdata.sharerate * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>in 7 days</b></td>
|
||||
<td class="right">{($GLOBAL.userdata.sharerate * 7 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>in 14 days</b></td>
|
||||
<td class="right">{($GLOBAL.userdata.sharerate * 14 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td colspan="2"><b><u>{$GLOBAL.config.currency} Account Balance</u></b></td></tr>
|
||||
<tr><td>Confirmed</td><td class="right"><b>{$GLOBAL.userdata.balance.confirmed|default:"0"}</td></tr>
|
||||
<tr><td>Unconfirmed</td><td class="right"><b>{$GLOBAL.userdata.balance.unconfirmed|default:"0"}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
<article class="module width_quarter">
|
||||
<header><h3>Dashboard</h3></header>
|
||||
<div class="module_content">
|
||||
<table width="50%" align="center">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>PPS Value</b></td>
|
||||
<td>{$GLOBAL.ppsvalue}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table align="left" width="50%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><b><u>Round Shares</u></b> <span id='tt'><img src='{$PATH}/images/questionmark.png' height='15px' width='15px' title='Submitted shares since last found block (ie. round shares)'></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Pool Valid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.roundshares.valid|number_format}</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Your Valid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.userdata.shares.valid|number_format}</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Pool Invalid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.roundshares.invalid|number_format}</i>{if $GLOBAL.roundshares.valid > 0}<font size='1px'> ({($GLOBAL.roundshares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%)</font>{/if}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Your Invalid</b></td>
|
||||
<td class="right"><i>{$GLOBAL.userdata.shares.invalid|number_format}</i>{if $GLOBAL.roundshares.valid > 0}<font size='1px'> ({($GLOBAL.userdata.shares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%)</font>{/if}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table align="left" width="50%">
|
||||
<tbody>
|
||||
<tr><td colspan="2"><b><u>{$GLOBAL.config.currency} Estimates</u></b></td></tr>
|
||||
<tr>
|
||||
<td><b>in 24 hours</b></td>
|
||||
<td class="right">{($GLOBAL.userdata.sharerate * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>in 7 days</b></td>
|
||||
<td class="right">{($GLOBAL.userdata.sharerate * 7 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>in 14 days</b></td>
|
||||
<td class="right">{($GLOBAL.userdata.sharerate * 14 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
@ -137,6 +137,21 @@ $(document).ready(function(){
|
||||
$('#b-unconfirmed').html(data.getdashboarddata.data.personal.balance.unconfirmed);
|
||||
}
|
||||
|
||||
// Refresh worker information
|
||||
function refreshWorkerData(data) {
|
||||
data = data.getdashboarddata.data;
|
||||
workers = data.personal.workers;
|
||||
length = workers.length;
|
||||
$('#b-workers').html('');
|
||||
for (var i = j = 0; i < length; i++) {
|
||||
if (workers[i].hashrate > 0) {
|
||||
j++;
|
||||
$('#b-workers').append('<tr><td>' + workers[i].username + '</td><td align="right">' + workers[i].hashrate + '</td><td align="right">' + workers[i].difficulty + '</td></tr>');
|
||||
}
|
||||
}
|
||||
if (j == 0) { $('#b-workers').html('<tr><td colspan="3" align="center">No active workers</td></tr>'); }
|
||||
}
|
||||
|
||||
// Our worker process to keep gauges and graph updated
|
||||
(function worker() {
|
||||
$.ajax({
|
||||
@ -145,6 +160,7 @@ $(document).ready(function(){
|
||||
success: function(data) {
|
||||
refreshInformation(data);
|
||||
refreshStaticData(data);
|
||||
refreshWorkerData(data);
|
||||
},
|
||||
complete: function() {
|
||||
setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal})
|
||||
|
||||
16
public/templates/mpos/dashboard/workers.tpl
Normal file
16
public/templates/mpos/dashboard/workers.tpl
Normal file
@ -0,0 +1,16 @@
|
||||
<article class="module width_quarter">
|
||||
<header><h3>Active Worker Information</h3></header>
|
||||
<table class="tablesorter" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">Worker</th>
|
||||
<th align="right">Hashrate</th>
|
||||
<th align="right">Difficulty</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="b-workers">
|
||||
<td colspan="3" align="center">Loading worker information</td>
|
||||
</tbody>
|
||||
</tr>
|
||||
</table>
|
||||
</article>
|
||||
@ -20,7 +20,6 @@
|
||||
<script type="text/javascript" src="{$PATH}/js/hideshow.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.visualize.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.jqplot.min.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.tooltip.visualize.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.tablesorter.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.tablesorter.pager.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.equalHeight.js"></script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user