Replace location repository
This commit is contained in:
parent
860b2d890b
commit
126c9e940f
13 changed files with 33 additions and 154 deletions
|
@ -10,12 +10,12 @@ use Illuminate\Http\RedirectResponse;
|
|||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use Illuminate\View\Factory as ViewFactory;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Services\Databases\Hosts\HostUpdateService;
|
||||
use Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest;
|
||||
use Pterodactyl\Services\Databases\Hosts\HostCreationService;
|
||||
use Pterodactyl\Services\Databases\Hosts\HostDeletionService;
|
||||
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
|
||||
|
||||
class DatabaseController extends Controller
|
||||
|
@ -30,7 +30,6 @@ class DatabaseController extends Controller
|
|||
private HostCreationService $creationService,
|
||||
private HostDeletionService $deletionService,
|
||||
private HostUpdateService $updateService,
|
||||
private LocationRepositoryInterface $locationRepository,
|
||||
private ViewFactory $view
|
||||
) {
|
||||
}
|
||||
|
@ -40,8 +39,10 @@ class DatabaseController extends Controller
|
|||
*/
|
||||
public function index(): View
|
||||
{
|
||||
$locations = Location::with('nodes')->get();
|
||||
|
||||
return $this->view->make('admin.databases.index', [
|
||||
'locations' => $this->locationRepository->getAllWithNodes(),
|
||||
'locations' => $locations,
|
||||
'hosts' => $this->repository->getWithViewDetails(),
|
||||
]);
|
||||
}
|
||||
|
@ -53,8 +54,10 @@ class DatabaseController extends Controller
|
|||
*/
|
||||
public function view(int $host): View
|
||||
{
|
||||
$locations = Location::with('nodes')->get();
|
||||
|
||||
return $this->view->make('admin.databases.view', [
|
||||
'locations' => $this->locationRepository->getAllWithNodes(),
|
||||
'locations' => $locations,
|
||||
'host' => $this->repository->find($host),
|
||||
'databases' => $this->databaseRepository->getDatabasesForHost($host),
|
||||
]);
|
||||
|
|
|
@ -13,7 +13,6 @@ use Pterodactyl\Http\Requests\Admin\LocationFormRequest;
|
|||
use Pterodactyl\Services\Locations\LocationUpdateService;
|
||||
use Pterodactyl\Services\Locations\LocationCreationService;
|
||||
use Pterodactyl\Services\Locations\LocationDeletionService;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
|
||||
class LocationController extends Controller
|
||||
{
|
||||
|
@ -24,7 +23,6 @@ class LocationController extends Controller
|
|||
protected AlertsMessageBag $alert,
|
||||
protected LocationCreationService $creationService,
|
||||
protected LocationDeletionService $deletionService,
|
||||
protected LocationRepositoryInterface $repository,
|
||||
protected LocationUpdateService $updateService,
|
||||
protected ViewFactory $view
|
||||
) {
|
||||
|
@ -35,20 +33,23 @@ class LocationController extends Controller
|
|||
*/
|
||||
public function index(): View
|
||||
{
|
||||
$locations = Location::query()->withCount(['nodes', 'servers'])->get();
|
||||
|
||||
return $this->view->make('admin.locations.index', [
|
||||
'locations' => $this->repository->getAllWithDetails(),
|
||||
'locations' => $locations,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the location view page.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function view(int $id): View
|
||||
{
|
||||
$location = Location::with('nodes.servers')->findOrFail($id);
|
||||
|
||||
return $this->view->make('admin.locations.view', [
|
||||
'location' => $this->repository->getWithNodes($id),
|
||||
'location' => $location,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
use Pterodactyl\Http\Requests\Admin\MountFormRequest;
|
||||
use Pterodactyl\Repositories\Eloquent\MountRepository;
|
||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
|
||||
class MountController extends Controller
|
||||
{
|
||||
|
@ -26,7 +25,6 @@ class MountController extends Controller
|
|||
public function __construct(
|
||||
protected AlertsMessageBag $alert,
|
||||
protected NestRepositoryInterface $nestRepository,
|
||||
protected LocationRepositoryInterface $locationRepository,
|
||||
protected MountRepository $repository,
|
||||
protected ViewFactory $view
|
||||
) {
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Controllers\Admin\Nodes;
|
|||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Illuminate\Support\Collection;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
|
@ -13,7 +14,6 @@ use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
|||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||
use Pterodactyl\Traits\Controllers\JavascriptInjection;
|
||||
use Pterodactyl\Services\Helpers\SoftwareVersionService;
|
||||
use Pterodactyl\Repositories\Eloquent\LocationRepository;
|
||||
use Pterodactyl\Repositories\Eloquent\AllocationRepository;
|
||||
|
||||
class NodeViewController extends Controller
|
||||
|
@ -25,7 +25,6 @@ class NodeViewController extends Controller
|
|||
*/
|
||||
public function __construct(
|
||||
private AllocationRepository $allocationRepository,
|
||||
private LocationRepository $locationRepository,
|
||||
private NodeRepository $repository,
|
||||
private ServerRepository $serverRepository,
|
||||
private SoftwareVersionService $versionService,
|
||||
|
@ -54,7 +53,7 @@ class NodeViewController extends Controller
|
|||
{
|
||||
return $this->view->make('admin.nodes.view.settings', [
|
||||
'node' => $node,
|
||||
'locations' => $this->locationRepository->all(),
|
||||
'locations' => Location::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Pterodactyl\Http\Controllers\Admin;
|
|||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Http\Response;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
|
@ -22,7 +23,6 @@ use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
|||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\Admin\Node\AllocationFormRequest;
|
||||
use Pterodactyl\Services\Allocations\AllocationDeletionService;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\Admin\Node\AllocationAliasFormRequest;
|
||||
|
||||
|
@ -39,7 +39,6 @@ class NodesController extends Controller
|
|||
protected CacheRepository $cache,
|
||||
protected NodeCreationService $creationService,
|
||||
protected NodeDeletionService $deletionService,
|
||||
protected LocationRepositoryInterface $locationRepository,
|
||||
protected NodeRepositoryInterface $repository,
|
||||
protected ServerRepositoryInterface $serverRepository,
|
||||
protected NodeUpdateService $updateService,
|
||||
|
@ -53,7 +52,7 @@ class NodesController extends Controller
|
|||
*/
|
||||
public function create(): View|RedirectResponse
|
||||
{
|
||||
$locations = $this->locationRepository->all();
|
||||
$locations = Location::all();
|
||||
if (count($locations) < 1) {
|
||||
$this->alert->warning(trans('admin/node.notices.location_required'))->flash();
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Illuminate\View\View;
|
|||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Services\Servers\EnvironmentService;
|
||||
|
@ -16,7 +17,6 @@ use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
|||
use Pterodactyl\Repositories\Eloquent\MountRepository;
|
||||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||
use Pterodactyl\Traits\Controllers\JavascriptInjection;
|
||||
use Pterodactyl\Repositories\Eloquent\LocationRepository;
|
||||
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
|
||||
|
||||
class ServerViewController extends Controller
|
||||
|
@ -28,7 +28,6 @@ class ServerViewController extends Controller
|
|||
*/
|
||||
public function __construct(
|
||||
private DatabaseHostRepository $databaseHostRepository,
|
||||
private LocationRepository $locationRepository,
|
||||
private MountRepository $mountRepository,
|
||||
private NestRepository $nestRepository,
|
||||
private NodeRepository $nodeRepository,
|
||||
|
@ -140,7 +139,7 @@ class ServerViewController extends Controller
|
|||
|
||||
return $this->view->make('admin.servers.view.manage', [
|
||||
'server' => $server,
|
||||
'locations' => $this->locationRepository->all(),
|
||||
'locations' => Location::all(),
|
||||
'canTransfer' => $canTransfer,
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue