Many interface changes, bugs fix
pull/161/head
Pavel Loginov 2019-10-04 09:23:48 +03:00
parent 5a46d8c8d2
commit 91badd5c90
22 changed files with 138 additions and 86 deletions

View File

@ -50,7 +50,7 @@ Support the project
# Install
## RPM
Install repository^
Install repository:
```
yum install https://repo.haproxy-wi.org/el7/haproxy-wi-release-7-1-0.noarch.rpm
```
@ -149,7 +149,7 @@ MariaDB [(none)]> create database haproxywi;
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'%' IDENTIFIED BY 'haproxy-wi';
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'localhost' IDENTIFIED BY 'haproxy-wi';
```
![alt text](image/haproxy-wi-overview.jpeg "Overview page")
![alt text](image/haproxy-wi-overview.png "Overview page")
# Settings
```
@ -165,7 +165,7 @@ For Runtime API, Metrics and Alerting enable state file and stat socket on HApro
global
stats socket *:1999 level admin
stats socket /var/run/haproxy.sock mode 600 level admin
server-state-file /etc/haproxy/haproxy/haproxy.state
server-state-file /etc/haproxy/haproxy.state
defaults
load-server-state-from-file global
@ -173,7 +173,7 @@ For Runtime API, Metrics and Alerting enable state file and stat socket on HApro
listen stats
stats admin if TRUE
```
![alt text](image/haproxy-wi-logs.jpeg "View logs page")
![alt text](image/haproxy-wi-logs.png "View logs page")
# Update
```

View File

@ -420,7 +420,7 @@ def update_db_v_3_4_9_5(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
sql = """update version set version = '3.4.9.6'; """
sql = """update version set version = '3.5'; """
try:
cur.execute(sql)
con.commit()
@ -437,9 +437,9 @@ def update_to_hash():
ver = ''
for l in cur_ver:
ver += l
if i == 4:
break
i += 1
if len(ver) < 4:
ver += '00'
if ver <= '3490':
con, cur = get_cur()
sql = """select id, password from user """

View File

@ -29,7 +29,10 @@ def get_data(type):
from datetime import datetime
from pytz import timezone
import sql
now_utc = datetime.now(timezone(sql.get_setting('time_zone')))
try:
now_utc = datetime.now(timezone(sql.get_setting('time_zone')))
except:
now_utc = datetime.now(timezone('UTC'))
if type == 'config':
fmt = "%Y-%m-%d.%H:%M:%S"
if type == 'logs':
@ -634,11 +637,16 @@ def versions():
new_ver = check_new_version()
new_ver_without_dots = new_ver.split('.')
new_ver_without_dots = ''.join(new_ver_without_dots)
new_ver_without_dots = new_ver_without_dots.replace('\n', '')
if len(new_ver_without_dots) == 2:
new_ver_without_dots += '00'
if len(new_ver_without_dots) == 3:
new_ver_without_dots += '0'
new_ver_without_dots = int(new_ver_without_dots)
except:
new_ver = "Sorry cannot get new version"
new_ver_without_dots = 0
return current_ver, new_ver, current_ver_without_dots, new_ver_without_dots

View File

@ -35,7 +35,7 @@ for s in servers:
servers_with_status.append(s[2])
servers_with_status.append(s[11])
for k in out:
if "Ncat: Connection refused." not in k and "Ncat: Connection timed out." not in k:
if "Ncat:" not in k:
out1 = out
else:
out1 = False

View File

@ -83,7 +83,7 @@ async def async_get_overviewServers(serv1, serv2):
# os.system("/bin/rm -f " + cfg)
for k in out:
if "Ncat: Connection refused." not in k and "Ncat: Connection timed out." not in k:
if "Ncat:" not in k:
for r in k:
out1 += r
out1 += "<br />"

View File

@ -4,16 +4,19 @@
{% do waf_servers.append(1) %}
<tr class="{{ loop.cycle('odd', 'even') }}" id="{{service.0}}-select-line">
<td class="padding10 first-collumn-wi">
{% if service.2|int() >= 1 %}
<span class="serverUp" title="running {{service.2 }} processes"> UP</span>
{% else %}
<span class="serverDown"> DOWN</span>
{% endif %}
<a href="#{{ service.0 }}" title="Go to {{ service.0 }} status" style="color: #000">{{ service.0 }}</a>
{% if service.2|int() >= 1 %}
<span class="serverUp server-status" title="running {{service.2 }} processes"></span>
{% else %}
<span class="serverDown server-status"></span>
{% endif %}
<a href="/app/logs.py?serv={{ service.1 }}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00&waf=1" title="View {{service.0 }}'s WAF logs" class="logs_link">
{{ service.0 }}
</a>
</td>
<!-- <td class="second-collumn"> -->
<!-- </td> -->
{% if url == "waf.py" %}
<td>
</td>
{% endif %}
<td>
{% if role <= 1 %}
<a id="{{ service.1 }}" class="start-waf" title="Start WAF service">

View File

@ -2,12 +2,13 @@
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% if service.2|int() >= 1 %}
<span class="serverUp" title="running {{service.2 }} processes"> UP</span>
{% else %}
<span class="serverDown"> DOWN</span>
{% endif %}
{{ service.0 }}
<span class="serverUp server-status" title="running {{service.2 }} processes"></span>
{% else %}
<span class="serverDown server-status"></span>
{% endif %}
<a href="/app/logs.py?serv={{ service.1 }}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00&waf=0" title="View {{service.0 }}'s logs" class="logs_link">
{{ service.0 }}
</a>
{% if service.4.0.0|int() >= 1 %}
<img
{% if service.5.0.0|int() >= 1 %}

View File

@ -50,9 +50,6 @@
{% if role <= 2 %}
<li><a href=/app/config.py title="Working with HAProxy configs" class="edit head-submenu">Configs</a></li>
<li><a href=/app/add.py#proxy title="Add proxy" class="add head-submenu" id="add1">Add proxy</a></li>
<!-- <li><a href=/app/add.py#frontend title="Add single frontend" class="add head-submenu" id="add2">Add frontend</a></li> -->
<!-- <li><a href=/app/add.py#frontend title="Add single frontend" class="add head-submenu" id="add2">Add frontend</a></li> -->
<!-- <li><a href=/app/add.py#backend title="Add single backend" class="add head-submenu" id="add3">Add backend</a></li> -->
<li><a href=/app/versions.py title="Actions with configs versions" class="version head-submenu">Versions</a></li>
<li><a href=/app/add.py#ssl title="Upload SSL cert" class="cert head-submenu" id="add4">SSL</a></li>
<li><a href=/app/add.py#option title="Save custom options" class="option head-submenu" id="add5">Options</a></li>
@ -98,23 +95,7 @@
{% endif %}
</ul>
</nav>
<div class="copyright-menu">
{% if versions is defined %}
{% set current_ver = versions.0 %}
{% set new_ver = versions.1 %}
{% set current_ver_without_dots = versions.2 %}
{% set new_ver_without_dots = versions.3 %}
{% endif %}
{% if new_ver_without_dots is defined and current_ver_without_dots is defined and new_ver is defined and new_ver_without_dots is defined %}
{% if new_ver_without_dots > current_ver_without_dots and new_ver != "Sorry cannot get current version" %}
<span id="show-updates-button" class="new-version-exists">v{{current_ver}} </span>
{% else %}
v{{current_ver}}
{% endif %}
{% else %}
v{{current_ver}}
{% endif %}
<br>
<div class="donate-menu">
<a href="https://haproxy-wi.org/donate.py" title="Donate" target="_blank" style="color: #fff; margin-left: -10px; color: red;" class="patreon"> Donate</a>
</div>
</div>
@ -215,11 +196,11 @@
<div id="ajax"></div>
</div>
<div id="show-updates" style="display: none;">
<div>
There is a new version HAProxy-WI. Check the <a href="/app/update.py">Update page</a>
</div>
</div>
<div id="show-updates" style="display: none;">
<div>
There is a new version HAProxy-WI. Check the <a href="/app/update.py">Update page</a>
</div>
</div>
<div class="footer">
<a href="#" id="hide_menu" title="Hide menu" style="float: left;">
<span class="ui-state-default ui-corner-all">
@ -227,13 +208,39 @@
</span>
</a>
<div class="show_menu" style="display: none; float: left;">
<a href="#" id="show_menu" title="Show menu">
<span class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-arrowthick-1-e" id="arrow"></span>
</span>
</a>
</div>
<a href="#" id="show_menu" title="Show menu">
<span class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-arrowthick-1-e" id="arrow"></span>
</span>
</a>
</div>
<div id="version">
{% if versions is defined %}
{% set current_ver = versions.0 %}
{% set new_ver = versions.1 %}
{% set current_ver_without_dots = versions.2 %}
{% set new_ver_without_dots = versions.3 %}
{% endif %}
{% if new_ver_without_dots is defined and current_ver_without_dots is defined and new_ver is defined and new_ver_without_dots is defined %}
<a href="https://haproxy-wi.org/changelog.py" title="View changelog" target="_blank" style="color: #000;">
{% if new_ver_without_dots > current_ver_without_dots and new_ver != "Sorry cannot get current version" %}
<span id="show-updates-button" class="new-version-exists">v{{current_ver}} </span>
{% else %}
v{{current_ver}}
{% endif %}
</a>
{% else %}
v{{current_ver}}
{% endif %}
<br>
</div>
<div id="logo_footer">
<a href="https://haproxy-wi.org" title="HAProxy-WI site" target="_blank">
<img src="/inc/images/logo_footer.png" alt="logo" id="logo_footer_img" />
</a>
</div>
<div class="footer-div">
<a href="https://github.com/Aidaho12/haproxy-wi/" class="footer-link" target="_blank">Github</a>
<a href="https://github.com/Aidaho12/haproxy-wi/issues" class="footer-link" target="_blank">Help</a>
<a href="https://github.com/Aidaho12" class="footer-link" target="_blank">Contact</a>
<a href="http://haproxy-wi.org" class="footer-link" target="_blank">About</a>

View File

@ -42,7 +42,7 @@
<a href="/app/config.py?serv={{s.2}}&showCompare" class="ui-button ui-widget ui-corner-all" title="Compare configs">Compare</a>
<a href="/app/config.py?serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" title="Show map">Map</a>
<a href="/app/viewsttats.py?serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View stat">Stat</a>
<a href="/app/logs.py?serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View log">Log</a>
<a href="/app/logs.py?serv={{s.2}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" class="ui-button ui-widget ui-corner-all" title="View log">Log</a>
{% if role <= 2 %}
<a href="/app/versions.py?serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all">Versions</a>
{% endif %}

View File

@ -29,12 +29,12 @@
</tr>
<input type="hidden" id="group" value="{{group}}">
</table>
<div id="ajax"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
In this section you can create and edit black and white lists. And after use them in the HAProxy configs
In this section you can create and edit black and white lists. And after use them in the HAProxy configs or in the "Add proxy" pages
</div>
<div id="ajax"></div>
<div id="dialog-confirm" title="View certificate " style="display: none;">
<span><b>Note:</b>Each new address should be specified from a new line</span>
<span><b>Note:</b> Each new address should be specified from a new line</span>
<textarea id="edit_lists" cols=95 rows=20></textarea>
</div>
{% endblock %}

View File

@ -85,6 +85,9 @@
</div>
{% else %}
<script>
{% if waf == '1' %}
$('#waf').prop('checked', true);
{% endif %}
showLog()
</script>
{% endif %}

View File

