mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
List ungrouped devices on group management page (#10527)
* list ungrouped devices on group management page * some code changes * some code changes * change query to eager loading * use url macro * Update resources/views/device-group/index.blade.php Co-Authored-By: Neil Lathwood <gh+n@laf.io> * Title Case * style fixes * inline @if * remove container * revert force push
This commit is contained in:
committed by
Tony Murray
parent
d8eb3ab90e
commit
b606a42ba9
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\DeviceGroup;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -25,8 +26,13 @@ class DeviceGroupController extends Controller
|
||||
{
|
||||
$this->authorize('manage', DeviceGroup::class);
|
||||
|
||||
$ungrouped_devices = Device::orderBy('hostname')->whereNotIn('device_id', function ($query) {
|
||||
$query->select('device_id')->from('device_group_device');
|
||||
})->get();
|
||||
|
||||
return view('device-group.index', [
|
||||
'device_groups' => DeviceGroup::orderBy('name')->withCount('devices')->get(),
|
||||
'ungrouped_devices' => $ungrouped_devices,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -56,6 +56,37 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="unmanaged-devices-panel" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
@lang('Ungrouped Devices') ({{ $ungrouped_devices->count() }})
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="table-responsive">
|
||||
<table id="ungrouped-devices-table" class="table table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:32px">@lang('Vendor')</th>
|
||||
<th>@lang('Device')</th>
|
||||
<th>@lang('Platform')</th>
|
||||
<th>@lang('Operating System')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($ungrouped_devices as $device)
|
||||
<tr id="row_{{ $device->device_id }}">
|
||||
<td><img alt="{{ $device->os }}" src="{{ asset($device->icon) }}" width="32px" height="32px" title="{{ $device->os }}"></td>
|
||||
<td>{!! \LibreNMS\Util\Url::deviceLink($device) !!}<br />{{ $device->sysName }}</td>
|
||||
<td>{{ $device->hardware }}</td>
|
||||
<td>{{ $device->os }} {{ $device->version }} @if($device->features) ({{ $device->features }}) @endif </td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
Reference in New Issue
Block a user