mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 09:02:28 +01:00
Fix user search in admin area; closes #2100
This commit is contained in:
parent
88300e5448
commit
8b4bd3945d
@ -185,11 +185,20 @@ class UserController extends Controller
|
||||
*/
|
||||
public function json(Request $request)
|
||||
{
|
||||
$users = QueryBuilder::for(User::query())->allowedFilters(['email'])->paginate(25);
|
||||
|
||||
// Handle single user requests.
|
||||
if ($request->query('user_id')) {
|
||||
return $this->repository->filterById($request->input('user_id'));
|
||||
$user = User::query()->findOrFail($request->input('user_id'));
|
||||
$user->md5 = md5(strtolower($user->email));
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
return $this->repository->filterUsersByQuery($request->input('q'));
|
||||
return $users->map(function ($item) {
|
||||
$item->md5 = md5(strtolower($item->email));
|
||||
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ function initUserIdSelect(data) {
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params.term, // search term
|
||||
filter: { email: params.term },
|
||||
page: params.page,
|
||||
};
|
||||
},
|
||||
|
@ -31,7 +31,7 @@
|
||||
<div class="box-tools search01">
|
||||
<form action="{{ route('admin.nodes') }}" method="GET">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" name="query" class="form-control pull-right" value="{{ request()->input('query') }}" placeholder="Search Nodes">
|
||||
<input type="text" name="filter[name]" class="form-control pull-right" value="{{ request()->input('filter.name') }}" placeholder="Search Nodes">
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
|
||||
<a href="{{ route('admin.nodes.new') }}"><button type="button" class="btn btn-sm btn-primary" style="border-radius: 0 3px 3px 0;margin-left:-1px;">Create New</button></a>
|
||||
|
@ -327,7 +327,7 @@
|
||||
// END Persist 'Service Variables'
|
||||
</script>
|
||||
|
||||
{!! Theme::js('js/admin/new-server.js') !!}
|
||||
{!! Theme::js('js/admin/new-server.js?v=20200913') !!}
|
||||
|
||||
<script type="application/javascript">
|
||||
$(document).ready(function() {
|
||||
|
@ -73,7 +73,7 @@
|
||||
delay: 250,
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params.term, // search term
|
||||
filter: { email: params.term },
|
||||
page: params.page,
|
||||
};
|
||||
},
|
||||
|
@ -26,7 +26,7 @@
|
||||
<div class="box-tools search01">
|
||||
<form action="{{ route('admin.users') }}" method="GET">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" name="query" class="form-control pull-right" value="{{ request()->input('query') }}" placeholder="Search">
|
||||
<input type="text" name="filter[email]" class="form-control pull-right" value="{{ request()->input('filter.email') }}" placeholder="Search">
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
|
||||
<a href="{{ route('admin.users.new') }}"><button type="button" class="btn btn-sm btn-primary" style="border-radius: 0 3px 3px 0;margin-left:-1px;">Create New</button></a>
|
||||
|
Loading…
Reference in New Issue
Block a user