Pavel Loginov 2021-01-06 10:33:33 +06:00
parent bbda8db94a
commit 3c5b6e772c
6 changed files with 19 additions and 26 deletions

View File

@ -32,7 +32,7 @@ if form.getvalue('mode') is None and form.getvalue('new_userlist') is None:
if not os.path.exists(dir+"/"+user_group):
os.makedirs(dir+"/"+user_group)
if not os.path.exists(white_dir):
os.makedirs(dir)
os.makedirs(white_dir)
if not os.path.exists(black_dir):
os.makedirs(black_dir)

View File

@ -12,11 +12,14 @@ try:
user, user_id, role, token, servers = funct.get_users_params()
cmd = "rpm --query haproxy-wi-metrics-* |awk -F\"metrics\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'"
service_ver, stderr = funct.subprocess_execute(cmd)
services = '0'
if service_ver == '* is not installed':
servers = ''
else:
servers = sql.select_servers_metrics(user_id.value)
if not stderr:
if service_ver[0] == '* is not installed':
servers = ''
else:
servers = sql.select_servers_metrics(user_id.value)
services = '1'
except Exception:
pass
@ -27,6 +30,6 @@ template = template.render(h2=1, title="Metrics",
user=user,
servers=servers,
versions=funct.versions(),
services=service_ver[0],
services=services,
token=token)
print(template)

View File

@ -81,11 +81,11 @@
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('listen-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-listen-span">
<label for="https-listen" style="margin-top: 5px;" title="Enable ssl">SSL?</label>
<label for="https-listen" style="margin-top: 5px;" title="Enable SSL Offloading">SSL Offloading</label>
<input type="checkbox" id="https-listen" name="ssl" value="https" >
</span>
<div id="https-hide-listen" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
<br /><span class="tooltip tooltipTop">Enter name of pem file, or press the "down" button:</span><br />
{{ input('path-cert-listen', name="cert", placeholder="some_cert.pem", size='39') }}<br />
<label for="ssl-check-listen" style="margin-top: 5px;">Disable ssl verify on servers?</label><input type="checkbox" id="ssl-check-listen" name="ssl-check" value="ssl-check" checked>
</div>
@ -147,7 +147,7 @@
<span class="controlgroup">
{{ checkbox('compression', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading', title='Enable SSL Offloading', desc='SSL Offloading') }}
{{ checkbox('ssl_offloading', title='Enable redirect from HTTP to HTTPS', desc='HTTP->HTTPS') }}
</span>
</td>
</tr>
@ -312,11 +312,11 @@
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('frontend-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-frontend-span">
<label for="https-frontend" style="margin-top: 5px;">SSL?</label>
<label for="https-frontend" style="margin-top: 5px;" title="Enable SSL Offloading">SSL Offloading</label>
<input type="checkbox" id="https-frontend" name="ssl" value="https">
</span>
<div id="https-hide-frontend" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
<br /><span class="tooltip tooltipTop">Enter name of pem file, or press the "down" button:</span><br />
{{ input('path-cert-frontend', name="cert", placeholder="some_cert.pem", size='39') }}
</div>
</td>
@ -359,7 +359,7 @@
<span class="controlgroup">
{{ checkbox('compression2', name="compression", title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache2', name="cache", title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading1', title='Enable SSL Offloading', desc='SSL Offloading') }}
{{ checkbox('ssl_offloading1', title='Enable redirect from HTTP to HTTPS', desc='HTTP->HTTPS') }}
</span>
</td>
</tr>

View File

@ -52,7 +52,7 @@
}
});
{% for s in services %}
{% if s.1 == '* is not installed' %}
{% if s.1 == '* is not installed' or s.1 == '' %}
{% if s.0 == 'checker_haproxy' %}
$(':regex(id, alert)').checkboxradio('disable');
{% elif s.0 == 'keep_alive' %}

View File

@ -16,8 +16,7 @@ th, tr, td {
<link href="/inc/chart.min.css" rel="stylesheet">
<script src="/inc/metrics.js"></script>
<script src="/inc/chart.min.js"></script>
{% if services == '* is not installed' %}
{% if services == '0' %}
<center>
<br />
<h3>You do not have installed Metrics service.

View File

@ -957,23 +957,14 @@ $( function() {
$( "#create-ssl-listen" ).on( "click", function() {
resetProxySettings();
createSsl(1, 'listen');
$('#ssl_offloading').prop( "checked", true );
$('#ssl_offloading').checkboxradio("refresh")
$("#optionsInput").append(ssl_offloading_var)
});
$( "#create-ssl-frontend" ).on( "click", function() {
resetProxySettings();
createSsl(2, 'frontend');
$('#ssl_offloading1').prop( "checked", true );
$('#ssl_offloading1').checkboxradio("refresh")
$("#optionsInput1").append(ssl_offloading_var)
});
$( "#create-ssl-backend" ).on( "click", function() {
resetProxySettings();
createSsl(3, 'backend');
$('#ssl_offloading2').prop( "checked", true );
$('#ssl_offloading2').checkboxradio("refresh");
$("#optionsInput2").append(ssl_offloading_var);
});
$( "#create-https-listen" ).on( "click", function() {
resetProxySettings();