Merge pull request #573 from ok236449/Delete-server-on-404

Some fixes that shouldn´t have been necessary
This commit is contained in:
Dennis 2022-08-23 21:10:37 +02:00 committed by GitHub
commit 5996a4cd8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 105 additions and 103 deletions

View file

@ -97,7 +97,7 @@ class OverViewController extends Controller
$output[$nodeId]->totalEarnings = 0;
$output[$nodeId]->activeEarnings = 0;
}
$counters['totalUsagePercent'] = round($counters['totalUsagePercent']/$nodes->count(), 2);
$counters['totalUsagePercent'] = ($nodes->count())?round($counters['totalUsagePercent']/$nodes->count(), 2):0;
foreach(Pterodactyl::getServers() as $server){ //gets all servers from Pterodactyl and calculates total of credit usage for each node separately + total
$nodeId = $server['attributes']['node'];

View file

@ -209,7 +209,8 @@
<h5><i class="icon fas fa-exclamation-circle"></i>{{ __('Error!') }}</h5>
<p class="">
{{ __('You reached the Pterodactyl perPage limit. Please make sure to set it higher than your server count.') }}<br>
{{ __('You can do that in settings.') }}
{{ __('You can do that in settings.') }}<br>
{{ __('Note') }}: {{ __('If this error persists even after changing the limit, it might mean a server was deleted on Pterodactyl, but not on ControlPanel.') }}
</p>
</div>
@endif

View file

@ -40,127 +40,128 @@
<div class="row d-flex flex-row justify-content-center justify-content-md-start">
@foreach ($servers as $server)
<div class="col-xl-3 col-lg-5 col-md-6 col-sm-6 col-xs-12 card pr-0 pl-0 ml-sm-2 mr-sm-3"
style="max-width: 350px">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h5 class="card-title mt-1">{{ $server->name }}
</h5>
<div class="card-tools mt-1">
<div class="dropdown no-arrow">
<a href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-white-50"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in"
aria-labelledby="dropdownMenuLink">
@if (!empty(config('SETTINGS::MISC:PHPMYADMIN:URL')))
<a href="{{ config('SETTINGS::MISC:PHPMYADMIN:URL') }}"
class="dropdown-item text-info" target="__blank"><i title="manage"
class="fas fa-database mr-2"></i><span>{{ __('Database') }}</span></a>
@endif
<div class="dropdown-divider"></div>
<span class="dropdown-item"><i title="Created at"
class="fas fa-sync-alt mr-2"></i><span>{{ $server->created_at->isoFormat('LL') }}</span></span>
@if($server->location&&$server->node&&$server->nest&&$server->egg)
<div class="col-xl-3 col-lg-5 col-md-6 col-sm-6 col-xs-12 card pr-0 pl-0 ml-sm-2 mr-sm-3"
style="max-width: 350px">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h5 class="card-title mt-1">{{ $server->name }}
</h5>
<div class="card-tools mt-1">
<div class="dropdown no-arrow">
<a href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-white-50"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in"
aria-labelledby="dropdownMenuLink">
@if (!empty(config('SETTINGS::MISC:PHPMYADMIN:URL')))
<a href="{{ config('SETTINGS::MISC:PHPMYADMIN:URL') }}"
class="dropdown-item text-info" target="__blank"><i title="manage"
class="fas fa-database mr-2"></i><span>{{ __('Database') }}</span></a>
@endif
<div class="dropdown-divider"></div>
<span class="dropdown-item"><i title="Created at"
class="fas fa-sync-alt mr-2"></i><span>{{ $server->created_at->isoFormat('LL') }}</span></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-body">
<div class="container mt-1">
<div class="row mb-3">
<div class="col my-auto">{{ __('Status') }}:</div>
<div class="col-7 my-auto">
<i
class="fas {{ $server->isSuspended() ? 'text-danger' : 'text-success' }} fa-circle mr-2"></i>
{{ $server->isSuspended() ? 'Suspended' : 'Active' }}
</div>
</div>
<div class="row mb-2">
<div class="col-5">
{{ __('Location') }}:
</div>
<div class="col-7 d-flex justify-content-between align-items-center">
<span class="">{{ $server->location }}</span>
<i data-toggle="popover" data-trigger="hover"
data-content="{{ __('Node') }}: {{ $server->node }}"
class="fas fa-info-circle"></i>
<div class="card-body">
<div class="container mt-1">
<div class="row mb-3">
<div class="col my-auto">{{ __('Status') }}:</div>
<div class="col-7 my-auto">
<i
class="fas {{ $server->isSuspended() ? 'text-danger' : 'text-success' }} fa-circle mr-2"></i>
{{ $server->isSuspended() ? 'Suspended' : 'Active' }}
</div>
</div>
<div class="row mb-2">
<div class="col-5">
{{ __('Location') }}:
</div>
<div class="col-7 d-flex justify-content-between align-items-center">
<span class="">{{ $server->location }}</span>
<i data-toggle="popover" data-trigger="hover"
data-content="{{ __('Node') }}: {{ $server->node }}"
class="fas fa-info-circle"></i>
</div>
</div>
<div class="row mb-2">
<div class="col-5 ">
{{ __('Software') }}:
</div>
<div class="col-7 text-wrap">
<span>{{ $server->nest }}</span>
</div>
<div class="row mb-2">
<div class="col-5 ">
{{ __('Software') }}:
</div>
<div class="col-7 text-wrap">
<span>{{ $server->nest }}</span>
</div>
</div>
<div class="row mb-2">
<div class="col-5 ">
{{ __('Specification') }}:
</div>
<div class="col-7 text-wrap">
<span>{{ $server->egg }}</span>
</div>
</div>
<div class="row mb-4">
<div class="col-5 ">
{{ __('Resource plan') }}:
</div>
<div class="col-7 text-wrap d-flex justify-content-between align-items-center">
<span>{{ $server->product->name }}
</span>
<i data-toggle="popover" data-trigger="hover" data-html="true"
data-content="{{ __('CPU') }}: {{ $server->product->cpu / 100 }} {{ __('vCores') }} <br/>{{ __('RAM') }}: {{ $server->product->memory }} MB <br/>{{ __('Disk') }}: {{ $server->product->disk }} MB <br/>{{ __('Backups') }}: {{ $server->product->backups }} <br/> {{ __('MySQL Databases') }}: {{ $server->product->databases }} <br/> {{ __('Allocations') }}: {{ $server->product->allocations }} <br/>"
class="fas fa-info-circle"></i>
<div class="row mb-2">
<div class="col-5 ">
{{ __('Specification') }}:
</div>
<div class="col-7 text-wrap">
<span>{{ $server->egg }}</span>
</div>
</div>
<div class="row mb-4">
<div class="col-5 ">
{{ __('Resource plan') }}:
</div>
<div class="col-7 text-wrap d-flex justify-content-between align-items-center">
<span>{{ $server->product->name }}
</span>
<i data-toggle="popover" data-trigger="hover" data-html="true"
data-content="{{ __('CPU') }}: {{ $server->product->cpu / 100 }} {{ __('vCores') }} <br/>{{ __('RAM') }}: {{ $server->product->memory }} MB <br/>{{ __('Disk') }}: {{ $server->product->disk }} MB <br/>{{ __('Backups') }}: {{ $server->product->backups }} <br/> {{ __('MySQL Databases') }}: {{ $server->product->databases }} <br/> {{ __('Allocations') }}: {{ $server->product->allocations }} <br/>"
class="fas fa-info-circle"></i>
</div>
</div>
<div class="row mb-2">
<div class="col-4">
{{ __('Price') }}:
<span class="text-muted">
({{ CREDITS_DISPLAY_NAME }})
</span>
</div>
<div class="col-8">
<div class="row">
<div class="col-6 text-center">
<div class="text-muted">{{ __('per Hour') }}</div>
<span>
{{ number_format($server->product->getHourlyPrice(), 2, '.', '') }}
</span>
</div>
<div class="col-6 text-center">
<div class="text-muted">{{ __('per Month') }}
<div class="row mb-2">
<div class="col-4">
{{ __('Price') }}:
<span class="text-muted">
({{ CREDITS_DISPLAY_NAME }})
</span>
</div>
<div class="col-8">
<div class="row">
<div class="col-6 text-center">
<div class="text-muted">{{ __('per Hour') }}</div>
<span>
{{ number_format($server->product->getHourlyPrice(), 2, '.', '') }}
</span>
</div>
<div class="col-6 text-center">
<div class="text-muted">{{ __('per Month') }}
</div>
<span>
{{ $server->product->getHourlyPrice() * 24 * 30 }}
</span>
</div>
<span>
{{ $server->product->getHourlyPrice() * 24 * 30 }}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<a href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}"
target="__blank"
class="btn btn-info mx-3 w-100 align-items-center justify-content-center d-flex">
<i class="fas fa-tools mr-2"></i>
<span>{{ __('Manage') }}</span>
</a>
<a href="{{ route('servers.show', ['server' => $server->id])}}" class="btn btn-warning mx-3 w-100 align-items-center justify-content-center d-flex">
<i class="fas fa-cog mr-2"></i>
<span>{{ __('Settings') }}</span>
</a>
<div class="card-footer d-flex align-items-center justify-content-between">
<a href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}"
target="__blank"
class="btn btn-info mx-3 w-100 align-items-center justify-content-center d-flex">
<i class="fas fa-tools mr-2"></i>
<span>{{ __('Manage') }}</span>
</a>
<a href="{{ route('servers.show', ['server' => $server->id])}}" class="btn btn-warning mx-3 w-100 align-items-center justify-content-center d-flex">
<i class="fas fa-cog mr-2"></i>
<span>{{ __('Settings') }}</span>
</a>
</div>
</div>
</div>
@endif
@endforeach
</div>
<!-- END CUSTOM CONTENT -->