mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed wrong formatting of runtime sensor value (#10606)
* fix wrong formatting of runtime sensor value * avoid else statements
This commit is contained in:
@@ -1678,6 +1678,10 @@ function get_sensor_label_color($sensor, $type = 'sensors')
|
||||
$label_style = "label-danger";
|
||||
}
|
||||
$unit = __("$type.{$sensor['sensor_class']}.unit");
|
||||
if ($sensor['sensor_class'] == 'runtime') {
|
||||
$sensor['sensor_current'] = formatUptime($sensor['sensor_current'] * 60, 'short');
|
||||
return "<span class='label $label_style'>".trim($sensor['sensor_current'])."</span>";
|
||||
}
|
||||
return "<span class='label $label_style'>".trim(format_si($sensor['sensor_current']).$unit)."</span>";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user