diff --git a/app/create_db.py b/app/create_db.py index cab2e159..9e9d38b0 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -527,7 +527,7 @@ def update_db_v_3(**kwargs): def update_db_v_31(**kwargs): con, cur = get_cur() - sql = [ "ALTER TABLE `settings` ADD COLUMN `desc` varchar(64); ", + sql = [ "ALTER TABLE `settings` ADD COLUMN `desc` varchar(100); ", "INSERT INTO settings (param, value, section, `desc`) values('time_zone', 'UTC', 'main', 'Time Zone');", "INSERT INTO settings (param, value, section, `desc`) values('proxy', '', 'main', 'Proxy server. Use proto://ip:port');", "INSERT INTO settings (param, value, section, `desc`) values('session_ttl', '5', 'main', 'Time to live users sessions. In days');", diff --git a/app/options.py b/app/options.py index cfb5e5b2..d91a6e7e 100644 --- a/app/options.py +++ b/app/options.py @@ -313,7 +313,7 @@ if serv is not None and form.getvalue('right') is not None: right = form.getvalue('right') hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir') cmd='diff -ub %s%s %s%s' % (hap_configs_dir, left, hap_configs_dir, right) - env = Environment(loader=FileSystemLoader('templates/ajax'),extensions=['jinja2.ext.loopcontrols']) + env = Environment(loader=FileSystemLoader('templates/ajax'),extensions=['jinja2.ext.loopcontrols', "jinja2.ext.do"]) template = env.get_template('compare.html') output, stderr = funct.subprocess_execute(cmd) diff --git a/app/templates/ajax/compare.html b/app/templates/ajax/compare.html index e9039fde..08e43289 100644 --- a/app/templates/ajax/compare.html +++ b/app/templates/ajax/compare.html @@ -1,8 +1,8 @@
- {% set plus = 0 %} - {% set minus = 0 %} + {% set plus = [] %} + {% set minus = [] %} {% set total_change = 0 %} {% for line in stdout %} @@ -12,20 +12,19 @@ {{ line }}
{% elif line.startswith('-') and loop.index0 > 1 %}
{{ line }}
- {% set minus = minus + 1 %} + {% do minus.append(1) %} {% elif line.startswith('+') and loop.index0 > 2 %}
{{ line }}
- {% set plus = plus + 1 %} + {% do plus.append(1) %} {% elif line.startswith('@') %}
{{ line }}
{% else %}
{{ line }}
{% endif %} - {% set total_change = minus + plus %} - {% if loop.last %} -
Total change: {{ total_change }}, additions: {{ plus }} & deletions: {{ minus }}
- {% endif %} {% endfor %} + {% set total_change = minus + plus %} + +
Total change: {{ total_change|length }}, additions: {{ plus|length }} & deletions: {{ minus|length }}
\ No newline at end of file