forked from Alex/Pterodactyl-Panel
parent
84a4c8b7f4
commit
649b18c8d1
@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
|
||||
### Added
|
||||
* Return node configuration from remote API by using `/api/nodes/{id}/config` endpoint. Only accepts SSL connections.
|
||||
* Support for filtering servers within Admin CP to narrow down results by name, email, allocation, or defined fields.
|
||||
|
||||
### Changed
|
||||
* Creating a user, server, or node now returns `HTTP/1.1 200` and a JSON element with the user/server/node's ID.
|
||||
|
@ -51,8 +51,40 @@ class ServersController extends Controller
|
||||
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
return view('admin.servers.index', [
|
||||
'servers' => Models\Server::select(
|
||||
$query = Models\Server::select(
|
||||
'servers.*',
|
||||
'nodes.name as a_nodeName',
|
||||
'users.email as a_ownerEmail',
|
||||
'allocations.ip',
|
||||
'allocations.port',
|
||||
'allocations.ip_alias'
|
||||
)->join('nodes', 'servers.node', '=', 'nodes.id')
|
||||
->join('users', 'servers.owner', '=', 'users.id')
|
||||
->join('allocations', 'servers.allocation', '=', 'allocations.id');
|
||||
|
||||
if ($request->input('filter') && !is_null($request->input('filter'))) {
|
||||
preg_match_all('/[^\s"\']+|"([^"]*)"|\'([^\']*)\'/', urldecode($request->input('filter')), $matches);
|
||||
foreach($matches[0] as $match) {
|
||||
$match = str_replace('"', '', $match);
|
||||
if (strpos($match, ':')) {
|
||||
list($field, $term) = explode(':', $match);
|
||||
$field = (strpos($field, '.')) ? $field : 'servers.' . $field;
|
||||
$query->orWhere($field, 'LIKE', '%' . $term . '%');
|
||||
} else {
|
||||
$query->where('servers.name', 'LIKE', '%' . $match . '%');
|
||||
$query->orWhere('servers.username', 'LIKE', '%' . $match . '%');
|
||||
$query->orWhere('users.email', 'LIKE', '%' . $match . '%');
|
||||
$query->orWhere('allocations.port', 'LIKE', '%' . $match . '%');
|
||||
$query->orWhere('allocations.ip', 'LIKE', '%' . $match . '%');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$servers = $query->paginate(20);
|
||||
} catch (\Exception $ex) {
|
||||
Alert::warning('There was an error with the search parameters provided.');
|
||||
$servers = Models\Server::select(
|
||||
'servers.*',
|
||||
'nodes.name as a_nodeName',
|
||||
'users.email as a_ownerEmail',
|
||||
@ -62,7 +94,11 @@ class ServersController extends Controller
|
||||
)->join('nodes', 'servers.node', '=', 'nodes.id')
|
||||
->join('users', 'servers.owner', '=', 'users.id')
|
||||
->join('allocations', 'servers.allocation', '=', 'allocations.id')
|
||||
->paginate(20),
|
||||
->paginate(20);
|
||||
}
|
||||
|
||||
return view('admin.servers.index', [
|
||||
'servers' => $servers
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,14 @@
|
||||
<li class="active">Servers</li>
|
||||
</ul>
|
||||
<h3>All Servers</h3><hr />
|
||||
<form method="GET" style="margin-bottom:20px;">
|
||||
<div class="input-group">
|
||||
<input type="text" name="filter" class="form-control" value="{{ urldecode(Input::get('filter')) }}" placeholder="search term" />
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-sm btn-primary">Filter Servers</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user