First support to multiple tisbackup-config.ini files
This commit is contained in:
parent
ec4bd696e1
commit
4ff384f5c7
@ -38,6 +38,7 @@ Released : 20090910
|
||||
</div>
|
||||
<!-- end #header -->
|
||||
<div id="menu">
|
||||
|
||||
<ul>
|
||||
<li><a href="/">Backups</a></li>
|
||||
<li><a href="/export_backup">Export Backup</a></li>
|
||||
@ -48,6 +49,10 @@ Released : 20090910
|
||||
<div id="page">
|
||||
<div id="page-bgtop">
|
||||
<div id="page-bgbtm">
|
||||
<div id="choix_conf" style="float:right;margin-top:5px;">
|
||||
Choix du fichier de configuration :
|
||||
<select id="config">
|
||||
</select> </div>
|
||||
<div id="content">
|
||||
<div class="post">
|
||||
{% block content %}
|
||||
@ -73,5 +78,26 @@ Released : 20090910
|
||||
<div id="footer">
|
||||
<p>Copyright (c) 2012 Tranquil IT Systems. All rights reserved. Design by <a href="http://www.tranquil-it-systems.fr/">TIS</a>.</p>
|
||||
</div>
|
||||
<script>
|
||||
function configs(){
|
||||
$.getJSON("/config_number/", function(data) {
|
||||
if ( data.configs.length == 1){
|
||||
$("#choix_conf").hide();
|
||||
return 0;
|
||||
}
|
||||
$.each(data.configs, function(key,val){
|
||||
if (key == data.config_number)
|
||||
$('#config').append('<option vaulue="'+key+'" selected>'+val+'</option>');
|
||||
else
|
||||
$('#config').append('<option vaulue="'+key+'">'+val+'</option>');
|
||||
});
|
||||
});
|
||||
$( "#config" ).change(function() {
|
||||
$.get( "/config_number/"+this.selectedIndex, function( data ) {location.reload();});
|
||||
});
|
||||
};
|
||||
configs();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -36,11 +36,12 @@ import logging
|
||||
import re
|
||||
|
||||
|
||||
CONFIG = uwsgi.opt['config_tisbackup']
|
||||
CONFIG = uwsgi.opt['config_tisbackup'].split(",")
|
||||
SECTIONS = uwsgi.opt['sections']
|
||||
ADMIN_EMAIL = uwsgi.opt.get('ADMIN_EMAIL',uwsgi.opt.get('admin_email'))
|
||||
spooler = uwsgi.opt['spooler']
|
||||
tisbackup_config_file= uwsgi.opt['config_tisbackup']
|
||||
tisbackup_config_file= CONFIG[0]
|
||||
config_number=0
|
||||
|
||||
cp = ConfigParser()
|
||||
cp.read(tisbackup_config_file)
|
||||
@ -54,7 +55,7 @@ app.secret_key = 'fsiqefiuqsefARZ4Zfesfe34234dfzefzfe'
|
||||
app.config['PROPAGATE_EXCEPTIONS'] = True
|
||||
|
||||
def read_config():
|
||||
config_file = CONFIG
|
||||
config_file = CONFIG[config_number]
|
||||
cp = ConfigParser()
|
||||
cp.read(config_file)
|
||||
|
||||
@ -132,6 +133,16 @@ def backup_all():
|
||||
backup_dict = read_config()
|
||||
return render_template('backups.html', backup_list = backup_dict)
|
||||
|
||||
|
||||
@app.route('/config_number/')
|
||||
@app.route('/config_number/<int:id>')
|
||||
def set_config_number(id=None):
|
||||
if id != None and len(CONFIG) > id:
|
||||
global config_number
|
||||
config_number=id
|
||||
read_config()
|
||||
return jsonify(configs=CONFIG,config_number=config_number)
|
||||
|
||||
@app.route('/json')
|
||||
def backup_json():
|
||||
backup_dict = read_config()
|
||||
|
Loading…
Reference in New Issue
Block a user