improove perfermances with last_backups page

This commit is contained in:
ssamson-tis 2015-06-29 15:16:19 +02:00
parent 7e6983f77a
commit 575a951d5f
2 changed files with 6 additions and 3 deletions

View File

@ -4,7 +4,7 @@
$(document).ready(function() { $(document).ready(function() {
var oTable = $('#table-design').dataTable( { var oTable = $('#table-design').dataTable( {
"bProcessing": true, "bProcessing": true,
"sAjaxDataProp": "data", "sAjaxDataProp": "",
"sAjaxSource": "/backups.json", "sAjaxSource": "/backups.json",
"iDisplayLength": 25, "iDisplayLength": 25,
// "aLengthMenu": [[25, 50, 100, 200, 500, -1], [25, 50, 100, 200, 500, "All"]], // "aLengthMenu": [[25, 50, 100, 200, 500, -1], [25, 50, 100, 200, 500, "All"]],

View File

@ -26,7 +26,7 @@ from shutil import *
from iniparse import ConfigParser from iniparse import ConfigParser
from libtisbackup.common import * from libtisbackup.common import *
import time import time
from flask import request, Flask, session, g, redirect, url_for, abort, render_template, flash, jsonify from flask import request, Flask, session, g, redirect, url_for, abort, render_template, flash, jsonify, Response
from urlparse import urlparse from urlparse import urlparse
import json import json
import glob import glob
@ -227,7 +227,10 @@ def export_backup_status():
@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 jsonify(data=exports) return Response(response=json.dumps(exports),
status=200,
mimetype="application/json")
@app.route('/last_backups') @app.route('/last_backups')
def last_backup(): def last_backup():