mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Show Device Group on Map (#12379)
* Show Device Group on Map * style fix * . * .
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
namespace App\Http\Controllers\Maps;
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\DeviceGroup;
|
||||
use Illuminate\Http\Request;
|
||||
use LibreNMS\Util\Url;
|
||||
|
||||
@@ -155,6 +156,11 @@ class DeviceDependencyController extends MapController
|
||||
|
||||
array_multisort(array_column($device_list, 'label'), SORT_ASC, $device_list);
|
||||
|
||||
$group_name = DeviceGroup::where('id', '=', $group_id)->first('name');
|
||||
if (! empty($group_name)) {
|
||||
$group_name = $group_name->name;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'showparentdevicepath' => $show_device_path,
|
||||
'isolated_device_id' => $this->isolatedDeviceId,
|
||||
@@ -165,6 +171,7 @@ class DeviceDependencyController extends MapController
|
||||
'options' => $this->visOptions(),
|
||||
'nodes' => json_encode(array_values($devices_by_id)),
|
||||
'edges' => json_encode($dependencies),
|
||||
'group_name' => $group_name,
|
||||
];
|
||||
|
||||
return view('map.device-dependency', $data);
|
||||
|
||||
@@ -44,8 +44,10 @@ $device_assoc_seen = [];
|
||||
$ports = [];
|
||||
$devices = [];
|
||||
|
||||
$group_name = '';
|
||||
$where = '';
|
||||
if (is_numeric($group) && $group) {
|
||||
$group_name = dbFetchCell('SELECT `name` from `device_groups` WHERE `id` = ?', [$group]);
|
||||
$where .= ' AND D1.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)';
|
||||
$sql_array[] = $group;
|
||||
$where .= ' OR D2.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)';
|
||||
@@ -342,6 +344,7 @@ if (count($devices_by_id) > 1 && count($links) > 0) {
|
||||
|
||||
<form name="printmapform" method="get" action="" class="form-horizontal" role="form">
|
||||
<?php if (empty($device['hostname'])) { ?>
|
||||
<big><b><?=$group_name?></b></big>
|
||||
<div class="pull-right">
|
||||
<select name="highlight_node" id="highlight_node" class="input-sm" onChange="highlightNode()";>
|
||||
<option value="0">None</option>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
@section('content')
|
||||
|
||||
@if($node_count)
|
||||
<big><b>{{ $group_name }}</b></big>
|
||||
<div class="pull-right">
|
||||
<input type="checkbox" class="custom-control-input" id="showparentdevicepath" onChange="highlightNode()" @if($showparentdevicepath) checked @endif>
|
||||
<label class="custom-control-label" for="showparentdevicepath">@lang('Highlight Dependencies to Root Device')</label>
|
||||
|
||||
Reference in New Issue
Block a user