Skip to content

Commit 9f54ff2

Browse files
committed
Add back manage and delete tabs to server view
Will come back to deal with Startup and Database tabs at a later date.
1 parent fb21bf9 commit 9f54ff2

File tree

4 files changed

+97
-6
lines changed

4 files changed

+97
-6
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all
11+
// copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
// SOFTWARE.
20+
$.urlParam=function(name){var results=new RegExp("[\\?&]"+name+"=([^&#]*)").exec(decodeURIComponent(window.location.href));if(results==null){return null}else{return results[1]||0}};function getPageName(url){var index=url.lastIndexOf("/")+1;var filenameWithExtension=url.substr(index);var filename=filenameWithExtension.split(".")[0];return filename}
21+
// Remeber Active Tab and Navigate to it on Reload
22+
for(var queryParameters={},queryString=location.search.substring(1),re=/([^&=]+)=([^&]*)/g,m;m=re.exec(queryString);)queryParameters[decodeURIComponent(m[1])]=decodeURIComponent(m[2]);$("a[data-toggle='tab']").click(function(){queryParameters.tab=$(this).attr("href").substring(1),window.history.pushState(null,null,location.pathname+"?"+$.param(queryParameters))});
23+
if($.urlParam('tab') != null){$('.nav.nav-tabs a[href="#' + $.urlParam('tab') + '"]').tab('show');}

resources/themes/pterodactyl/admin/servers/view.blade.php

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,70 @@
293293
{{-- End Database / Start Manage --}}
294294
@if($server->installed !== 2)
295295
<div class="tab-pane" id="tab_manage">
296-
Manage
296+
<div class="row">
297+
<div class="col-sm-6 col-md-4 text-center">
298+
<form action="/admin/servers/view/{{ $server->id }}/installed" method="POST">
299+
{!! csrf_field() !!}
300+
<button type="submit" class="btn btn-primary">Toggle Install Status</button>
301+
<p class="text-muted small">This will toggle the install status for the server.</p>
302+
</form>
303+
</div>
304+
<div class="col-sm-6 col-md-4 text-center">
305+
<form action="/admin/servers/view/{{ $server->id }}/rebuild" method="POST">
306+
{!! csrf_field() !!}
307+
<button type="submit" class="btn btn-primary">Rebuild Server Container</button>
308+
<p class="text-muted small">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.</p>
309+
</form>
310+
</div>
311+
<div class="col-sm-6 col-md-4 text-center">
312+
@if(! $server->suspended)
313+
<form action="/admin/servers/view/{{ $server->id }}/suspend" method="POST">
314+
{!! csrf_field() !!}
315+
<button type="submit" class="btn btn-warning">Suspend Server</button>
316+
<p class="text-muted small">This will suspend the server, stop any running processes, and immediately block the user from being able to access their files or otherwise manage the server through the panel or API.</p>
317+
</form>
318+
@else
319+
<form action="/admin/servers/view/{{ $server->id }}/unsuspend" method="POST">
320+
{!! csrf_field() !!}
321+
<button type="submit" class="btn btn-success">Unsuspend Server</button>
322+
<p class="text-muted small">This will unsuspend the server and restore normal user access.</p>
323+
</form>
324+
@endif
325+
</div>
326+
</div>
297327
</div>
298328
@endif
299329
{{-- End Manage / Start Delete --}}
300330
@if(! $server->trashed())
301331
<div class="tab-pane" id="tab_delete">
302-
Delete
332+
<div class="row">
333+
@if($server->installed)
334+
<div class="col-sm-6">
335+
<form action="/admin/servers/view/{{ $server->id }}" class="text-center" method="POST" data-attr="deleteServer">
336+
{!! csrf_field() !!}
337+
{!! method_field('DELETE') !!}
338+
<button type="submit" class="btn btn-danger">Delete Server</button>
339+
</form>
340+
<p>
341+
<div class="callout callout-danger">
342+
Deleting a server is an irreversible action. <strong>All data will be immediately removed relating to this server.</strong>
343+
</div>
344+
</p>
345+
</div>
346+
@endif
347+
<div class="col-sm-6">
348+
<form action="/admin/servers/view/{{ $server->id }}/force" class="text-center" method="POST" data-attr="deleteServer">
349+
{!! csrf_field() !!}
350+
{!! method_field('DELETE') !!}
351+
<button type="submit" class="btn btn-danger">Force Delete Server</button>
352+
</form>
353+
<p>
354+
<div class="callout callout-danger">
355+
This is the same as deleting a server, however, if an error is returned by the daemon it is ignored and the server is still removed from the panel.
356+
</div>
357+
</p>
358+
</div>
359+
</div>
303360
</div>
304361
@endif
305362
{{-- End Delete --}}
@@ -312,6 +369,20 @@
312369
@section('footer-scripts')
313370
@parent
314371
<script>
372+
$('form[data-attr="deleteServer"]').submit(function (event) {
373+
event.preventDefault();
374+
swal({
375+
title: '',
376+
type: 'warning',
377+
text: 'Are you sure that you want to delete this server? There is no going back, all data will immediately be removed.',
378+
showCancelButton: true,
379+
confirmButtonText: 'Delete',
380+
confirmButtonColor: '#d9534f',
381+
closeOnConfirm: false
382+
}, function () {
383+
event.target.submit();
384+
});
385+
});
315386
$('#pAddAllocations').select2();
316387
$('#pRemoveAllocations').select2();
317388
$('#pAllocation').select2();

resources/themes/pterodactyl/layouts/admin.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
{!! Theme::js('js/vendor/socketio/socket.io.min.js') !!}
194194
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
195195
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
196+
{!! Theme::js('js/admin/functions.js') !!}
196197
@show
197198
</body>
198199
</html>

resources/views/layouts/admin.blade.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@
212212
</div>
213213
<script>
214214
$(document).ready(function () {
215-
// Remeber Active Tab and Navigate to it on Reload
216-
for(var queryParameters={},queryString=location.search.substring(1),re=/([^&=]+)=([^&]*)/g,m;m=re.exec(queryString);)queryParameters[decodeURIComponent(m[1])]=decodeURIComponent(m[2]);$("a[data-toggle='tab']").click(function(){queryParameters.tab=$(this).attr("href").substring(1),window.history.pushState(null,null,location.pathname+"?"+$.param(queryParameters))});
217-
if($.urlParam('tab') != null){$('.nav.nav-tabs a[href="#' + $.urlParam('tab') + '"]').tab('show');}
218-
219215
@if (count($errors) > 0)
220216
@foreach ($errors->all() as $error)
221217
<?php preg_match('/^The\s(.*?)\sfield/', $error, $matches) ?>

0 commit comments

Comments
 (0)