Fix SQl queries being executed unnecessarily when listing servers
This commit is contained in:
parent
eaf54a8c63
commit
a31334c0c5
3 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fixes application API keys being created as a client API key.
|
* Fixes application API keys being created as a client API key.
|
||||||
* Search term is now passed through when using paginated result sets.
|
* Search term is now passed through when using paginated result sets.
|
||||||
|
* Reduces the number of SQL queries executed when rendering the server listing to increase performance.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Databases are now properly paginated when viewing a database host.
|
* Databases are now properly paginated when viewing a database host.
|
||||||
|
|
|
@ -216,7 +216,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||||
*/
|
*/
|
||||||
public function filterUserAccessServers(User $user, int $level, bool $paginate = true)
|
public function filterUserAccessServers(User $user, int $level, bool $paginate = true)
|
||||||
{
|
{
|
||||||
$instance = $this->getBuilder()->select($this->getColumns())->with(['user']);
|
$instance = $this->getBuilder()->select($this->getColumns())->with(['user', 'node', 'allocation']);
|
||||||
|
|
||||||
// If access level is set to owner, only display servers
|
// If access level is set to owner, only display servers
|
||||||
// that the user owns.
|
// that the user owns.
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
<tr class="dynamic-update" data-server="{{ $server->uuidShort }}">
|
<tr class="dynamic-update" data-server="{{ $server->uuidShort }}">
|
||||||
<td @if(! empty($server->description)) rowspan="2" @endif><code>{{ $server->uuidShort }}</code></td>
|
<td @if(! empty($server->description)) rowspan="2" @endif><code>{{ $server->uuidShort }}</code></td>
|
||||||
<td><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></td>
|
<td><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></td>
|
||||||
<td>{{ $server->node->name }}</td>
|
<td>{{ $server->getRelation('node')->name }}</td>
|
||||||
<td><code>{{ $server->allocation->alias }}:{{ $server->allocation->port }}</code></td>
|
<td><code>{{ $server->getRelation('allocation')->alias }}:{{ $server->getRelation('allocation')->port }}</code></td>
|
||||||
<td class="text-center hidden-sm hidden-xs"><span data-action="memory">--</span> / {{ $server->memory === 0 ? '∞' : $server->memory }} MB</td>
|
<td class="text-center hidden-sm hidden-xs"><span data-action="memory">--</span> / {{ $server->memory === 0 ? '∞' : $server->memory }} MB</td>
|
||||||
<td class="text-center hidden-sm hidden-xs"><span data-action="cpu" data-cpumax="{{ $server->cpu }}">--</span> %</td>
|
<td class="text-center hidden-sm hidden-xs"><span data-action="cpu" data-cpumax="{{ $server->cpu }}">--</span> %</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
|
|
Loading…
Reference in a new issue