mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Remove ungrouped devices panel (#14664)
The panel destroyed the page performance on larger installs. Now has a link to the devices list with new group=none filter.
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Device;
|
|
||||||
use App\Models\DeviceGroup;
|
use App\Models\DeviceGroup;
|
||||||
use Flasher\Prime\FlasherInterface;
|
use Flasher\Prime\FlasherInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -26,13 +25,8 @@ class DeviceGroupController extends Controller
|
|||||||
{
|
{
|
||||||
$this->authorize('manage', DeviceGroup::class);
|
$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', [
|
return view('device-group.index', [
|
||||||
'device_groups' => DeviceGroup::orderBy('name')->withCount('devices')->get(),
|
'device_groups' => DeviceGroup::orderBy('name')->withCount('devices')->get(),
|
||||||
'ungrouped_devices' => $ungrouped_devices,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ class DeviceController extends TableController
|
|||||||
'disabled' => 'nullable|in:0,1',
|
'disabled' => 'nullable|in:0,1',
|
||||||
'ignore' => 'nullable|in:0,1',
|
'ignore' => 'nullable|in:0,1',
|
||||||
'disable_notify' => 'nullable|in:0,1',
|
'disable_notify' => 'nullable|in:0,1',
|
||||||
'group' => 'nullable|int',
|
'group' => ['nullable', 'regex:/^(\d+|none)$/'],
|
||||||
'poller_group' => 'nullable|int',
|
'poller_group' => 'nullable|int',
|
||||||
'device_id' => 'nullable|int',
|
'device_id' => 'nullable|int',
|
||||||
];
|
];
|
||||||
@@ -102,9 +102,13 @@ class DeviceController extends TableController
|
|||||||
|
|
||||||
// filter device group, not sure this is the most efficient query
|
// filter device group, not sure this is the most efficient query
|
||||||
if ($group = $request->get('group')) {
|
if ($group = $request->get('group')) {
|
||||||
$query->whereHas('groups', function ($query) use ($group) {
|
if ($group == 'none') {
|
||||||
$query->where('id', $group);
|
$query->whereDoesntHave('groups');
|
||||||
});
|
} else {
|
||||||
|
$query->whereHas('groups', function ($query) use ($group) {
|
||||||
|
$query->where('id', $group);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->get('poller_group') !== null) {
|
if ($request->get('poller_group') !== null) {
|
||||||
|
@@ -14,6 +14,9 @@
|
|||||||
<a type="button" class="btn btn-primary" href="{{ route('device-groups.create') }}">
|
<a type="button" class="btn btn-primary" href="{{ route('device-groups.create') }}">
|
||||||
<i class="fa fa-plus"></i> {{ __('New Device Group') }}
|
<i class="fa fa-plus"></i> {{ __('New Device Group') }}
|
||||||
</a>
|
</a>
|
||||||
|
<a type="button" class="btn btn-default" href="{{ url('devices/group=none') }}">
|
||||||
|
<i class="fas fa-border-none"></i> {{ __('View Ungrouped Devices') }}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@@ -61,31 +64,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</x-panel>
|
</x-panel>
|
||||||
|
|
||||||
<x-panel id="unmanaged-devices-panel" title="{{ __('Ungrouped Devices') }} ({{ $ungrouped_devices->count() }})">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table id="ungrouped-devices-table" class="table table-condensed table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width:32px">{{ __('Vendor') }}</th>
|
|
||||||
<th>{{ __('Device') }}</th>
|
|
||||||
<th>{{ __('Platform') }}</th>
|
|
||||||
<th>{{ __('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><x-device-link :device="$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>
|
|
||||||
</x-panel>
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user