parent
8af50e1d1a
commit
a9fa60a6fb
|
@ -9,6 +9,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
* TS3 egg updated to use CLI arguments correctly and have a more minimalistic installation script.
|
* TS3 egg updated to use CLI arguments correctly and have a more minimalistic installation script.
|
||||||
* Terminal was not properly displaying longer lines leading to some visual inconsistency.
|
* Terminal was not properly displaying longer lines leading to some visual inconsistency.
|
||||||
* Assorted translation updates.
|
* Assorted translation updates.
|
||||||
|
* Pagination for server listing now properly respects configuration setting.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Removed PhraseApp integration from Panel code as it is no longer used.
|
* Removed PhraseApp integration from Panel code as it is no longer used.
|
||||||
|
|
|
@ -103,10 +103,10 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Models\User $user
|
* @param \Pterodactyl\Models\User $user
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @param bool $paginate
|
* @param bool|int $paginate
|
||||||
* @return \Illuminate\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection
|
* @return \Illuminate\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection
|
||||||
*/
|
*/
|
||||||
public function filterUserAccessServers(User $user, int $level, bool $paginate = true);
|
public function filterUserAccessServers(User $user, int $level, $paginate = 25);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a server by UUID.
|
* Return a server by UUID.
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ClientController extends ClientApiController
|
||||||
*/
|
*/
|
||||||
public function index(GetServersRequest $request): array
|
public function index(GetServersRequest $request): array
|
||||||
{
|
{
|
||||||
$servers = $this->repository->filterUserAccessServers($request->user(), User::FILTER_LEVEL_SUBUSER);
|
$servers = $this->repository->filterUserAccessServers($request->user(), User::FILTER_LEVEL_SUBUSER, config('pterodactyl.paginate.frontend.servers'));
|
||||||
|
|
||||||
return $this->fractal->collection($servers)
|
return $this->fractal->collection($servers)
|
||||||
->transformWith($this->getTransformer(ServerTransformer::class))
|
->transformWith($this->getTransformer(ServerTransformer::class))
|
||||||
|
|
|
@ -56,7 +56,7 @@ class IndexController extends Controller
|
||||||
public function getIndex(Request $request)
|
public function getIndex(Request $request)
|
||||||
{
|
{
|
||||||
$servers = $this->repository->setSearchTerm($request->input('query'))->filterUserAccessServers(
|
$servers = $this->repository->setSearchTerm($request->input('query'))->filterUserAccessServers(
|
||||||
$request->user(), User::FILTER_LEVEL_ALL
|
$request->user(), User::FILTER_LEVEL_ALL, config('pterodactyl.paginate.frontend.servers')
|
||||||
);
|
);
|
||||||
|
|
||||||
return view('base.index', ['servers' => $servers]);
|
return view('base.index', ['servers' => $servers]);
|
||||||
|
|
|
@ -211,10 +211,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Models\User $user
|
* @param \Pterodactyl\Models\User $user
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @param bool $paginate
|
* @param bool|int $paginate
|
||||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection
|
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection
|
||||||
*/
|
*/
|
||||||
public function filterUserAccessServers(User $user, int $level, bool $paginate = true)
|
public function filterUserAccessServers(User $user, int $level, $paginate = 25)
|
||||||
{
|
{
|
||||||
$instance = $this->getBuilder()->select($this->getColumns())->with(['user', 'node', 'allocation']);
|
$instance = $this->getBuilder()->select($this->getColumns())->with(['user', 'node', 'allocation']);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||||
|
|
||||||
$instance->search($this->getSearchTerm());
|
$instance->search($this->getSearchTerm());
|
||||||
|
|
||||||
return $paginate ? $instance->paginate(25) : $instance->get();
|
return $paginate ? $instance->paginate($paginate) : $instance->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue