From fbd1b3f09795040fcc48003848899be3962c614c Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 22 Jan 2016 20:39:16 -0500 Subject: [PATCH] Improved display for server view if not installed --- .../Controllers/Admin/ServersController.php | 6 +- app/Repositories/ServerRepository.php | 3 + resources/views/admin/servers/view.blade.php | 448 +++++++++--------- 3 files changed, 236 insertions(+), 221 deletions(-) diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index c1105948b..a4e40febb 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -341,8 +341,10 @@ class ServersController extends Controller $server = new ServerRepository; $server->toggleInstall($id); Alert::success('Server status was successfully toggled.')->flash(); - } catch(\Exception $e) { - Log::error($e); + } catch (\Pterodactyl\Exceptions\DisplayException $ex) { + Alert::danger($ex->getMessage())->flash(); + } catch(\Exception $ex) { + Log::error($ex); Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash(); } finally { return redirect()->route('admin.servers.view', [ diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php index faa22f1dc..423f78e39 100644 --- a/app/Repositories/ServerRepository.php +++ b/app/Repositories/ServerRepository.php @@ -696,6 +696,9 @@ class ServerRepository public function toggleInstall($id) { $server = Models\Server::findOrFail($id); + if ($server->installed === 2) { + throw new DisplayException('This server was marked as having a failed install, you cannot override this.'); + } $server->installed = ($server->installed === 1) ? 0 : 1; return $server->save(); } diff --git a/resources/views/admin/servers/view.blade.php b/resources/views/admin/servers/view.blade.php index c3c7896b9..6ebdeefb5 100644 --- a/resources/views/admin/servers/view.blade.php +++ b/resources/views/admin/servers/view.blade.php @@ -43,10 +43,14 @@ @endif
@@ -109,244 +113,250 @@
-
-
-
-
-
-
- -
- -

Character limits: a-zA-Z0-9_- and [Space] (max 35 characters).

-
-
-
- -
- -

You can change the owner of this server by changing this field to an email matching another use on this system. If you do this a new daemon security token will be generated automatically.

-
-
-
- -
- -

This token should not be shared with anyone as it has full control over this server.

-
-
-
-
- Yes, Reset Daemon Token -

Resetting this token will cause any requests using the old token to fail.

-
-
-
- {!! csrf_field() !!} - -
-
-
-
-
-
-
-
-
-
-
-
- After editing any of the options below you will need to restart the server for changes to take effect. If the server is currently off, you just need to start it and the container will be rebuilt with the new settings. -
-
-
-
-
-
- -
- - MB -
-
-
- -
- - MB -
-

Setting this to 0 will disable swap space on this server.

-
-
-
-
- -
- - % -
-

Each physical core on the system is considered to be 100%. Setting this value to 0 will allow a server to use CPU time without restrictions.

-
-
- + @if($server->installed === 1) +
+
+
+
+ +
+
- -
-

Changing this value can have negative effects on all containers on the system. We strongly recommend leaving this value as 500.

-
-
-
-
-
-
- Additional IPs and Ports can be assigned to this server for use by plugins or other software. The game port is what will show up for the user to use to connect to thier server, and what their configuration files will be forced to use for binding. + +

Character limits: a-zA-Z0-9_- and [Space] (max 35 characters).

-
- - @foreach ($assigned as $assignment) -
- - ip == $server->ip && $assignment->port == $server->port) checked="checked" @endif name="default" value="{{ $assignment->ip }}:{{ $assignment->port }}"/> - - -
- @endforeach -
-
-
-
- -
- -
-

Please note that due to software limitations you cannot assign identical ports on different IPs to the same server. For example, you cannot assign both 192.168.0.5:25565 and 192.168.10.5:25565 to the same server.

-
-
-
-
- -
- -
-

Simply select which ports you would like to remove from the list above. If you want to assign a port on a different IP that is already in use you can select it above and delete it down here.

-
+
+ +
+ +

You can change the owner of this server by changing this field to an email matching another use on this system. If you do this a new daemon security token will be generated automatically.

-
-
-
+
+ +
+ +

This token should not be shared with anyone as it has full control over this server.

+
+
+
+
+ Yes, Reset Daemon Token +

Resetting this token will cause any requests using the old token to fail.

+
+
+
{!! csrf_field() !!} - +
-
- + +
-
-
-
+
-
Changing any of the values below will require a restart for them to take effect.
- -
- {{ $server->a_serviceExecutable }} - +
+ After editing any of the options below you will need to restart the server for changes to take effect. If the server is currently off, you just need to start it and the container will be rebuilt with the new settings.
-

The following data replacers are avaliable for the startup command: @{{SERVER_MEMORY}}, @{{SERVER_IP}}, and @{{SERVER_PORT}}. They will be replaced with the allocated memory, server ip, and server port respectively.

-
-
-
-
- @foreach($startup as $item) -
- -
- + +
+
+ +
+ + MB
-

{{ $item->description }}
Regex: {{ $item->regex }}
Access as: {{{{$item->env_variable}}}}

- @endforeach -
-
-
-
-
-
- {!! csrf_field() !!} - +
+ +
+ + MB +
+

Setting this to 0 will disable swap space on this server.

+
-
-
-
- -
-
-
-
-
-
- -
-

This will take you to the server management page that users normally see and allow you to manage server files as well as check the console and data usage.

-
-
-
-
-
-
-
-
- {!! csrf_field() !!} - -
-
-
-

This will toggle the install status for the server.

-
If you have just created this server it is ill advised to perform this action as the daemon will contact the panel when finished which could cause the install status to be wrongly set.
-
-
-
-
-
-
-
-
- {!! csrf_field() !!} - -
-
-
-

This will trigger a rebuild of the server container when it next starts up. This is useful if you modified the server configuration file manually, or something just didn't work out correctly. Please be aware: if you manually updated the server's configuration file, you will need to restart the daemon before doing this, or it will be overwritten.

-
A rebuild will automatically occur whenever you edit build configuration settings for the server.
-
+
+
+ +
+ + % +
+

Each physical core on the system is considered to be 100%. Setting this value to 0 will allow a server to use CPU time without restrictions.

+
+
+ +
+ +
+

Changing this value can have negative effects on all containers on the system. We strongly recommend leaving this value as 500.

+
+
+
+
+
+
+ Additional IPs and Ports can be assigned to this server for use by plugins or other software. The game port is what will show up for the user to use to connect to thier server, and what their configuration files will be forced to use for binding. +
+
+
+ + @foreach ($assigned as $assignment) +
+ + ip == $server->ip && $assignment->port == $server->port) checked="checked" @endif name="default" value="{{ $assignment->ip }}:{{ $assignment->port }}"/> + + +
+ @endforeach +
+
+
+
+ +
+ +
+

Please note that due to software limitations you cannot assign identical ports on different IPs to the same server. For example, you cannot assign both 192.168.0.5:25565 and 192.168.10.5:25565 to the same server.

+
+
+
+
+ +
+ +
+

Simply select which ports you would like to remove from the list above. If you want to assign a port on a different IP that is already in use you can select it above and delete it down here.

+
+
+
+
+
+
+ {!! csrf_field() !!} + +
+
+
-
+
+
+
+
+
+
+
+
Changing any of the values below will require a restart for them to take effect.
+ +
+ {{ $server->a_serviceExecutable }} + +
+

The following data replacers are avaliable for the startup command: @{{SERVER_MEMORY}}, @{{SERVER_IP}}, and @{{SERVER_PORT}}. They will be replaced with the allocated memory, server ip, and server port respectively.

+
+
+
+
+
+
+ @foreach($startup as $item) +
+ +
+ +
+

{{ $item->description }}
Regex: {{ $item->regex }}
Access as: {{{{$item->env_variable}}}}

+
+ @endforeach +
+
+
+
+
+
+ {!! csrf_field() !!} + +
+
+
+
+
+
+ @endif + @if($server->installed !== 2) +
+
+
+
+
+ +
+

This will take you to the server management page that users normally see and allow you to manage server files as well as check the console and data usage.

+
+
+
+
+
+
+
+
+ {!! csrf_field() !!} + +
+
+
+

This will toggle the install status for the server.

+
If you have just created this server it is ill advised to perform this action as the daemon will contact the panel when finished which could cause the install status to be wrongly set.
+
+
+
+ @if($server->installed === 1) +
+
+
+
+
+ {!! csrf_field() !!} + +
+
+
+

This will trigger a rebuild of the server container when it next starts up. This is useful if you modified the server configuration file manually, or something just didn't work out correctly. Please be aware: if you manually updated the server's configuration file, you will need to restart the daemon before doing this, or it will be overwritten.

+
A rebuild will automatically occur whenever you edit build configuration settings for the server.
+
+
+
+ @endif +
+
+ @endif