mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Custom map - Make device text and links dark red when the connected device is offline (#16477)
* Make device text and links dark red when the connected device is offline * Do not change the text colour if the request came from the editor
This commit is contained in:
@ -117,7 +117,10 @@ class CustomMapDataController extends Controller
|
||||
$edges[$edgeid]['port_topct'] = $rateto / $speedto * 100.0;
|
||||
$edges[$edgeid]['port_frompct'] = $ratefrom / $speedfrom * 100.0;
|
||||
}
|
||||
if ($edge->port->ifOperStatus != 'up') {
|
||||
if (! $edge->port->device->status) {
|
||||
$edges[$edgeid]['colour_to'] = 'darkred';
|
||||
$edges[$edgeid]['colour_from'] = 'darkred';
|
||||
} elseif ($edge->port->ifOperStatus != 'up') {
|
||||
// If the port is not online, show the same as speed unknown
|
||||
$edges[$edgeid]['colour_to'] = $this->speedColour(-1.0);
|
||||
$edges[$edgeid]['colour_from'] = $this->speedColour(-1.0);
|
||||
@ -166,6 +169,10 @@ class CustomMapDataController extends Controller
|
||||
$device_style = $this->nodeDisabledStyle();
|
||||
} elseif (! $node->device->status) {
|
||||
$device_style = $this->nodeDownStyle();
|
||||
// Change the text colour as long as we have not been requested by the editor
|
||||
if ($request->headers->get('referer') && ! str_ends_with(parse_url($request->headers->get('referer'), PHP_URL_PATH), '/edit')) {
|
||||
$nodes[$nodeid]['text_colour'] = 'darkred';
|
||||
}
|
||||
} else {
|
||||
$device_style = $this->nodeUpStyle();
|
||||
}
|
||||
|
Reference in New Issue
Block a user