Merge pull request #588 from ok236449/development-3
Fix admin overview error when node got deleted
This commit is contained in:
commit
e1803366b6
|
@ -81,10 +81,15 @@ class OverViewController extends Controller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Get node information
|
//Get node information and prepare collection
|
||||||
|
$pteroNodeIds = [];
|
||||||
|
foreach(Pterodactyl::getNodes() as $pteroNode){
|
||||||
|
array_push($pteroNodeIds, $pteroNode['attributes']['id']);
|
||||||
|
}
|
||||||
$nodes = collect();
|
$nodes = collect();
|
||||||
foreach($DBnodes = Node::query()->get() as $DBnode){ //gets all node information and prepares the structure
|
foreach($DBnodes = Node::query()->get() as $DBnode){ //gets all node information and prepares the structure
|
||||||
$nodeId = $DBnode['id'];
|
$nodeId = $DBnode['id'];
|
||||||
|
if(!in_array($nodeId, $pteroNodeIds)) continue; //Check if node exists on pterodactyl too, if not, skip
|
||||||
$nodes->put($nodeId, collect());
|
$nodes->put($nodeId, collect());
|
||||||
$nodes[$nodeId]->name = $DBnode['name'];
|
$nodes[$nodeId]->name = $DBnode['name'];
|
||||||
$pteroNode = Pterodactyl::getNode($nodeId);
|
$pteroNode = Pterodactyl::getNode($nodeId);
|
||||||
|
@ -151,6 +156,7 @@ class OverViewController extends Controller
|
||||||
'counters' => $counters,
|
'counters' => $counters,
|
||||||
'nodes' => $nodes,
|
'nodes' => $nodes,
|
||||||
'syncLastUpdate' => $syncLastUpdate,
|
'syncLastUpdate' => $syncLastUpdate,
|
||||||
|
'deletedNodesPresent'=> ($DBnodes->count() != count($pteroNodeIds))?true:false,
|
||||||
'perPageLimit' => ($counters['servers']->total != Server::query()->count())?true:false,
|
'perPageLimit' => ($counters['servers']->total != Server::query()->count())?true:false,
|
||||||
'tickets' => $tickets
|
'tickets' => $tickets
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -111,6 +111,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body py-1">
|
<div class="card-body py-1">
|
||||||
|
@if ($deletedNodesPresent)
|
||||||
|
<div class="alert alert-danger m-2">
|
||||||
|
<h5><i class="icon fas fa-exclamation-circle"></i>{{ __('Warning!') }}</h5>
|
||||||
|
<p class="mb-2">
|
||||||
|
{{ __('Some nodes got deleted on pterodactyl only. Please click the sync button above.') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in a new issue