mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Maps - Keep edge black when link is 0 bps (#16192)
* Black when link is 0bps * style
This commit is contained in:
@@ -114,8 +114,8 @@ class CustomMapDataController extends Controller
|
||||
$edges[$edgeid]['port_topct'] = -1.0;
|
||||
$edges[$edgeid]['port_frompct'] = -1.0;
|
||||
} else {
|
||||
$edges[$edgeid]['port_topct'] = round($rateto / $speedto * 100.0, 2);
|
||||
$edges[$edgeid]['port_frompct'] = round($ratefrom / $speedfrom * 100.0, 2);
|
||||
$edges[$edgeid]['port_topct'] = $rateto / $speedto * 100.0;
|
||||
$edges[$edgeid]['port_frompct'] = $ratefrom / $speedfrom * 100.0;
|
||||
}
|
||||
if ($edge->port->ifOperStatus != 'up') {
|
||||
// If the port is not online, show the same as speed unknown
|
||||
@@ -125,6 +125,8 @@ class CustomMapDataController extends Controller
|
||||
$edges[$edgeid]['colour_to'] = $this->speedColour($edges[$edgeid]['port_topct']);
|
||||
$edges[$edgeid]['colour_from'] = $this->speedColour($edges[$edgeid]['port_frompct']);
|
||||
}
|
||||
$edges[$edgeid]['port_topct'] = round($edges[$edgeid]['port_topct'], 2);
|
||||
$edges[$edgeid]['port_frompct'] = round($edges[$edgeid]['port_frompct'], 2);
|
||||
$edges[$edgeid]['port_tobps'] = $this->rateString($rateto);
|
||||
$edges[$edgeid]['port_frombps'] = $this->rateString($ratefrom);
|
||||
$edges[$edgeid]['width_to'] = $this->speedWidth($speedto);
|
||||
@@ -305,8 +307,8 @@ class CustomMapDataController extends Controller
|
||||
{
|
||||
// For the maths below, the 5.1 is worked out as 255 / 50
|
||||
// (255 being the max colour value and 50 is the max of the $pct calculation)
|
||||
if ($pct < 0) {
|
||||
// Black if we can't determine the percentage (link down or speed 0)
|
||||
if ($pct <= 0) {
|
||||
// Black if we can't determine the percentage (link down or speed 0), or link speed strictly 0
|
||||
return '#000000';
|
||||
} elseif ($pct < 50) {
|
||||
// 100% green and slowly increase the red until we get to yellow
|
||||
|
Reference in New Issue
Block a user