Browse Source

v3.7.3.2

The config show was impoved
pull/181/head
Pavel Loginov 5 years ago
parent
commit
9f9794d64d
  1. 2
      app/create_db.py
  2. 4
      app/options.py
  3. 5
      app/templates/add.html
  4. 42
      app/templates/ajax/config_show.html

2
app/create_db.py

@ -438,7 +438,7 @@ def update_db_v_3_5_3(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
sql = """update version set version = '3.7.3.1'; """
sql = """update version set version = '3.7.3.2'; """
try:
cur.execute(sql)
con.commit()

4
app/options.py

@ -560,7 +560,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/'), autoescape=True, extensions=['jinja2.ext.loopcontrols', "jinja2.ext.do"])
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True, extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
template = env.get_template('ajax/compare.html')
output, stderr = funct.subprocess_execute(cmd)
@ -585,7 +585,7 @@ if serv is not None and act == "configShow":
print('<div class="alert alert-danger">Can\'t read import config file</div>')
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True, extensions=['jinja2.ext.loopcontrols'])
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True, trim_blocks=True, lstrip_blocks=True, extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
template = env.get_template('config_show.html')
template = template.render(conf=conf, view=form.getvalue('view'), serv=serv, configver=form.getvalue('configver'), role=funct.is_admin(level=2))

5
app/templates/add.html

@ -156,7 +156,6 @@ h3 {
<div class="tooltip">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options') }}
<input type="text" id="options" class="form-control">
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
</span>
@ -214,7 +213,7 @@ h3 {
<!-- Second tabs -->
<div id="frontend">
<form name="add-frontend" action="/app/add.py">
<form name="add-frontend" action="/app/add.py" method="get">
<table>
<caption><h3>Add frontend</h3></caption>
<tr>
@ -345,7 +344,7 @@ h3 {
</tr>
<tr>
<td class="addButton">
<button type="submit" value="" name="" class="btn btn-default">Add Frontend</button>
<button type="submit">Add Frontend</button>
</td>
</tr>
</form>

42
app/templates/ajax/config_show.html

@ -11,7 +11,8 @@
</center>
<div style="margin-left: 16%" class="configShow">
{% set i = 0 -%}
{% for line in conf %}
{% set section_name = {} %}
{% for line in conf -%}
{% set i = i + loop.index0 %}
{% if not role %}
{% if line.startswith('#HideBlockStart') %}
@ -43,21 +44,24 @@
</span><div>
{% continue %}
{% endif %}
{% if line.startswith('listen') %}
</div><span class="param">{{ line }}
{%- if line.startswith('listen') -%}
</div><span class="param">{{- line -}}
{% if role %}
<span class="accordion-link">
<a href="/app/sections.py?serv={{serv}}&section={{ line }}">Edit</a>
</span>
{% endif %}
{% set backend = line.split(' ') %}
{%- set backend = line.split(' ') -%}
<span class="accordion-link">
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}" target="_blank">Stats</a>
<a href="/app/viewsttats.py?serv={{-serv-}}#{{- backend[1]-}}" target="_blank">Stats</a>
</span>
</span><div>
{% continue %}
{% endif %}
{% if line.startswith('frontend') %}
{%- set backend = backend|join('_') -%}
{%- do section_name.update({i: backend}) -%}
<span id="{{-section_name[i]|replace('\n', '')-}}" class="accordion-link"></span>
</span><div>
{% continue %}
{%- endif -%}
{%- if line.startswith('frontend') -%}
</div><span class="param">{{ line }}
{% if role %}
<span class="accordion-link">
@ -67,10 +71,13 @@
{% set backend = line.split(' ') %}
<span class="accordion-link">
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}" target="_blank">Stats</a>
</span>
</span><div>
{% continue %}
{% endif %}
</span>
{% set backend = backend|join('_') %}
{% do section_name.update({i: backend}) %}
<span id="{{sep_section_name[i]|replace('\n', '')}}" class="accordion-link"></span>
</span><div>
{% continue %}
{%- endif -%}
{% if line.startswith('backend') %}
</div><span class="param">{{ line }}
{% if role %}
@ -141,7 +148,14 @@
{{ line }}
</span><br />
{% endif %}
{% endfor %}
{%- if "bind" in line -%}
{%- set bind = line.split(':') -%}
<script>
{% set k = i - 1 %}
$('#{{-section_name[k]|replace("\n", "")-}}').html('<a href="http://{{-serv-}}:{{-bind[1]|replace("\n", "")-}}" title="Open {{serv-}}:{{-bind[1]|replace("\n", "")-}}" target="_blank">Open</a>')
</script>
{%- endif -%}
{%- endfor -%}
</div>
</div>
{% if configver %}

Loading…
Cancel
Save