Fix admin overview error when node got deleted
on pterodactyl
This commit is contained in:
parent
17e2d284af
commit
3e99461a70
2 changed files with 15 additions and 1 deletions
|
@ -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();
|
||||
foreach($DBnodes = Node::query()->get() as $DBnode){ //gets all node information and prepares the structure
|
||||
$nodeId = $DBnode['id'];
|
||||
if(!in_array($nodeId, $pteroNodeIds)) continue; //Check if node exists on pterodactyl too, if not, skip
|
||||
$nodes->put($nodeId, collect());
|
||||
$nodes[$nodeId]->name = $DBnode['name'];
|
||||
$pteroNode = Pterodactyl::getNode($nodeId);
|
||||
|
@ -151,6 +156,7 @@ class OverViewController extends Controller
|
|||
'counters' => $counters,
|
||||
'nodes' => $nodes,
|
||||
'syncLastUpdate' => $syncLastUpdate,
|
||||
'deletedNodesPresent'=> ($DBnodes->count() != count($pteroNodeIds))?true:false,
|
||||
'perPageLimit' => ($counters['servers']->total != Server::query()->count())?true:false,
|
||||
'tickets' => $tickets
|
||||
]);
|
||||
|
|
|
@ -111,6 +111,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue