Fixed wrong formatting of runtime sensor value (#10606)
* fix wrong formatting of runtime sensor value * avoid else statements
This commit is contained in:
parent
d674c8cefd
commit
ccfd32457a
|
@ -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>";
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ if (count($sensors)) {
|
|||
$graph_array['from'] = \LibreNMS\Config::get('time.day');
|
||||
$sensor_minigraph = generate_lazy_graph_tag($graph_array);
|
||||
|
||||
$sensor['sensor_current'] = $sensor_class == 'runtime' ? formatUptime($sensor['sensor_current'] * 60, 'short') : $sensor['sensor_current'];
|
||||
$sensor_current = $graph_type == 'sensor_state' ? get_state_label($sensor) : get_sensor_label_color($sensor);
|
||||
|
||||
echo '<tr>
|
||||
|
|
Loading…
Reference in New Issue