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 = new ServerRepository;
$server->toggleInstall($id); $server->toggleInstall($id);
Alert::success('Server status was successfully toggled.')->flash(); Alert::success('Server status was successfully toggled.')->flash();
} catch(\Exception $e) { } catch (\Pterodactyl\Exceptions\DisplayException $ex) {
Log::error($e); 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(); Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash();
} finally { } finally {
return redirect()->route('admin.servers.view', [ return redirect()->route('admin.servers.view', [

View file

@ -696,6 +696,9 @@ class ServerRepository
public function toggleInstall($id) public function toggleInstall($id)
{ {
$server = Models\Server::findOrFail($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; $server->installed = ($server->installed === 1) ? 0 : 1;
return $server->save(); return $server->save();
} }

View file

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