mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed tabs and units on the wireless page (#10401)
This commit is contained in:
committed by
Neil Lathwood
parent
f419419830
commit
f83ce13a7a
@@ -1616,8 +1616,11 @@ function get_state_label($sensor)
|
||||
|
||||
/**
|
||||
* Get sensor label and state color
|
||||
* @param array $sensor
|
||||
* @param string $type sensors or wireless
|
||||
* @return string
|
||||
*/
|
||||
function get_sensor_label_color($sensor)
|
||||
function get_sensor_label_color($sensor, $type = 'sensors')
|
||||
{
|
||||
$label_style = "label-success";
|
||||
if (is_null($sensor)) {
|
||||
@@ -1635,6 +1638,6 @@ function get_sensor_label_color($sensor)
|
||||
if (!is_null($sensor['sensor_limit_low']) && $sensor['sensor_current'] < $sensor['sensor_limit_low']) {
|
||||
$label_style = "label-danger";
|
||||
}
|
||||
$unit = __('sensors.' . $sensor['sensor_class'] . '.unit');
|
||||
$unit = __("$type.{$sensor['sensor_class']}.unit");
|
||||
return "<span class='label $label_style'>".trim(format_si($sensor['sensor_current']).$unit)."</span>";
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ foreach ($valid_wireless_types as $type => $details) {
|
||||
$linkoptions .= '<span class="pagemenu-selected">';
|
||||
}
|
||||
|
||||
$linkoptions .= generate_link($details['short'], $link_array, array('metric'=> $type, 'view' => $vars['view']));
|
||||
$linkoptions .= generate_link(__("wireless.$type.short"), $link_array, array('metric'=> $type, 'view' => $vars['view']));
|
||||
|
||||
if ($class == $type) {
|
||||
$linkoptions .= '</span>';
|
||||
@@ -76,7 +76,7 @@ if ($vars['view'] != "graphs") {
|
||||
|
||||
if (isset($valid_wireless_types[$class])) {
|
||||
$graph_type = 'wireless_' . $class;
|
||||
$unit = $valid_wireless_types[$class]['unit'];
|
||||
$unit = __("wireless.$class.unit");
|
||||
$pagetitle[] = "Wireless :: ".$class;
|
||||
include \LibreNMS\Config::get('install_dir') . '/includes/html/pages/wireless/sensors.inc.php';
|
||||
} else {
|
||||
|
@@ -112,7 +112,7 @@ foreach (dbFetchRows($sql, $param) as $sensor) {
|
||||
|
||||
$sensor['sensor_descr'] = substr($sensor['sensor_descr'], 0, 48);
|
||||
|
||||
$sensor_current = $graph_type == 'sensor_state' ? get_state_label($sensor) : get_sensor_label_color($sensor);
|
||||
$sensor_current = $graph_type == 'sensor_state' ? get_state_label($sensor) : get_sensor_label_color($sensor, $translations);
|
||||
|
||||
$response[] = array(
|
||||
'hostname' => generate_device_link($sensor),
|
||||
|
@@ -17,5 +17,6 @@
|
||||
|
||||
$table = 'sensors';
|
||||
$tab = 'health';
|
||||
$translations = 'sensors';
|
||||
|
||||
include 'sensors-common.php';
|
||||
|
@@ -2,5 +2,6 @@
|
||||
|
||||
$table = 'wireless_sensors';
|
||||
$tab = 'wireless';
|
||||
$translations = 'wireless';
|
||||
|
||||
include 'sensors-common.php';
|
||||
|
Reference in New Issue
Block a user