fix error display when server is installing, closes #424
This commit is contained in:
parent
4f127b95f0
commit
a52d9eb0fb
8 changed files with 47 additions and 45 deletions
|
@ -3,6 +3,11 @@ This file is a running track of new features and fixes to each version of the pa
|
||||||
|
|
||||||
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
|
|
||||||
|
## v0.6.0 (Courageous Carniadactylus)
|
||||||
|
### Fixed
|
||||||
|
* `[rc.1]` — Server deletion is fixed, caused by removed download table.
|
||||||
|
* `[rc.1]` — Server status indication on front-end no longer shows `Error` when server is marked as installing or suspended.
|
||||||
|
|
||||||
## v0.6.0-rc.1 (Courageous Carniadactylus)
|
## v0.6.0-rc.1 (Courageous Carniadactylus)
|
||||||
### Fixed
|
### Fixed
|
||||||
* `[beta.2.1]` — Fixed a bug preventing the deletion of a server.
|
* `[beta.2.1]` — Fixed a bug preventing the deletion of a server.
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
namespace Pterodactyl\Http\Controllers\Base;
|
namespace Pterodactyl\Http\Controllers\Base;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
|
|
||||||
class IndexController extends Controller
|
class IndexController extends Controller
|
||||||
|
@ -71,4 +72,39 @@ class IndexController extends Controller
|
||||||
|
|
||||||
return $generated;
|
return $generated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns status of the server in a JSON response used for populating active status list.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param string $uuid
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function status(Request $request, $uuid)
|
||||||
|
{
|
||||||
|
$server = Server::byUuid($uuid);
|
||||||
|
|
||||||
|
if (! $server) {
|
||||||
|
return response()->json([], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $server->installed) {
|
||||||
|
return response()->json(['status' => 20]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($server->suspended) {
|
||||||
|
return response()->json(['status' => 30]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$res = $server->guzzleClient()->request('GET', '/server');
|
||||||
|
if ($res->getStatusCode() === 200) {
|
||||||
|
return response()->json(json_decode($res->getBody()));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,41 +50,6 @@ class AjaxController extends Controller
|
||||||
*/
|
*/
|
||||||
protected $directory;
|
protected $directory;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true or false depending on the power status of the requested server.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param string $uuid
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*/
|
|
||||||
public function getStatus(Request $request, $uuid)
|
|
||||||
{
|
|
||||||
$server = Models\Server::byUuid($uuid);
|
|
||||||
|
|
||||||
if (! $server) {
|
|
||||||
return response()->json([], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $server->installed) {
|
|
||||||
return response()->json(['status' => 20]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($server->suspended) {
|
|
||||||
return response()->json(['status' => 30]);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$res = $server->guzzleClient()->request('GET', '/server');
|
|
||||||
if ($res->getStatusCode() === 200) {
|
|
||||||
return response()->json(json_decode($res->getBody()));
|
|
||||||
}
|
|
||||||
} catch (RequestException $e) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a listing of files in a given directory for a server.
|
* Returns a listing of files in a given directory for a server.
|
||||||
*
|
*
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: Router.route('server.ajax.status', { server: serverShortUUID }),
|
url: Router.route('index.status', { server: serverShortUUID }),
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content'),
|
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content'),
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
<th class="text-center">@lang('strings.status')</th>
|
<th class="text-center">@lang('strings.status')</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($servers as $server)
|
@foreach($servers as $server)
|
||||||
<tr class=" {{$server->suspended ?: '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->node->name }}</td>
|
||||||
|
@ -79,11 +79,7 @@
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center" data-action="status">
|
<td class="text-center" data-action="status">
|
||||||
@if($server->suspended)
|
|
||||||
<span class="label label-warning">@lang('strings.suspended')</span>
|
|
||||||
@else
|
|
||||||
<span class="label label-default"><i class="fa fa-refresh fa-fw fa-spin"></i></span>
|
<span class="label label-default"><i class="fa fa-refresh fa-fw fa-spin"></i></span>
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if (! empty($server->description))
|
@if (! empty($server->description))
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
Route::get('/', 'IndexController@getIndex')->name('index');
|
Route::get('/', 'IndexController@getIndex')->name('index');
|
||||||
|
Route::get('/status/{server}', 'IndexController@status')->name('index.status');
|
||||||
|
|
||||||
Route::get('/index', function () {
|
Route::get('/index', function () {
|
||||||
redirect()->route('index');
|
redirect()->route('index');
|
||||||
});
|
});
|
||||||
|
|
|
@ -110,8 +110,6 @@ Route::group(['prefix' => 'tasks'], function () {
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
Route::group(['prefix' => 'ajax'], function () {
|
Route::group(['prefix' => 'ajax'], function () {
|
||||||
Route::get('/status', 'AjaxController@getStatus')->name('server.ajax.status');
|
|
||||||
|
|
||||||
Route::post('/set-primary', 'AjaxController@postSetPrimary')->name('server.ajax.set-primary');
|
Route::post('/set-primary', 'AjaxController@postSetPrimary')->name('server.ajax.set-primary');
|
||||||
Route::post('/settings/reset-database-password', 'AjaxController@postResetDatabasePassword')->name('server.ajax.reset-database-password');
|
Route::post('/settings/reset-database-password', 'AjaxController@postResetDatabasePassword')->name('server.ajax.reset-database-password');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue