pull/161/head
Pavel Loginov 2019-10-04 19:58:47 +03:00
parent 7db0cb6abd
commit c64da87c8d
6 changed files with 110 additions and 22 deletions

View File

@ -30,6 +30,8 @@ try:
metrics_worker, stderr = funct.subprocess_execute(cmd)
cmd = "ps ax |grep -e 'keep_alive.py' |grep -v grep |wc -l"
keep_alive, stderr = funct.subprocess_execute(cmd)
cmd = "top -b -n 1 -w 77 |head -9"
server_status_row, stderr = funct.subprocess_execute(cmd)
except:
pass
@ -47,6 +49,7 @@ template = template.render(h2 = 1,
checker_master = ''.join(checker_master),
checker_worker = ''.join(checker_worker),
keep_alive = ''.join(keep_alive),
server_status = server_status_row,
error = stderr,
versions = funct.versions(),
token = token)

View File

@ -785,7 +785,7 @@ def select_waf_servers_metrics(uuid, **kwargs):
if group[5] == '1':
sql = """ select servers.ip from servers left join waf as waf on waf.server_id = servers.id where servers.enable = 1 and waf.metrics = '1' """
else:
sql = """ select servers.ip from servers left join waf as waf on waf.server_id = servers.id where servers.enable = 1 %s and waf.metrics = '1' and servers.groups like '%{group}%' """.format(group=group[5])
sql = """ select servers.ip from servers left join waf as waf on waf.server_id = servers.id where servers.enable = 1 and waf.metrics = '1' and servers.groups like '%{group}%' """.format(group=group[5])
try:
cur.execute(sql)
except sqltool.Error as e:
@ -1321,7 +1321,7 @@ if form.getvalue('updateuser') is not None:
activeuser = form.getvalue('activeuser')
print('Content-type: text/html\n')
check_token()
if updateuser is None or role is None or group is None:
if new_user is None or role is None or group is None:
print(error_mess)
else:
update_user(new_user, email, role, group, id, activeuser)

View File

@ -43,6 +43,20 @@
</tr>
<tbody id="ajaxwafstatus"></tbody>
</table>
<table class="overview-wi" style="height: 170;">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">HAProxy-WI server status</td>
</tr>
<tr>
<td style="width:90%">
<pre style="margin: 0;">
{% for s in server_status %}
<span style="margin-bottom: -30px;display: block;font-size: 10px;">{{ s }}</span>
{% endfor %}
</pre>
</td>
</tr>
</table>
<table class="overview-wi" style="height: 170;">
<tr class="overviewHead" style="height: 48px;">
<th class="padding10 first-collumn-wi" colspan=4>
@ -161,11 +175,19 @@
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">Group</td>
<td class="second-collumn" style="width: 50%">Desctiption</td>
<td></td>
<td></td>
<td class="second-collumn" style="width: 40%">Desctiption</td>
<td>
<span class="add-button-wi">
<a title="Show all groups" id="show-all-groups" style="color: #fff">
Show all
</a>
</span>
</td>
</tr>
{% set counter = 0 -%}
{% for group in groups %}
{% set counter = counter + loop.index0 %}
{% if counter <= 2 %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
<a href="users.py#groups" title="Edit groups" class="logs_link">
@ -175,8 +197,19 @@
</td>
<td class="third-collumn-wi">{{ group.2 }}</td>
<td></td>
</tr>
{% else %}
<tr style="display: none;" class="show-groups {{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
<a href="users.py#groups" title="Edit groups" class="logs_link">
{{ group.1 }}
<img src="/inc/images/edit.png" alt="Edit" width="15" style="margin-bottom: -3px;" />
</a>
</td>
<td class="third-collumn-wi">{{ group.2 }}</td>
<td></td>
</tr>
{% endif %}
{% endfor %}
</table>

View File

@ -43,10 +43,10 @@
<input type="hidden" id="usergroup-{{user.0}}" name="usergroup-{{user.0}}" value="{{ group }}">
</td>
<td>
{% if user.6 == 1%}
<input type="password" id="password-{{user.0}}" value="{{user.3}}" class="form-control" readonly>
{% else %}
<input type="password" id="password-{{user.0}}" value="{{user.3}}" class="form-control">
{% if user.6 != 1%}
<span title="Change password" style="cursor: pointer" class="passwordChange">
<img src="/inc/images/edit.png" alt="Edit" width="15" style="margin-bottom: -3px; padding-left: 15px;" onclick="openChangeUserPasswordDialog('{{user.0}}')" />
</span>
{% endif %}
</td>
<td class="checkbox">
@ -538,11 +538,43 @@
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
</form>
</div>
<div id="user-change-password-table" style="display: none;">
<table class="overview">
<tr>
<td colspan="2">
<p class="validateTips alert alert-success">Enter password and confirm</p>
</td>
</tr>
<tr>
<td class="padding20">
Password
</td>
<td>
<input type="password" name="change-password" id="change-password" class="form-control">
</td>
</tr>
<tr>
<td class="padding20">
Confirm password
</td>
<td>
<input type="password" name="change2-password" id="change2-password" class="form-control">
</td>
</tr>
<tr id="missmatchpass" style="display: none;">
<td colspan="2">
<p class="validateTips alert alert-danger" style="margin-top: 10px;">Passwords are mismatched</p>
</td>
</tr>
</table>
</div>
<script>
if($('#new-server-group-add').val() == 1) {
$('#group_error').css('display', 'block');
$('#add-user-button').css('display', 'none');
$('#add-server-button').css('display', 'none');
$('.passwordChange').css('display', 'none');
$('.add').css('display', 'none');
$('#add-ssh-button').css('display', 'none');
$('#ssh_key_upload').css('display', 'none');
$('#add-telegram-button').css('display', 'none');
@ -569,9 +601,6 @@
$("#credentials-{{server.0}}" ).selectmenu({
width: 150
});
if($('#new-server-group-add').val() == 1) {
$('#clone-{{server.0}}').css('display', 'none')
}
{% endfor %}
});
</script>

