2021-03-22 04:02:18 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
|
|
{% end %}
|
|
|
|
|
2021-09-29 02:25:47 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails', data['lang']) }}{% 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-09-29 02:25:47 +00:00
|
|
|
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{ 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">
|
2021-08-21 08:44:03 +00:00
|
|
|
{% include "parts/server_controls_list.html %}
|
2021-03-22 04:02:18 +00:00
|
|
|
|
|
|
|
<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-09-29 02:25:47 +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', data['lang']) }}</a>
|
2021-03-22 04:02:18 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="server_name">{{ translate('serverBackups', 'storageLocation', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverBackups', 'storageLocationDesc', data['lang']) }}</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', data['lang']) }}" >
|
2021-03-22 04:02:18 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="server_path">{{ translate('serverBackups', 'maxBackups', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverBackups', 'maxBackupsDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="max_backups" id="max_backups" value="{{ data['backup_config']['max_backups'] }}" placeholder="{{ translate('serverBackups', 'maxBackups', data['lang']) }}" >
|
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-09-29 02:25:47 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="auto_enabled" name="auto_enabled" checked="" value="1" >{{ translate('serverBackups', 'backupAtMidnight', data['lang']) }}
|
2021-03-22 04:02:18 +00:00
|
|
|
{% else %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="auto_enabled" name="auto_enabled" value="1" >{{ translate('serverBackups', 'backupAtMidnight', data['lang']) }}
|
2021-03-22 04:02:18 +00:00
|
|
|
{% end %}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2021-09-29 02:25:47 +00:00
|
|
|
<button type="submit" class="btn btn-success mr-2">{{ translate('serverBackups', 'save', data['lang']) }}</button>
|
|
|
|
<button type="reset" class="btn btn-light">{{ translate('serverBackups', 'cancel', data['lang']) }}</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-09-29 02:25:47 +00:00
|
|
|
<h4 class="card-title">{{ translate('serverBackups', 'currentBackups', data['lang']) }}</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-09-29 02:25:47 +00:00
|
|
|
<th width="10%">{{ translate('serverBackups', 'download', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('serverBackups', 'path', data['lang']) }}</th>
|
|
|
|
<th width="20%">{{ translate('serverBackups', 'size', data['lang']) }}</th>
|
|
|
|
<th width="10%">{{ translate('serverBackups', 'delete', data['lang']) }}</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-09-29 02:25:47 +00:00
|
|
|
{{ translate('serverBackups', 'download', data['lang']) }}
|
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-09-29 02:25:47 +00:00
|
|
|
{{ translate('serverBackups', 'delete', data['lang']) }}
|
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-09-29 02:25:47 +00:00
|
|
|
message: "{{ translate('serverBackups', 'backupTask', data['lang']) }}",
|
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-09-29 02:25:47 +00:00
|
|
|
title: "{% raw translate('serverBackups', 'destroyBackup', data['lang']) %}",
|
|
|
|
message: "{{ translate('serverBackups', 'confirmDelete', data['lang']) }}",
|
2021-03-22 04:02:18 +00:00
|
|
|
buttons: {
|
|
|
|
cancel: {
|
2021-09-29 02:25:47 +00:00
|
|
|
label: '<i class="fas fa-times"></i> {{ translate("serverBackups", "cancel", data['lang']) }}'
|
2021-03-22 04:02:18 +00:00
|
|
|
},
|
|
|
|
confirm: {
|
2021-09-29 02:25:47 +00:00
|
|
|
label: '<i class="fas fa-check"></i> {{ translate("serverBackups", "confirm", data['lang']) }}'
|
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 %}
|