mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added support for grouping sensors (#9606)
Improves visual identification for sensors - [x] Docs DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
This commit is contained in:
committed by
Neil Lathwood
parent
b7591339eb
commit
63c85429ae
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
if ($sensor_class == 'state') {
|
||||
$sensors = dbFetchRows('SELECT `sensors`.*, `state_indexes`.`state_index_id` FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `sensor_type`, `sensor_descr`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
|
||||
$sensors = dbFetchRows('SELECT `sensors`.*, `state_indexes`.`state_index_id` FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `group`, `sensor_type`, `sensor_descr`, `sensor_index`+0', array($sensor_class, $device['device_id']));
|
||||
} else {
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_descr`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `group`, `sensor_descr`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
|
||||
}
|
||||
|
||||
if (count($sensors)) {
|
||||
@@ -62,6 +62,7 @@ if (count($sensors)) {
|
||||
echo '<a href="device/device='.$device['device_id'].'/tab=health/metric='.strtolower($sensor_type).'/"><i class="fa '.$sensor_fa_icon.' fa-lg icon-theme" aria-hidden="true"></i><strong> '.$sensor_type.'</strong></a>';
|
||||
echo ' </div>
|
||||
<table class="table table-hover table-condensed table-striped">';
|
||||
$group = '';
|
||||
foreach ($sensors as $sensor) {
|
||||
$state_translation = array();
|
||||
if (!empty($sensor['state_index_id'])) {
|
||||
@@ -72,6 +73,11 @@ if (count($sensors)) {
|
||||
$sensor['sensor_current'] = 'NaN';
|
||||
}
|
||||
|
||||
if ($group != $sensor['group']) {
|
||||
$group = $sensor['group'];
|
||||
echo "<tr><td colspan='3'><strong>$group</strong></td></tr>";
|
||||
}
|
||||
|
||||
// FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
|
||||
// FIXME - So now we need to clean this up and move it into a function. Isn't it just "print-graphrow"?
|
||||
// FIXME - DUPLICATED IN health/sensors
|
||||
|
Reference in New Issue
Block a user