Fix wrong finish staus on status.json

This commit is contained in:
ssamson-tis 2015-06-30 14:48:34 +02:00
parent f826952327
commit ec4bd696e1
2 changed files with 18 additions and 15 deletions

View File

@ -65,7 +65,7 @@
//Refresh periode in seconds //Refresh periode in seconds
var refresh = 15; var refresh = 10;
var done = false; var done = false;
function status(){ function status(){
$.getJSON("/status.json", function(data) { $.getJSON("/status.json", function(data) {
@ -79,7 +79,8 @@ function status(){
done = false; done = false;
}else{ }else{
$('tbody').append('<td>'+val.status+'</td>'); $('tbody').append('<td>'+val.status+'</td>');
done = true;
done = data.finish;
} }
$('#table-design').append('</tr>'); $('#table-design').append('</tr>');
}); });

View File

@ -222,14 +222,14 @@ def check_mount_disk(partition_name, refresh):
@app.route('/status.json') @app.route('/status.json')
def export_backup_status(): def export_backup_status():
exports = dbstat.query('select * from stats where TYPE="EXPORT" and backup_start>="%s"' % mindate) exports = dbstat.query('select * from stats where TYPE="EXPORT" and backup_start>="%s"' % mindate)
return jsonify(data=exports) return jsonify(data=exports,finish= ( len(os.listdir(spooler)) == 0 ))
@app.route('/backups.json') @app.route('/backups.json')
def last_backup_json(): def last_backup_json():
exports = dbstat.query('select * from stats where TYPE="BACKUP" ORDER BY backup_start DESC ') exports = dbstat.query('select * from stats where TYPE="BACKUP" ORDER BY backup_start DESC ')
return Response(response=json.dumps(exports), return Response(response=json.dumps(exports),
status=200, status=200,
mimetype="application/json") mimetype="application/json")
@app.route('/last_backups') @app.route('/last_backups')
@ -244,6 +244,8 @@ def export_backup():
backup_dict = read_config() backup_dict = read_config()
sections = [] sections = []
for backup_types in backup_dict: for backup_types in backup_dict:
if backup_types == "null_list":
continue
for section in backup_dict[backup_types]: for section in backup_dict[backup_types]:
if section.count > 0: if section.count > 0:
sections.append(section[1]) sections.append(section[1])