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;
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\DeviceGroup;
|
||||
use Flasher\Prime\FlasherInterface;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -26,13 +25,8 @@ 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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,7 @@ class DeviceController extends TableController
|
||||
'disabled' => 'nullable|in:0,1',
|
||||
'ignore' => 'nullable|in:0,1',
|
||||
'disable_notify' => 'nullable|in:0,1',
|
||||
'group' => 'nullable|int',
|
||||
'group' => ['nullable', 'regex:/^(\d+|none)$/'],
|
||||
'poller_group' => '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
|
||||
if ($group = $request->get('group')) {
|
||||
$query->whereHas('groups', function ($query) use ($group) {
|
||||
$query->where('id', $group);
|
||||
});
|
||||
if ($group == 'none') {
|
||||
$query->whereDoesntHave('groups');
|
||||
} else {
|
||||
$query->whereHas('groups', function ($query) use ($group) {
|
||||
$query->where('id', $group);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->get('poller_group') !== null) {
|
||||
|
Reference in New Issue
Block a user