diff --git a/app/overview.py b/app/overview.py index 8c22223a..88e63a88 100644 --- a/app/overview.py +++ b/app/overview.py @@ -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) diff --git a/app/sql.py b/app/sql.py index 7dee3fd6..21e70309 100644 --- a/app/sql.py +++ b/app/sql.py @@ -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) diff --git a/app/templates/ovw.html b/app/templates/ovw.html index d9ded6af..3e4a5ce5 100644 --- a/app/templates/ovw.html +++ b/app/templates/ovw.html @@ -43,6 +43,20 @@ + + + + + + + +
HAProxy-WI server status
+
+			{% for s in server_status %}
+{{ s }}
+{% endfor %}
+			
+
@@ -161,11 +175,19 @@ - - - + + + {% set counter = 0 -%} {% for group in groups %} + {% set counter = counter + loop.index0 %} + {% if counter <= 2 %} + + {% else %} + + + + {% endif %} {% endfor %}
GroupDesctiptionDesctiption + + + Show all + + +
@@ -175,8 +197,19 @@ {{ group.2 }}
diff --git a/app/templates/servers.html b/app/templates/servers.html index d218401a..f5a398d3 100644 --- a/app/templates/servers.html +++ b/app/templates/servers.html @@ -43,10 +43,10 @@
- {% if user.6 == 1%} - - {% else %} - + {% if user.6 != 1%} + + Edit + {% endif %} @@ -538,11 +538,43 @@ + diff --git a/inc/overview.js b/inc/overview.js index 69dfafa6..82ac864b 100644 --- a/inc/overview.js +++ b/inc/overview.js @@ -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'); diff --git a/inc/style.css b/inc/style.css index 1f6d8a8f..ab691a8e 100644 --- a/inc/style.css +++ b/inc/style.css @@ -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%;