Improved display for server view if not installed

This commit is contained in:
Dane Everitt 2016-01-22 20:39:16 -05:00
parent be47565c78
commit fbd1b3f097
3 changed files with 236 additions and 221 deletions

View file

@ -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', [

View file

@ -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();
}

View file

@ -43,10 +43,14 @@
@endif
<ul class="nav nav-tabs tabs_with_panel" id="config_tabs">
<li class="active"><a href="#tab_about" data-toggle="tab">About</a></li>
@if($server->installed === 1)
<li><a href="#tab_details" data-toggle="tab">Details</a></li>
<li><a href="#tab_build" data-toggle="tab">Build Configuration</a></li>
<li><a href="#tab_startup" data-toggle="tab">Startup</a></li>
@endif
@if($server->installed !== 2)
<li><a href="#tab_manage" data-toggle="tab">Manage</a></li>
@endif
<li><a href="#tab_delete" data-toggle="tab">Delete</a></li>
</ul>
<div class="tab-content">
@ -109,6 +113,7 @@
</div>
</div>
</div>
@if($server->installed === 1)
<div class="tab-pane" id="tab_details">
<div class="panel panel-default">
<div class="panel-heading"></div>
@ -300,6 +305,8 @@
</div>
</form>
</div>
@endif
@if($server->installed !== 2)
<div class="tab-pane" id="tab_manage">
<div class="panel panel-default">
<div class="panel-heading"></div>
@ -330,6 +337,7 @@
</div>
</div>
</div>
@if($server->installed === 1)
<div class="panel-heading" style="border-top: 1px solid #ddd;"></div>
<div class="panel-body">
<div class="row">
@ -345,8 +353,10 @@
</div>
</div>
</div>
@endif
</div>
</div>
@endif
<div class="tab-pane" id="tab_delete">
<div class="panel panel-default">
<div class="panel-heading"></div>