Design
pull/19/head
Aidaho12 2018-02-07 15:08:20 +06:00
parent f4fb2c08f6
commit bc5bd94467
5 changed files with 55 additions and 26 deletions

View File

@ -15,12 +15,21 @@ head("Edit & show HAproxy settings")
funct.check_login()
print('<center><h2>Edit & show HAproxy settings</h2></center>')
print('<center><h3>Choose server & action: Disable/Enable server or output any information about the server:</h3>')
print('<form action="edit.py" method="get">')
print('<p><select autofocus required name="serv" id="serv">')
print('<option disabled selected>Choose server</option>')
print('<center>'
'<h2>Edit & show HAproxy settings</h2>'
'</center>'
'<table class="overview">'
'<tr class="overviewHead">'
'<td class="padding10">Server</td>'
'<td>Disable/Enable server or output any information</td>'
'<td class="padding10">Command</td>'
'</tr>'
'<tr>'
'<td class="padding10" style="width: 35%;">'
'<form action="edit.py" method="get">'
'<select autofocus required name="serv">'
'<option disabled selected>Choose server</option>')
funct.choose_server_with_vip(serv)
action = form.getvalue('servaction')
@ -43,17 +52,21 @@ else:
selected2 = ''
selected3 = ''
print('</select>')
print('<select autofocus required name="servaction" id="chooseServer">')
print('</select></td>')
print('<td style="width: 35%;"><select autofocus required name="servaction">')
print('<option disabled selected>Choose action</option>')
print('<option value=1 %s>Disable server</option>' % selected1)
print('<option value=2 %s>Enable server</option>' % selected2)
print('<option value=3 %s>Show</option>' % selected3)
print('</select>')
print('<input type="text" name="servbackend" size=40 placeholder="Backend/Server, show info, pools or help" required>')
print('<p>')
print('</select></td>')
print('<td><input type="text" name="servbackend" size=40 placeholder="Backend/Server, show info, pools or help" required>')
print('</td></tr>'
'<tr style="border:none;">'
'<td></td><td class="padding10" style="border:none; padding-left: 12%;">')
funct.mode_admin("Enter")
print('</p></form>')
print('</td></form>'
'</tr></table>')
if form.getvalue('servaction') is not None:
action = form.getvalue('servaction')
@ -71,10 +84,8 @@ if form.getvalue('servaction') is not None:
stdout, stderr = p.communicate()
output = stdout.splitlines()
print('<center><h3>You %s %s on HAproxy %s. <a href="viewsttats.py?serv=%s" title="View stat" target="_blank">Look it </a> or <a href="edit.py" title="Edit">Edit something else</a>' % (enable, backend, serv, serv))
print('</center>')
print('\n<center><p>'.join(map(str, output)))
print('<center><h3>You %s %s on HAproxy %s. <a href="viewsttats.py?serv=%s" title="View stat" target="_blank">Look it</a> or <a href="edit.py" title="Edit">Edit something else</a></h3><br />' % (enable, backend, serv, serv))
print('<center>'.join(map(str, output)))
action = 'edit.py ' + enable + ' ' + backend
funct.logging(serv, action)

View File

@ -18,11 +18,20 @@ path_config = "haproxy-webintarface.config"
config = configparser.ConfigParser()
config.read(path_config)
print('<center><h2>HAproxy Logs</h2></center>')
print('<center><h3>Choose server & number rows</h3>')
print('<form action="logs.py" method="get">')
print('<p><select autofocus required name="serv" id="serv">')
print('<option disabled>Choose server</option>')
print('<center>'
'<h2>HAproxy Logs</h2>'
'</center>'
'<table class="overview">'
'<tr class="overviewHead">'
'<td class="padding10">Server</td>'
'<td>Number rows</td>'
'<td class="padding10">Ex for grep</td>'
'</tr>'
'<tr>'
'<td class="padding10">'
'<form action="logs.py" method="get">'
'<select autofocus required name="serv" id="serv">'
'<option disabled>Choose server</option>')
for i in sorted(listhap.listhap):
if listhap.listhap.get(i) == serv:
@ -47,10 +56,16 @@ if form.getvalue('grep') is not None:
else:
grep = 'value='
print('<input type="text" name="rows" %s required>' % rows)
print('|grep')
print('<input type="text" name="grep" %s>' % grep)
print('<p><button type="submit">Show</button></p></form>')
print('</td><td><input type="text" name="rows" %s required></td>' % rows)
print('<td><input type="text" name="grep" %s>' % grep)
print('</td></tr>'
'<tr style="border:none;">'
'<th style="border:none;">'
'<td class="padding10" >'
'<button type="submit">Show</button>'
'</td>'
'</th></form>'
'</tr></table>')
if form.getvalue('serv') is not None:
rows = form.getvalue('rows')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 KiB

After

Width:  |  Height:  |  Size: 403 KiB

View File

@ -13,7 +13,7 @@ body {
h2 {
border: 1px solid #5D9CEB;
padding: 10px;
border-radius: 5px;
border-radius: 5px 5px 0px 0px;
background: #5D9CEB;
padding-left: 3%;
color: #fff;
@ -23,6 +23,9 @@ h3 {
margin-top: 10px;
margin-bottom: 0px;
}
form {
margin: 0;
}
.top-menu {
background-color: #222;
min-height: 50px;