show device group on device overview (#15338)

* show device group on device overview

* .

* better styling on device group display
This commit is contained in:
SourceDoctor 2023-09-24 18:32:01 +02:00 committed by GitHub
parent 6e592f99c1
commit 5c9f3c80e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,24 @@
* @author LibreNMS Contributors * @author LibreNMS Contributors
*/ */
function show_device_group($device_group_id) {
$device_group_name = DB::table('device_groups')->where('id', $device_group_id)->value('name');
?>
<div class="panel-heading">
<span class="devices-font-bold">
<?php
if ($device_group_id == 'none') {
echo "ungrouped Devices";
} elseif ($device_group_id) {
echo "Device Group: ";
}
?>
</span>
<?php echo $device_group_name ?>
</div>
<?php
}
$pagetitle[] = 'Devices'; $pagetitle[] = 'Devices';
if (! isset($vars['format'])) { if (! isset($vars['format'])) {
@ -199,6 +217,7 @@ if ($format == 'graph') {
$where = substr($where, 0, strlen($where) - 3); $where = substr($where, 0, strlen($where) - 3);
$where .= ' )'; $where .= ' )';
} }
show_device_group($vars['group']);
$query = 'SELECT * FROM `devices` LEFT JOIN `locations` ON `devices`.`location_id` = `locations`.`id` WHERE 1'; $query = 'SELECT * FROM `devices` LEFT JOIN `locations` ON `devices`.`location_id` = `locations`.`id` WHERE 1';
@ -289,6 +308,7 @@ if ($format == 'graph') {
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<?php show_device_group($vars['group']); ?>
<table id="devices" class="table table-hover table-condensed table-striped"> <table id="devices" class="table table-hover table-condensed table-striped">
<thead> <thead>
<tr> <tr>