@ -43,7 +43,7 @@
</tr>
<tbody id="ajaxwafstatus"></tbody>
</table>
<table class="overview-wi" style="height: 172;">
<table class="overview-wi" style="height: 170;">
<tr class="overviewHead" style="height: 48px;">
<th class="padding10 first-collumn-wi" colspan=4>
Tools status
@ -51,45 +51,50 @@
</tr>
<tr>
<td class="padding10 first-collumn-wi">
{% if metrics_master|int() >= 1 %}
<span title="running {{ metrics_master }} master processes"><span class="serverUp"> UP</span>
{% else %}
<span title="running {{ metrics_master }} master processes"><span class="serverDown"> DOWN</span>
{% endif %}
<span>Metrics master</span>
{% if metrics_master|int() >= 1 %}
<span title="running {{ metrics_master }} master processes"><span class="serverUp server-status"></span></span>
{% else %}
<span class="serverDown server-status"></span>
{% endif %}
<a href="/app/viewlogs.py?viewlogs=metrics-error.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View metrics master's logs" class="logs_link">
<span>Metrics master</span>
</a>
</td>
<td class="third-collumn-wi">
{% if checker_master|int() >= 1 %}
<span title="running {{ checker_master }} master processes"><span class="serverUp"> UP</span>
<span title="running {{ checker_master }} master processes"><span class="serverUp server-status"></span></span>
{% else %}
<span title="running {{ checker_master }} master processes"><span class="serverDown"> DOWN</span>
<span class="serverDown server-status"></span>
{% endif %}
<span>Checker master</span>
<a href="/app/viewlogs.py?viewlogs=checker-error.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker master's logs" class="logs_link">
<span>Checker master</span>
</a>
</td>
<td class="third-collumn-wi">
{% if keep_alive|int() >= 1 %}
<span title="Keep alive is run"><span class="serverUp"> UP</span>
<span title="running {{ keep_alive }} processe"><span class="serverUp server-status"></span></span>
{% else %}
<span title="Keep alive is down"><span class="serverDown"> DOWN</span>
<span class="serverDown server-status"></span>
{% endif %}
<a href="/app/viewlogs.py?viewlogs=keep_alive.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View keep alive logs" class="logs_link">
<span>Keep alive</span>
</a>
</td>
</tr>
<tr>
<td class="padding10 first-collumn-wi">
{% if metrics_worker|int() >= 1 %}
<span title="running {{metrics_worker}} worker processes"><span class="serverUp"> UP</span>
<span title="running {{metrics_worker}} worker processes"><span class="serverUp server-status"></span>
{% else %}
<span title="running {{metrics_worker}} worker processes"><span class="serverDown"> DOWN</span>
<span title="running {{metrics_worker}} worker processes"><span class="serverDown server-status"></span>
{% endif %}
<span>Metrics workers</span>
</td>
<td>
{% if checker_worker|int() >= 1 %}
<span title="running {{ checker_worker }} worker processes"><span class="serverUp"> UP</span>
<span title="running {{ checker_worker }} worker processes"><span class="serverUp server-status"></span>
{% else %}
<span title="running {{ checker_worker }} worker processes"><span class="serverDown"> DOWN</span>
<span title="running {{ checker_worker }} worker processes"><span class="serverDown server-status"></span>
{% endif %}
<span>Checker workers</span>
</td>
@ -118,7 +123,7 @@
{% if counter <= 2 %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
<a href="users.py#users" title="Edit user" style="color: #000;">
<a href="users.py#users" title="Edit user" class="logs_link">
{{ USER.1 }}
<img src="/inc/images/edit.png" alt="Edit" width="15" style="margin-bottom: -3px;" />
</a>
@ -135,7 +140,7 @@
{% else %}
<tr style="display: none;" class="show-users {{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
<a href="users.py#users" title="Edit user" style="color: #000;">
<a href="users.py#users" title="Edit user" class="logs_link">
{{ USER.1 }}
<img src="/inc/images/edit.png" alt="Edit" width="15" style="margin-bottom: -3px;" />
</a>
@ -163,7 +168,7 @@
{% for group in groups %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
<a href="users.py#groups" title="Edit groups" style="color: #000;">
<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>

View File

@ -54,6 +54,6 @@
</script>
<div id="ajaxruntime"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all Run Time API <a href="https://haproxy-wi.org/description.py?description=runtimeapi" title="Servers description" target="_blank">here</a>
You can read the description of all Run Time API <a href="https://haproxy-wi.org/description.py?description=runtimeapi" title="Run Time API description" target="_blank">here</a>
</div>
{% endblock %}

View File

@ -1,5 +1,9 @@
{% extends "base.html" %}
{% block content %}
{% set current_ver = versions.0 %}
{% set new_ver = versions.1 %}
{% set current_ver_without_dots = versions.2 %}
{% set new_ver_without_dots = versions.3 %}
<script src="/inc/users.js"></script>
<table class="overview">
<tr class="overviewHead">

View File

@ -5,7 +5,7 @@
<td class="padding10 first-collumn">
Server
</td>
<td class="padding10 second-collumn">
<td>
<!-- WAF status -->
</td>
<td class="padding10">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 KiB

BIN
image/haproxy-wi-logs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
inc/images/logo_footer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -338,7 +338,8 @@ function showLog() {
'&hour='+hour+
'&minut='+minut+
'&hour1='+hour1+
'&minut1='+minut1);
'&minut1='+minut1+
'&waf='+waf);
}
} );
}

View File

@ -96,6 +96,21 @@ pre {
border-top: 1px solid #ddd;
clear: both;
}
#version {
float: left;
padding: 20px;
padding-top: 10px;
font-size: 14.5px;
font-weight: bold;
}
#logo_footer {
float: left;
margin-left: 41%;
}
#logo_footer_img {
width: 35px;
margin-top: 8px;
}
.footer-div {
display: block;
padding-top: 12px;
@ -234,13 +249,15 @@ pre {
.paramInSec {
font-weight: bold;
}
.copyright-menu {
.donate-menu {
font-weight: bold;
font-style: italic;
font-size: 15px;
color: #fff;
margin-left: 30px;
position: fixed;
margin-left: 65px;
margin-top: 25px;
}
.line {
background-color: #f5faf4;
@ -606,6 +623,9 @@ a:focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.logs_link {
color: #23527c;
}
table {
border-spacing: 0;
border-collapse: collapse;
@ -736,7 +756,7 @@ label {
margin-left: -2px;
}
.server-act-links a {
margin-right: 2.8px !important
margin-right: 2.3px !important
}
.server-act-links a:last-child {
margin-right: 0 !important;