Skip to content

Commit 7abb51d

Browse files
authored
Add ability to show single graph for Port Group (librenms#19518)
1 parent c1abd6a commit 7abb51d

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

includes/html/pages/iftype.inc.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
<table class="table table-condensed table-hover table-striped">
22
<?php
33

4+
use App\Models\PortGroup;
5+
46
$types_array = explode(',', strip_tags((string) $vars['type']));
5-
$ports = get_ports_from_type($types_array);
7+
$port_group = $vars['group'] ? PortGroup::find($vars['group'])
8+
->ports()
9+
->join('devices', 'ports.device_id', 'devices.device_id')
10+
->select('devices.*', 'ports.*')
11+
->get()
12+
->toArray() : null;
13+
$ports = $port_group ?? get_ports_from_type($types_array);
614

715
$if_list = implode(',', array_map(fn ($port) => $port['port_id'], $ports));
816

includes/html/pages/ports.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
}
6262
$sep = ' | ';
6363
}
64+
if (isset($vars['group']) && $vars['group']) {
65+
$displayLists .= ' | <a href="' . url('iftype/group=' . $vars['group']) . '"><i class="fa fa-chart-area fa-fw fa-lg"></i></a>';
66+
}
6467

6568
$displayLists .= '<div style="float: right;">';
6669
$displayLists .= '<a href="' . \LibreNMS\Util\Url::generate($vars) . '" title="Update the browser URL to reflect the search criteria.">Update URL</a> | ';

0 commit comments

Comments
 (0)