View File

@ -74,15 +74,30 @@ $( function() {
confirmAjaxAction("restart", "waf", id);
});
$( "#show-all-users" ).click( function() {
if($( "#show-all-users" ).text() == "Show all") {
$( ".show-users" ).show("fast");
$( "#show-all-users" ).text("Hide");
$( "#show-all-users" ).attr("title", "Hide all users");
} else {
$( ".show-users" ).hide("fast");
$( "#show-all-users" ).attr("title", "Show all users");
$( "#show-all-users" ).text("Show all");
}
$( ".show-users" ).show("fast");
$( "#show-all-users" ).text("Hide");
$( "#show-all-users" ).attr("title", "Hide all users");
$( "#show-all-users" ).attr("id", "hide-all-users");
$.getScript('/inc/overview.js');
});
$( "#hide-all-users" ).click( function() {
$( ".show-users" ).hide("fast");
$( "#hide-all-users" ).attr("title", "Show all users");
$( "#hide-all-users" ).text("Show all");
$( "#hide-all-users" ).attr("id", "show-all-users");
});
$( "#show-all-groups" ).click( function() {
$( ".show-groups" ).show("fast");
$( "#show-all-groups" ).text("Hide");
$( "#show-all-groups" ).attr("title", "Hide all groups");
$( "#show-all-groups" ).attr("id", "hide-all-groups");
$.getScript('/inc/overview.js');
});
$( "#hide-all-groups" ).click( function() {
$( ".show-groups" ).hide("fast");
$( "#hide-all-groups" ).attr("title", "Show all groups");
$( "#hide-all-groups" ).text("Show all");
$( "#hide-all-groups" ).attr("id", "show-all-groups");
});
if (cur_url[0] == "overview.py" || cur_url[0] == "waf.py" || cur_url[0] == "metrics.py") {
$('#secIntervals').css('display', 'none');

View File

@ -6,7 +6,8 @@ body {
font-size: 1.3em;
line-height: 1.42857143;
color: #000;
background-color: #eee;
/* background-color: #eee; */
background-color: #fff;
margin: 0;
padding: 0;
overflow: auto;
@ -20,6 +21,7 @@ h2 {
color: #fff;
margin-top: 0px;
margin-bottom: 0px;
width: 99%
}
h3 {
margin-top: -0;
@ -95,6 +97,7 @@ pre {
margin-right: 20px;
border-top: 1px solid #ddd;
clear: both;
/* position: fixed; */
}
#version {
float: left;
@ -801,6 +804,11 @@ label {
margin-bottom: -40px;
padding-left: 70px;
}
@media (max-width: 1920px) {
#logo_span {
margin-left: 17%;
}
}
@media (max-width: 1024px) {
#logo_span {
margin-left: -5%;