1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

Respect pagination settings on frontend

closes #1335
This commit is contained in:
Dane Everitt 2018-11-10 12:38:35 -08:00
parent 8af50e1d1a
commit a9fa60a6fb
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
5 changed files with 8 additions and 7 deletions

View File

@ -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.
* Terminal was not properly displaying longer lines leading to some visual inconsistency.
* Assorted translation updates.
* Pagination for server listing now properly respects configuration setting.
### Changed
* Removed PhraseApp integration from Panel code as it is no longer used.

View File

@ -103,10 +103,10 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter
*
* @param \Pterodactyl\Models\User $user
* @param int $level
* @param bool $paginate
* @param bool|int $paginate
* @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.

View File

@ -35,7 +35,7 @@ class ClientController extends ClientApiController
*/
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)
->transformWith($this->getTransformer(ServerTransformer::class))

View File

@ -56,7 +56,7 @@ class IndexController extends Controller
public function getIndex(Request $request)
{
$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]);

View File

@ -211,10 +211,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*
* @param \Pterodactyl\Models\User $user
* @param int $level
* @param bool $paginate
* @param bool|int $paginate
* @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']);
@ -240,7 +240,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
$instance->search($this->getSearchTerm());
return $paginate ? $instance->paginate(25) : $instance->get();
return $paginate ? $instance->paginate($paginate) : $instance->get();
}
/**