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>'
|
'<option value="tcp">tcp</option>'
|
||||||
'</select>'
|
'</select>'
|
||||||
'<span id="https-listen-span">'
|
'<span id="https-listen-span">'
|
||||||
'<label for="https-listen" style="margin-top: 5px;">ssl?</label>'
|
'<label for="https-listen" style="margin-top: 5px;" title="Enable ssl">ssl?</label>'
|
||||||
'<input type="checkbox" id="https-listen" name="ssl" value="https">'
|
'<input type="checkbox" id="https-listen" name="ssl" value="https" >'
|
||||||
'</span>'
|
'</span>'
|
||||||
'<div id="https-hide-listen" style="display: none;">'
|
'<div id="https-hide-listen" style="display: none;">'
|
||||||
'<br /><span class="tooltip tooltipTop">Enter path to pem file:</span><br />'
|
'<br /><span class="tooltip tooltipTop">Enter path to pem file:</span><br />'
|
||||||
|
@ -194,7 +194,7 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Optinons:</td>'
|
'<td class="addName">Optinons:</td>'
|
||||||
'<td class="addOption">'
|
'<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 id="options-listen-show-div" style="display: none;">'
|
||||||
'<div class="tooltip">'
|
'<div class="tooltip">'
|
||||||
'<span style="padding-right: 10px;" class="form-control">Start typing options: </span>'
|
'<span style="padding-right: 10px;" class="form-control">Start typing options: </span>'
|
||||||
|
@ -212,12 +212,13 @@ print('</select>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<textarea name="servers" required title="Backend servers" cols=80 placeholder="hostname ip:port"></textarea>'
|
'<textarea name="servers" required title="Backend servers" cols=80 placeholder="hostname ip:port"></textarea>'
|
||||||
'<div>'
|
'<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">'
|
'<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>'
|
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
||||||
'</div>'
|
'</div>'
|
||||||
'<div class="controlgroup" id="controlgroup-listen" style="display: none;">'
|
'<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">'
|
'<select name="inter" id="inter-listen">'
|
||||||
'<option value="inter" disabled selected>inter</option>'
|
'<option value="inter" disabled selected>inter</option>'
|
||||||
'<option value="1000">1000</option>'
|
'<option value="1000">1000</option>'
|
||||||
|
@ -283,7 +284,7 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Mode: </td>'
|
'<td class="addName">Mode: </td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<select required name="mode">'
|
'<select required name="mode" id="frontend-mode-select">'
|
||||||
'<option value="http" selected>http</option>'
|
'<option value="http" selected>http</option>'
|
||||||
'<option value="tcp">tcp</option>'
|
'<option value="tcp">tcp</option>'
|
||||||
'</select>'
|
'</select>'
|
||||||
|
@ -300,7 +301,7 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Optinons:</td>'
|
'<td class="addName">Optinons:</td>'
|
||||||
'<td class="addOption">'
|
'<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 id="options-frontend-show-div" style="display: none;">'
|
||||||
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
||||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
'<span style="padding-right: 10px;">Start typing options: </span>'
|
||||||
|
@ -359,7 +360,7 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Mode: </td>'
|
'<td class="addName">Mode: </td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<select required name="mode">'
|
'<select required name="mode" id="backend-mode-select">'
|
||||||
'<option value="http" selected>http</option>'
|
'<option value="http" selected>http</option>'
|
||||||
'<option value="tcp">tcp</option>'
|
'<option value="tcp">tcp</option>'
|
||||||
'</select>'
|
'</select>'
|
||||||
|
@ -389,7 +390,7 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Optinons:</td>'
|
'<td class="addName">Optinons:</td>'
|
||||||
'<td class="addOption">'
|
'<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 id="options-backend-show-div" style="display: none;">'
|
||||||
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
||||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
'<span style="padding-right: 10px;">Start typing options: </span>'
|
||||||
|
@ -407,12 +408,12 @@ print('</select>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<textarea name="servers" title="Backend servers" required cols=80 placeholder="hostname ip:port"></textarea>'
|
'<textarea name="servers" title="Backend servers" required cols=80 placeholder="hostname ip:port"></textarea>'
|
||||||
'<div>'
|
'<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">'
|
'<input type="checkbox" id="controlgroup-backend-show" name="default-check">'
|
||||||
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
||||||
'</div>'
|
'</div>'
|
||||||
'<div class="controlgroup" id="controlgroup-backend" style="display: none;">'
|
'<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">'
|
'<input type="checkbox" id="check-servers-backend" name="check-servers" checked value="1">'
|
||||||
'<select name="inter" id="inter-backend">'
|
'<select name="inter" id="inter-backend">'
|
||||||
'<option value="inter" disabled selected>inter</option>'
|
'<option value="inter" disabled selected>inter</option>'
|
||||||
|
|
|
@ -3,6 +3,7 @@ import html
|
||||||
import cgi
|
import cgi
|
||||||
import funct
|
import funct
|
||||||
import configparser
|
import configparser
|
||||||
|
import json
|
||||||
import listserv as listhap
|
import listserv as listhap
|
||||||
|
|
||||||
funct.head("Overview")
|
funct.head("Overview")
|
||||||
|
@ -12,11 +13,40 @@ funct.check_login()
|
||||||
path_config = "haproxy-webintarface.config"
|
path_config = "haproxy-webintarface.config"
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(path_config)
|
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">')
|
print('<h2>Quick Status </h2><table class="overview">')
|
||||||
|
|
||||||
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
|
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">'
|
print('<tr class="overviewHead">'
|
||||||
'<td class="padding10">Server</td>'
|
'<td class="padding10">Server</td>'
|
||||||
'<td class="padding10">'
|
'<td class="padding10">'
|
||||||
|
@ -49,5 +79,9 @@ for i in sorted(listhap.listhap):
|
||||||
funct.ssh_command(listhap.listhap.get(i), commands)
|
funct.ssh_command(listhap.listhap.get(i), commands)
|
||||||
print('</pre></td></tr>')
|
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()
|
funct.footer()
|
35
script.js
35
script.js
|
@ -4,7 +4,14 @@ $( function() {
|
||||||
$( "#tabs" ).tabs( "option", "active", 2 );
|
$( "#tabs" ).tabs( "option", "active", 2 );
|
||||||
} );
|
} );
|
||||||
$( "select" ).selectmenu();
|
$( "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=submit], button" ).button();
|
||||||
$( "input[type=checkbox]" ).checkboxradio();
|
$( "input[type=checkbox]" ).checkboxradio();
|
||||||
$( ".controlgroup" ).controlgroup();
|
$( ".controlgroup" ).controlgroup();
|
||||||
|
@ -13,11 +20,22 @@ $( function() {
|
||||||
heightStyle: "content",
|
heightStyle: "content",
|
||||||
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
|
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
|
||||||
});
|
});
|
||||||
$( "dropdown_selector" ).change(function() {
|
/*$( "dropdown_selector" ).change(function() {
|
||||||
var $option = $(this).find('option:selected');
|
var $option = $(this).find('option:selected');
|
||||||
if ($option == "tcp") {
|
if ($option == "tcp") {
|
||||||
$("#https-listen").hide();
|
$("#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() {
|
$( "#listen-mode-select" ).on('selectmenuchange',function() {
|
||||||
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
||||||
|
@ -99,6 +117,7 @@ $( function() {
|
||||||
$( "#rise-listen" ).attr('required',true);
|
$( "#rise-listen" ).attr('required',true);
|
||||||
$( "#fall-listen" ).attr('required',true);
|
$( "#fall-listen" ).attr('required',true);
|
||||||
$( "#inter-listen" ).attr('required',true);
|
$( "#inter-listen" ).attr('required',true);
|
||||||
|
$( "#inter-listen" ).attr('disable',false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$( "#controlgroup-listen" ).hide( "fast" );
|
$( "#controlgroup-listen" ).hide( "fast" );
|
||||||
|
@ -108,10 +127,16 @@ $( function() {
|
||||||
$( "#rise-listen" ).attr('required',true);
|
$( "#rise-listen" ).attr('required',true);
|
||||||
$( "#fall-listen" ).attr('required',true);
|
$( "#fall-listen" ).attr('required',true);
|
||||||
$( "#inter-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 {
|
} else {
|
||||||
$( "#rise-listen" ).attr('required',false);
|
$( "#rise-listen" ).attr('required',false);
|
||||||
$( "#fall-listen" ).attr('required',false);
|
$( "#fall-listen" ).attr('required',false);
|
||||||
$( "#inter-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 );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -133,10 +158,16 @@ $( function() {
|
||||||
$( "#rise-backend" ).attr('required',true);
|
$( "#rise-backend" ).attr('required',true);
|
||||||
$( "#fall-backend" ).attr('required',true);
|
$( "#fall-backend" ).attr('required',true);
|
||||||
$( "#inter-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 {
|
} else {
|
||||||
$( "#rise-backend" ).attr('required',false);
|
$( "#rise-backend" ).attr('required',false);
|
||||||
$( "#fall-backend" ).attr('required',false);
|
$( "#fall-backend" ).attr('required',false);
|
||||||
$( "#inter-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{
|
.menu li:hover li{
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes shadow {
|
@keyframes shadow {
|
||||||
from {box-shadow: 0px 0px 0px red inset;}
|
from {box-shadow: 0px 0px 0px red inset;}
|
||||||
50% {text-shadow: 0 0 30px black;}
|
50% {text-shadow: 0 0 30px black;}
|
||||||
|
@ -363,6 +364,7 @@ table {
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
caption {
|
caption {
|
||||||
color: #777;
|
color: #777;
|
||||||
|
|
Loading…
Reference in New Issue