Skip to content

Commit

Permalink
Indicate when a linked custom map has down devices (librenms#16518)
Browse files Browse the repository at this point in the history
  • Loading branch information
laf authored Oct 11, 2024
1 parent 0fbaaf7 commit b4f7425
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Http/Controllers/Maps/CustomMapDataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ public function get(Request $request, CustomMap $map): JsonResponse

foreach ($map->nodes as $node) {
$nodeid = $node->custom_map_node_id;
if ($node->linked_custom_map_id > 0) {
$nodes_down = CustomMapNode::where('custom_map_id', $node->linked_custom_map_id)->whereRelation('device', 'status', 0)->get();
if (count($nodes_down) > 0) {
$node->colour_bg = 'darkred';
}
}
$nodes[$nodeid] = [
'custom_map_node_id' => $node->custom_map_node_id,
'device_id' => $node->device_id,
Expand Down

0 comments on commit b4f7425

Please sign in to comment.