mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
acedb0ad8a
Waiting for DB changes to finish.
217 lines
8.7 KiB
HTML
217 lines
8.7 KiB
HTML
{% extends ../base.html %}
|
|
|
|
{% block meta %}
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
{% end %}
|
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails', data['lang']) }}{% end %}
|
|
|
|
{% 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">
|
|
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{ data['server_stats']['server_id']['server_name'] }}
|
|
<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">
|
|
{% include "parts/server_controls_list.html %}
|
|
|
|
<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">
|
|
<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>
|
|
</div>
|
|
<div class="form-group">
|
|
<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']) }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<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']) }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="superuser" class="form-check-label ml-4 mb-4">
|
|
{% if data['backup_config']['auto_enabled'] %}
|
|
<input type="checkbox" class="form-check-input" id="auto_enabled" name="auto_enabled" checked="" value="1" >{{ translate('serverBackups', 'backupAtMidnight', data['lang']) }}
|
|
{% else %}
|
|
<input type="checkbox" class="form-check-input" id="auto_enabled" name="auto_enabled" value="1" >{{ translate('serverBackups', 'backupAtMidnight', data['lang']) }}
|
|
{% end %}
|
|
</label>
|
|
</div>
|
|
|
|
<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>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="col-md-6 col-sm-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="card-title">{{ translate('serverBackups', 'currentBackups', data['lang']) }}</h4>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="text-center">
|
|
|
|
<table class="table table-responsive dataTable" id="backup_table">
|
|
<thead>
|
|
<tr>
|
|
<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>
|
|
</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>
|
|
{{ translate('serverBackups', 'download', data['lang']) }}
|
|
</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>
|
|
{{ translate('serverBackups', 'delete', data['lang']) }}
|
|
</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({
|
|
message: "{{ translate('serverBackups', 'backupTask', data['lang']) }}",
|
|
backdrop: true
|
|
});
|
|
}
|
|
|
|
function del_backup(filename, id){
|
|
var token = getCookie("_xsrf")
|
|
|
|
data_to_send = { file_name :filename}
|
|
|
|
console.log('Sending Command to delete backup: ' + filename)
|
|
$.ajax({
|
|
type: "POST",
|
|
headers: {'X-XSRFToken': token},
|
|
url: '/ajax/del_file?server_id='+id,
|
|
data: data_to_send,
|
|
success: function(data) {
|
|
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({
|
|
title: "{% raw translate('serverBackups', 'destroyBackup', data['lang']) %}",
|
|
message: "{{ translate('serverBackups', 'confirmDelete', data['lang']) }}",
|
|
buttons: {
|
|
cancel: {
|
|
label: '<i class="fas fa-times"></i> {{ translate("serverBackups", "cancel", data['lang']) }}'
|
|
},
|
|
confirm: {
|
|
label: '<i class="fas fa-check"></i> {{ translate("serverBackups", "confirm", data['lang']) }}'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
console.log(result);
|
|
if (result == true) {
|
|
del_backup(file_to_del, {{ data['server_stats']['server_id']['server_id'] }} );
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
{% end %} |