TISbackup/templates/export_backup.html

123 lines
3.9 KiB
HTML
Raw Normal View History

2013-05-23 10:19:43 +02:00
{% extends "layout.html" %}
{% block content %}
2015-07-06 18:01:49 +02:00
<script src="/static/js/bootbox.js"></script>
2013-05-23 10:19:43 +02:00
<h2 class="title">Hard drive verifications:</h2>
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
2015-07-06 18:01:49 +02:00
<div class="alert alert-success fade in">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> {{ message }}
</div>
2013-05-23 10:19:43 +02:00
{% endfor %}
{% endif %}
{% endwith %}
{% if error %}
<p>
2015-07-06 18:01:49 +02:00
<div class="alert alert-danger fade in"><strong>Error</strong>: {{ error }}</div>
<div class="alert alert-warning"><strong>Notice</strong>: {{ info }}</div>
2013-05-23 10:19:43 +02:00
<h4>Also, you can contact your <a href="mailto:{{ email }}?Subject=TISBACKUP%20Export"> System Administrator</a> for more details </h4>
</p>
{% elif not start %}
<script>
$(document).ready( function() {
$("#confirm_button").click( function() {
2015-06-30 14:31:49 +02:00
bootbox.confirm('Do you want to proced backup now ?', function(r) {
2013-05-23 10:19:43 +02:00
if(r == true ){
$("#backup").submit();
};
});
});
2015-06-30 14:31:49 +02:00
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
2013-05-23 10:19:43 +02:00
});
</script>
<form id="backup" action='/export_backup'>
2015-07-06 18:01:49 +02:00
<p> Select backups to save : <br/>
2015-07-09 11:02:28 +02:00
<div class="row">
2015-07-06 18:01:49 +02:00
<div class="checkbox"><label><input type="checkbox" class="checkbox1" id="selectall" checked>Select all</label></div>
2015-06-30 14:31:49 +02:00
{% for entry in sections|sort %}
2015-07-03 16:18:48 +02:00
<div class="col-xs-6 col-md-4">
2015-07-06 18:01:49 +02:00
<div class="form-group">
<div class="checkbox"><label><input type="checkbox" name="sections" class="checkbox1" value="{{entry}}" checked>{{entry}}</label></div>
</div>
</div>
{% endfor %}
2015-07-09 11:02:28 +02:00
</div>
<div class="row">
<div class="col-sm-offset-5 col-sm-2 text-center ">
<input type="hidden" name="start" value="true" />
<input type="button" id="confirm_button" value="Launch Backup" class="btn btn-primary btn-lg" />
</div>
</div>
2013-05-23 10:19:43 +02:00
</form>
2013-05-23 10:19:43 +02:00
{% else %}
<h2 class="title">Backups is running: </h2>
2015-07-06 18:01:49 +02:00
<table id="table" class='table'>
2013-05-23 10:19:43 +02:00
<thead>
<th>Server</th>
<th>Backup</th>
<th>Status</th>
</thead>
<tbody>
</tbody>
</table>
<script>
2015-06-30 14:31:49 +02:00
2013-05-23 10:19:43 +02:00
//Refresh periode in seconds
2015-07-08 16:02:14 +02:00
var refresh = 5;
2013-05-23 10:19:43 +02:00
var done = false;
2015-07-08 16:02:14 +02:00
var error = "";
2013-05-23 10:19:43 +02:00
function status(){
$.getJSON("/status.json", function(data) {
2015-07-06 18:01:49 +02:00
$("#table tbody").remove();
2013-05-23 10:19:43 +02:00
$.each(data.data, function(key,val){
2015-07-06 18:01:49 +02:00
$('#table').append('<tr>');
2013-05-23 10:19:43 +02:00
$('tbody').append('<td>'+val.server_name+'</td>');
$('tbody').append('<td>'+val.backup_name+'</td>');
2015-06-30 14:31:49 +02:00
if(val.status != 'OK'){
2013-05-23 10:19:43 +02:00
$('tbody').append('<td class=loading><img src="/static/images/loader.gif" width="15" height="15"/></td>');
done = false;
}else{
$('tbody').append('<td>'+val.status+'</td>');
2015-06-30 14:48:34 +02:00
done = data.finish;
2013-05-23 10:19:43 +02:00
}
$('#table-design').append('</tr>');
});
2015-07-08 16:02:14 +02:00
error = data.error;
2013-05-23 10:19:43 +02:00
});
if (done){
2015-06-30 14:31:49 +02:00
bootbox.alert('Backup finished');
2013-05-23 10:19:43 +02:00
window.clearInterval(timer);
};
2015-07-08 16:02:14 +02:00
if( error != ""){
window.clearInterval(timer);
bootbox.alert("Error: " + error);
};
2013-05-23 10:19:43 +02:00
};
var timer = window.setInterval(function(){
status();
}, refresh * 1000);
status();
</script>
{% endif %}
{% endblock %}