[ADDED] Pagination support on pool workers page
Adds pagination support for the admin panel pool workers page. Will greatly increase loading times of this page if working as intended. Fixes another part of #1043.
This commit is contained in:
parent
003b8c79b6
commit
2a24f90ed0
@ -153,7 +153,7 @@ class Worker extends Base {
|
|||||||
* @param limit int
|
* @param limit int
|
||||||
* @return mixed array Workers and their settings or false
|
* @return mixed array Workers and their settings or false
|
||||||
**/
|
**/
|
||||||
public function getAllWorkers($iLimit=0, $interval=600) {
|
public function getAllWorkers($iLimit=0, $interval=600, $start=0) {
|
||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT id, username, password, monitor,
|
SELECT id, username, password, monitor,
|
||||||
@ -191,8 +191,8 @@ class Worker extends Base {
|
|||||||
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
)) AS avg_difficulty
|
)) AS avg_difficulty
|
||||||
FROM $this->table AS w
|
FROM $this->table AS w
|
||||||
ORDER BY hashrate DESC LIMIT ?");
|
ORDER BY hashrate DESC LIMIT ?,?");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiiiiii', $interval, $interval, $interval, $interval, $interval, $interval, $interval, $interval, $iLimit) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiiiiiii', $interval, $interval, $interval, $interval, $interval, $interval, $interval, $interval, $start, $iLimit) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
return $this->sqlError('E0057');
|
return $this->sqlError('E0057');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,11 +8,16 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|||||||
die("404 Page not found");
|
die("404 Page not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
$iActiveWorkers = $worker->getCountAllActiveWorkers();
|
// Some defaults
|
||||||
$aWorkers = $worker->getAllWorkers($iActiveWorkers);
|
$interval = 600;
|
||||||
|
$iActiveWorkers = $worker->getCountAllActiveWorkers();
|
||||||
|
$iActiveWorkers > 30 ? $iLimit = 30 : $iLimit = $iActiveWorkers;
|
||||||
|
empty($_REQUEST['start']) ? $start = 0 : $start = $_REQUEST['start'];
|
||||||
|
|
||||||
$smarty->assign('WORKERS', $aWorkers);
|
$aWorkers = $worker->getAllWorkers($iLimit, $interval, $start);
|
||||||
|
|
||||||
|
$smarty->assign('LIMIT', $iLimit);
|
||||||
|
$smarty->assign('WORKERS', $aWorkers);
|
||||||
$smarty->assign('CONTENT', 'default.tpl');
|
$smarty->assign('CONTENT', 'default.tpl');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,6 +1,25 @@
|
|||||||
<article class="module width_3_quarter">
|
<article class="module width_3_quarter">
|
||||||
<header><h3>{count($WORKERS)} Current Active Pool Workers</h3></header>
|
<header><h3>{$GLOBAL.workers} Current Active Pool Workers</h3></header>
|
||||||
<table class="tablesorter" cellspacing="0">
|
<form action="{$smarty.server.PHP_SELF}">
|
||||||
|
<input type="hidden" name="page" value="{$smarty.request.page|escape}" />
|
||||||
|
<input type="hidden" name="action" value="{$smarty.request.action|escape}" />
|
||||||
|
<table cellspacing="0" class="tablesorter">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="left">
|
||||||
|
{if $smarty.request.start|default:"0" > 0}
|
||||||
|
<a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&start={$smarty.request.start|escape|default:"0" - $LIMIT}{if $FILTERS|default:""}{$FILTERS}{/if}"><i class="icon-left-open"></i></a>
|
||||||
|
{else}
|
||||||
|
<i class="icon-left-open"></i>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td align="right">
|
||||||
|
<a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&start={$smarty.request.start|escape|default:"0" + $LIMIT}{if $FILTERS|default:""}{$FILTERS}{/if}"><i class="icon-right-open"></i></a>
|
||||||
|
</td>
|
||||||
|
</tbody>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
<table class="tablesorter" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left">Worker Name</th>
|
<th align="left">Worker Name</th>
|
||||||
@ -14,7 +33,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
{nocache}
|
{nocache}
|
||||||
{section worker $WORKERS}
|
{section worker $WORKERS}
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">{$WORKERS[worker].username|escape}</td>
|
<td align="left">{$WORKERS[worker].username|escape}</td>
|
||||||
<td align="left">{$WORKERS[worker].password|escape}</td>
|
<td align="left">{$WORKERS[worker].password|escape}</td>
|
||||||
@ -28,6 +47,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{/section}
|
{/section}
|
||||||
{/nocache}
|
{/nocache}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user