mirror of https://github.com/Aidaho12/haproxy-wi
v1.8
parent
94984709da
commit
0544d0f8a8
|
@ -169,8 +169,8 @@ print('</select>'
|
|||
'<option value="tcp">tcp</option>'
|
||||
'</select>'
|
||||
'<span id="https-listen-span">'
|
||||
'<label for="https-listen" style="margin-top: 5px;">ssl?</label>'
|
||||
'<input type="checkbox" id="https-listen" name="ssl" value="https">'
|
||||
'<label for="https-listen" style="margin-top: 5px;" title="Enable ssl">ssl?</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 path to pem file:</span><br />'
|
||||
|
@ -194,7 +194,7 @@ print('</select>'
|
|||
'<tr>'
|
||||
'<td class="addName">Optinons:</td>'
|
||||
'<td class="addOption">'
|
||||
'<label for="options-listen-show" style="margin-top: 5px;">Optinons</label><input type="checkbox" id="options-listen-show">'
|
||||
'<label for="options-listen-show" style="margin-top: 5px;" title="Set options">Set</label><input type="checkbox" id="options-listen-show">'
|
||||
'<div id="options-listen-show-div" style="display: none;">'
|
||||
'<div class="tooltip">'
|
||||
'<span style="padding-right: 10px;" class="form-control">Start typing options: </span>'
|
||||
|
@ -212,12 +212,13 @@ print('</select>'
|
|||
'<td class="addOption">'
|
||||
'<textarea name="servers" required title="Backend servers" cols=80 placeholder="hostname ip:port"></textarea>'
|
||||
'<div>'
|
||||
'<label for="controlgroup-listen-show" style="margin-top: 5px;">Cusmot check params</label>'
|
||||
'<label for="controlgroup-listen-show" style="margin-top: 5px;" title="Change default check">Cusmot check params</label>'
|
||||
'<input type="checkbox" id="controlgroup-listen-show" name="default-check" value="1">'
|
||||
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
||||
'</div>'
|
||||
'<div class="controlgroup" id="controlgroup-listen" style="display: none;">'
|
||||
'<label for="check-servers-listen">Check</label><input type="checkbox" id="check-servers-listen" name="check-servers" checked value="1">'
|
||||
'<label for="check-servers-listen" title="Ebable servers check">Check</label>'
|
||||
'<input type="checkbox" id="check-servers-listen" name="check-servers" checked value="1">'
|
||||
'<select name="inter" id="inter-listen">'
|
||||
'<option value="inter" disabled selected>inter</option>'
|
||||
'<option value="1000">1000</option>'
|
||||
|
@ -283,7 +284,7 @@ print('</select>'
|
|||
'<tr>'
|
||||
'<td class="addName">Mode: </td>'
|
||||
'<td class="addOption">'
|
||||
'<select required name="mode">'
|
||||
'<select required name="mode" id="frontend-mode-select">'
|
||||
'<option value="http" selected>http</option>'
|
||||
'<option value="tcp">tcp</option>'
|
||||
'</select>'
|
||||
|
@ -300,7 +301,7 @@ print('</select>'
|
|||
'<tr>'
|
||||
'<td class="addName">Optinons:</td>'
|
||||
'<td class="addOption">'
|
||||
'<label for="options-frontend-show" style="margin-top: 5px;">Optinons</label><input type="checkbox" id="options-frontend-show">'
|
||||
'<label for="options-frontend-show" style="margin-top: 5px;" title="Set options">Set</label><input type="checkbox" id="options-frontend-show">'
|
||||
'<div id="options-frontend-show-div" style="display: none;">'
|
||||
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
||||
|
@ -359,7 +360,7 @@ print('</select>'
|
|||
'<tr>'
|
||||
'<td class="addName">Mode: </td>'
|
||||
'<td class="addOption">'
|
||||
'<select required name="mode">'
|
||||
'<select required name="mode" id="backend-mode-select">'
|
||||
'<option value="http" selected>http</option>'
|
||||
'<option value="tcp">tcp</option>'
|
||||
'</select>'
|
||||
|
@ -389,7 +390,7 @@ print('</select>'
|
|||
'<tr>'
|
||||
'<td class="addName">Optinons:</td>'
|
||||
'<td class="addOption">'
|
||||
'<label for="options-backend-show" style="margin-top: 5px;">Optinons</label><input type="checkbox" id="options-backend-show">'
|
||||
'<label for="options-backend-show" style="margin-top: 5px;" title="Set options">Set</label><input type="checkbox" id="options-backend-show">'
|
||||
'<div id="options-backend-show-div" style="display: none;">'
|
||||
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
||||
|
@ -407,12 +408,12 @@ print('</select>'
|
|||
'<td class="addOption">'
|
||||
'<textarea name="servers" title="Backend servers" required cols=80 placeholder="hostname ip:port"></textarea>'
|
||||
'<div>'
|
||||
'<label for="controlgroup-backend-show" style="margin-top: 5px;">Cusmot check params</label>'
|
||||
'<label for="controlgroup-backend-show" style="margin-top: 5px;" title="Change default check" >Cusmot check params</label>'
|
||||
'<input type="checkbox" id="controlgroup-backend-show" name="default-check">'
|
||||
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
||||
'</div>'
|
||||
'<div class="controlgroup" id="controlgroup-backend" style="display: none;">'
|
||||
'<label for="check-servers-backend">Check</label>'
|
||||
'<label for="check-servers-backend" title="Ebable servers check">Check</label>'
|
||||
'<input type="checkbox" id="check-servers-backend" name="check-servers" checked value="1">'
|
||||
'<select name="inter" id="inter-backend">'
|
||||
'<option value="inter" disabled selected>inter</option>'
|
||||
|
|
|
@ -3,6 +3,7 @@ import html
|
|||
import cgi
|
||||
import funct
|
||||
import configparser
|
||||
import json
|
||||
import listserv as listhap
|
||||
|
||||
funct.head("Overview")
|
||||
|
@ -12,11 +13,40 @@ funct.check_login()
|
|||
path_config = "haproxy-webintarface.config"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(path_config)
|
||||
USERS = '/var/www/haproxy-wi/cgi-bin/users'
|
||||
|
||||
try:
|
||||
with open(USERS, "r") as user:
|
||||
pass
|
||||
except IOError:
|
||||
print("Can't load users DB")
|
||||
|
||||
print('<h2>Quick Status </h2><table class="overview">')
|
||||
|
||||
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
|
||||
|
||||
print('<tr class="overviewHead">'
|
||||
'<td class="padding10">User name</td>'
|
||||
'<td class="padding10">'
|
||||
'Role'
|
||||
'<span style="float: right; margin-left: 80&;">'
|
||||
'<a href="#" title="Show all users" id="show-all-users">'
|
||||
'Show all'
|
||||
'</a>'
|
||||
'</td>'
|
||||
'</tr>')
|
||||
|
||||
i = 0
|
||||
style = ""
|
||||
for f in open(USERS, 'r'):
|
||||
i = i + 1
|
||||
users = json.loads(f)
|
||||
if i is 4:
|
||||
style = 'style="display: none;" class="show-users"'
|
||||
print('<tr ' + style + '><td class="padding10">' + users['firstName'] + ' ' + users['lastName'] +'</td><td>')
|
||||
print(users['role'])
|
||||
print('</td></tr>')
|
||||
|
||||
print('<tr class="overviewHead">'
|
||||
'<td class="padding10">Server</td>'
|
||||
'<td class="padding10">'
|
||||
|
@ -49,5 +79,9 @@ for i in sorted(listhap.listhap):
|
|||
funct.ssh_command(listhap.listhap.get(i), commands)
|
||||
print('</pre></td></tr>')
|
||||
|
||||
print('</table>')
|
||||
print('<tr>'
|
||||
'<iframe src="http://172.28.5.106:3000/d-solo/000000002/haproxy?refresh=1m&orgId=1&panelId=1&theme=light" height="200" frameborder="0"></iframe>'
|
||||
'<iframe src="http://172.28.5.106:3000/d-solo/000000002/haproxy?refresh=1m&orgId=1&panelId=2&theme=light" height="200" frameborder="0"></iframe>'
|
||||
'<iframe src="http://172.28.5.106:3000/d-solo/000000002/haproxy?refresh=1m&orgId=1&panelId=3&theme=light" height="200" frameborder="0"></iframe>'
|
||||
'</tr></table>')
|
||||
funct.footer()
|
45
script.js
45
script.js
|
@ -4,7 +4,14 @@ $( function() {
|
|||
$( "#tabs" ).tabs( "option", "active", 2 );
|
||||
} );
|
||||
$( "select" ).selectmenu();
|
||||
//$( document ).tooltip();
|
||||
|
||||
var tooltips = $( "[title]" ).tooltip({
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "right+5 top-5",
|
||||
collision: "none"
|
||||
}
|
||||
});
|
||||
$( "input[type=submit], button" ).button();
|
||||
$( "input[type=checkbox]" ).checkboxradio();
|
||||
$( ".controlgroup" ).controlgroup();
|
||||
|
@ -13,11 +20,22 @@ $( function() {
|
|||
heightStyle: "content",
|
||||
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
|
||||
});
|
||||
$( "dropdown_selector" ).change(function() {
|
||||
/*$( "dropdown_selector" ).change(function() {
|
||||
var $option = $(this).find('option:selected');
|
||||
if ($option == "tcp") {
|
||||
$("#https-listen").hide();
|
||||
}
|
||||
}); */
|
||||
$ ( "#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");
|
||||
}
|
||||
});
|
||||
$( "#listen-mode-select" ).on('selectmenuchange',function() {
|
||||
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
||||
|
@ -92,31 +110,38 @@ $( function() {
|
|||
$( "#options-backend-show-div" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#controlgroup-listen-show" ).click( function(){
|
||||
$( "#controlgroup-listen-show" ).click( function(){
|
||||
if ($('#controlgroup-listen-show').is(':checked')) {
|
||||
$( "#controlgroup-listen" ).show( "fast" );
|
||||
if ($('#check-servers-listen').is(':checked')) {
|
||||
$( "#rise-listen" ).attr('required',true);
|
||||
$( "#fall-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).attr('required',true);
|
||||
}
|
||||
$( "#inter-listen" ).attr('disable',false);
|
||||
}
|
||||
} else {
|
||||
$( "#controlgroup-listen" ).hide( "fast" );
|
||||
$( "#controlgroup-listen" ).hide( "fast" );
|
||||
}
|
||||
$( "#check-servers-listen" ).click( function(){
|
||||
$( "#check-servers-listen" ).click( function(){
|
||||
if ($('#check-servers-listen').is(':checked')) {
|
||||
$( "#rise-listen" ).attr('required',true);
|
||||
$( "#fall-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).selectmenu( "option", "disabled", false );
|
||||
$( "#fall-listen" ).selectmenu( "option", "disabled", false );
|
||||
$( "#rise-listen" ).selectmenu( "option", "disabled", false );
|
||||
} else {
|
||||
$( "#rise-listen" ).attr('required',false);
|
||||
$( "#fall-listen" ).attr('required',false);
|
||||
$( "#inter-listen" ).attr('required',false);
|
||||
$( "#inter-listen" ).selectmenu( "option", "disabled", true );
|
||||
$( "#fall-listen" ).selectmenu( "option", "disabled", true );
|
||||
$( "#rise-listen" ).selectmenu( "option", "disabled", true );
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
$( "#controlgroup-backend-show" ).click( function(){
|
||||
$( "#controlgroup-backend-show" ).click( function(){
|
||||
if ($('#controlgroup-backend-show').is(':checked')) {
|
||||
$( "#controlgroup-backend" ).show( "fast" );
|
||||
if ($('#check-servers-backend').is(':checked')) {
|
||||
|
@ -133,10 +158,16 @@ $( function() {
|
|||
$( "#rise-backend" ).attr('required',true);
|
||||
$( "#fall-backend" ).attr('required',true);
|
||||
$( "#inter-backend" ).attr('required',true);
|
||||
$( "#inter-backend" ).selectmenu( "option", "disabled", false );
|
||||
$( "#fall-backend" ).selectmenu( "option", "disabled", false );
|
||||
$( "#rise-backend" ).selectmenu( "option", "disabled", false );
|
||||
} else {
|
||||
$( "#rise-backend" ).attr('required',false);
|
||||
$( "#fall-backend" ).attr('required',false);
|
||||
$( "#inter-backend" ).attr('required',false);
|
||||
$( "#inter-backend" ).selectmenu( "option", "disabled", true );
|
||||
$( "#fall-backend" ).selectmenu( "option", "disabled", true );
|
||||
$( "#rise-backend" ).selectmenu( "option", "disabled", true );
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ iframe {
|
|||
.menu li:hover li{
|
||||
display: block;
|
||||
}
|
||||
|
||||
@keyframes shadow {
|
||||
from {box-shadow: 0px 0px 0px red inset;}
|
||||
50% {text-shadow: 0 0 30px black;}
|
||||
|
@ -363,6 +364,7 @@ table {
|
|||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
}
|
||||
caption {
|
||||
color: #777;
|
||||
|
|
Loading…
Reference in New Issue