webui: Added toner support in health metrics list (#7595)

This commit is contained in:
Neil Lathwood
2017-10-31 20:31:56 +00:00
committed by GitHub
parent 087dbbd173
commit f00e896e93
3 changed files with 23 additions and 0 deletions

View File

@@ -425,7 +425,16 @@ foreach (array_keys($menu_sensors) as $item) {
$sep++;
}
$toner = new ObjectCache('toner');
if ($toner) {
echo '<li role="presentation" class="divider"></li>';
echo '<li><a href="health/metric=toner/"><i class="fa fa-print fa-fw fa-lg"></i> Toner</a></li>';
$used_sensors['toner'] = $toner;
}
?>
</ul>
</li>
<?php

View File

@@ -49,6 +49,9 @@ if ($used_sensors['pressure']) {
if ($used_sensors['cooling']) {
$datas[] = 'cooling';
}
if ($used_sensors['toner']) {
$datas[] = 'toner';
}
// FIXME generalize -> static-config ?
$type_text['overview'] = "Overview";
@@ -73,6 +76,7 @@ $type_text['signal'] = "Signal";
$type_text['snr'] = "SNR";
$type_text['pressure'] = "Pressure";
$type_text['cooling'] = "Cooling";
$type_text['toner'] = 'Toner';
if (!$vars['metric']) {
$vars['metric'] = "processor";

View File

@@ -0,0 +1,10 @@
<?php
if (is_admin() || is_read()) {
$data['count'] = array('query' => "SELECT COUNT(`toner_id`) FROM toner");
} else {
$data['count'] = array(
'query' => "SELECT COUNT(`toner_id`) FROM toner AS T, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND T.`device_id` = D.`device_id`",
'params' => array($_SESSION['user_id']),
);
}