2021-03-22 04:02:18 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
|
|
{% end %}
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails') }}{% end %}
|
2021-03-22 04:02:18 +00:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
|
|
|
<!-- Page Title Header Starts-->
|
|
|
|
<div class="row page-title-header">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="page-header">
|
|
|
|
<h4 class="page-title">
|
2021-03-26 13:57:50 +00:00
|
|
|
{{ translate('serverDetails', 'serverDetails') }} - {{ data['server_stats']['server_id']['server_name'] }}
|
2021-03-22 04:02:18 +00:00
|
|
|
<br />
|
|
|
|
<small>UUID: {{ data['server_stats']['server_id']['server_uuid'] }}</small>
|
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
|
|
|
{% include "parts/details_stats.html %}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12 grid-margin">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body pt-0">
|
|
|
|
<ul class="nav nav-tabs col-md-12 tab-simple-styled " role="tablist">
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=term" role="tab" aria-selected="false">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-file-signature"></i>{{ translate('serverDetails', 'terminal') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=logs" role="tab" aria-selected="false">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-file-signature"></i>{{ translate('serverDetails', 'logs') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=tasks" role="tab" aria-selected="false">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-clock"></i>{{ translate('serverDetails', 'schedule') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link active" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=backup" role="tab" aria-selected="true">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-save"></i>{{ translate('serverDetails', 'backup') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=files" role="tab" aria-selected="false">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-folder-tree"></i>{{ translate('serverDetails', 'files') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=config" role="tab" aria-selected="false">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-cogs"></i>{{ translate('serverDetails', 'config') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=admin_controls" role="tab" aria-selected="false">
|
2021-03-26 13:57:50 +00:00
|
|
|
<i class="fas fa-users"></i>{{ translate('serverDetails', 'playerControls') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6 col-sm-12">
|
|
|
|
<form class="forms-sample" method="post" action="/panel/server_backup">
|
|
|
|
{% raw xsrf_form_html() %}
|
|
|
|
<input type="hidden" name="id" value="{{ data['server_stats']['server_id']['server_id'] }}">
|
|
|
|
<input type="hidden" name="subpage" value="backup">
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<a href="/panel/backup_now?id={{ data['server_stats']['server_id']['server_id'] }}" class="btn btn-primary" onclick="backup_started()">{{ translate('serverBackups', 'backupNow') }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<label for="server_name">{{ translate('serverBackups', 'storageLocation') }} <small class="text-muted ml-1"> - {{ translate('serverBackups', 'storageLocationDesc') }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="backup_path" id="backup_path" value="{{ data['server_stats']['server_id']['backup_path'] }}" placeholder="{{ translate('serverBackups', 'storageLocation') }}" >
|
2021-03-22 04:02:18 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<label for="server_path">{{ translate('serverBackups', 'maxBackups') }} <small class="text-muted ml-1"> - {{ translate('serverBackups', 'maxBackupsDesc') }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="max_backups" id="max_backups" value="{{ data['backup_config']['max_backups'] }}" placeholder="{{ translate('serverBackups', 'maxBackups') }}" >
|
2021-03-22 04:02:18 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="superuser" class="form-check-label ml-4 mb-4">
|
|
|
|
{% if data['backup_config']['auto_enabled'] %}
|
2021-03-26 13:57:50 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="auto_enabled" name="auto_enabled" checked="" value="1" >{{ translate('serverBackups', 'backupAtMidnight') }}
|
2021-03-22 04:02:18 +00:00
|
|
|
{% else %}
|
2021-03-26 13:57:50 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="auto_enabled" name="auto_enabled" value="1" >{{ translate('serverBackups', 'backupAtMidnight') }}
|
2021-03-22 04:02:18 +00:00
|
|
|
{% end %}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<button type="submit" class="btn btn-success mr-2">{{ translate('serverBackups', 'save') }}</button>
|
|
|
|
<button type="reset" class="btn btn-light">{{ translate('serverBackups', 'cancel') }}</button>
|
2021-03-22 04:02:18 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6 col-sm-12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4 class="card-title">{{ translate('serverBackups', 'currentBackups') }}</h4>
|
2021-03-22 04:02:18 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
|
|
|
|
|
|
<table class="table table-responsive dataTable" id="backup_table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2021-03-26 13:57:50 +00:00
|
|
|
<th width="10%">{{ translate('serverBackups', 'download') }}</th>
|
|
|
|
<th>{{ translate('serverBackups', 'path') }}</th>
|
|
|
|
<th width="20%">{{ translate('serverBackups', 'size') }}</th>
|
|
|
|
<th width="10%">{{ translate('serverBackups', 'delete') }}</th>
|
2021-03-22 04:02:18 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for backup in data['backup_list'] %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<a href="/panel/download_backup?file={{ backup['path'] }}&id={{ data['server_stats']['server_id']['server_id'] }}" class="btn btn-primary">
|
|
|
|
<i class="fas fa-download" aria-hidden="true"></i>
|
2021-03-26 13:57:50 +00:00
|
|
|
{{ translate('serverBackups', 'download') }}
|
2021-03-22 04:02:18 +00:00
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td>{{ backup['path'] }}</td>
|
|
|
|
<td>{{ backup['size'] }}</td>
|
|
|
|
<td>
|
|
|
|
<button data-file="{{ backup['path'] }}" class="btn btn-danger del_button">
|
|
|
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
2021-03-26 13:57:50 +00:00
|
|
|
{{ translate('serverBackups', 'delete') }}
|
2021-03-22 04:02:18 +00:00
|
|
|
</button>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- content-wrapper ends -->
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
|
|
|
|
function getCookie(name) {
|
|
|
|
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
|
|
|
return r ? r[1] : undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
function backup_started(time='5-10') {
|
|
|
|
bootbox.alert({
|
2021-03-26 13:57:50 +00:00
|
|
|
message: "{{ translate('serverBackups', 'backupTask') }}",
|
2021-03-22 04:02:18 +00:00
|
|
|
backdrop: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function del_backup(filename, id){
|
|
|
|
var token = getCookie("_xsrf")
|
|
|
|
|
|
|
|
data_to_send = { file_name :filename}
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
console.log('Sending Command to delete backup: ' + filename)
|
2021-03-22 04:02:18 +00:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
headers: {'X-XSRFToken': token},
|
|
|
|
url: '/ajax/del_file?server_id='+id,
|
|
|
|
data: data_to_send,
|
2021-03-26 13:57:50 +00:00
|
|
|
success: function(data) {
|
2021-03-22 04:02:18 +00:00
|
|
|
location.reload();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$( document ).ready(function() {
|
|
|
|
console.log( "ready!" );
|
|
|
|
$("#backup_config_box").hide();
|
|
|
|
$("#backup_save_note").hide();
|
|
|
|
|
|
|
|
$("#show_config").click(function () {
|
|
|
|
$("#backup_config_box").toggle();
|
|
|
|
$('#backup_button').hide();
|
|
|
|
$('#backup_save_note').show();
|
|
|
|
$('#backup_data').hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#backup_table').DataTable({
|
|
|
|
"order": [[ 1, "desc" ]],
|
|
|
|
"paging":true,
|
|
|
|
"lengthChange": false,
|
|
|
|
"searching": true,
|
|
|
|
"ordering": true,
|
|
|
|
"info": true,
|
|
|
|
"autoWidth": false,
|
|
|
|
"responsive": true,
|
|
|
|
});
|
|
|
|
|
|
|
|
$( ".del_button" ).click(function() {
|
|
|
|
var file_to_del = $(this).data("file");
|
|
|
|
|
|
|
|
console.log("file to delete is" + file_to_del);
|
|
|
|
|
|
|
|
bootbox.confirm({
|
2021-03-26 13:57:50 +00:00
|
|
|
title: "{% raw translate('serverBackups', 'destroyBackup') %}",
|
|
|
|
message: "{{ translate('serverBackups', 'confirmDelete') }}",
|
2021-03-22 04:02:18 +00:00
|
|
|
buttons: {
|
|
|
|
cancel: {
|
2021-03-26 13:57:50 +00:00
|
|
|
label: '<i class="fas fa-times"></i> {{ translate("serverBackups", "cancel") }}'
|
2021-03-22 04:02:18 +00:00
|
|
|
},
|
|
|
|
confirm: {
|
2021-03-26 13:57:50 +00:00
|
|
|
label: '<i class="fas fa-check"></i> {{ translate("serverBackups", "confirm") }}'
|
2021-03-22 04:02:18 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
callback: function (result) {
|
|
|
|
console.log(result);
|
|
|
|
if (result == true) {
|
|
|
|
del_backup(file_to_del, {{ data['server_stats']['server_id']['server_id'] }} );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{% end %}
|