mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
API: return error when no ports found (#16043)
When looking up device ports (get_port_graphs), return an error when no ports are found. fixes #15964
This commit is contained in:
@@ -1070,6 +1070,10 @@ function get_port_graphs(Illuminate\Http\Request $request): JsonResponse
|
||||
$ports = $device->ports()->isNotDeleted()->hasAccess(Auth::user())
|
||||
->select($columns)->orderBy('ifIndex')->get();
|
||||
|
||||
if ($ports->isEmpty()) {
|
||||
return api_error(404, 'No ports found');
|
||||
}
|
||||
|
||||
return api_success($ports, 'ports');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user