mirror of https://github.com/Aidaho12/haproxy-wi
parent
71adfb42c7
commit
724625523c
|
@ -102,7 +102,43 @@ def mode_admin(button, **kwargs):
|
||||||
print('<button type="submit" class="btn btn-default">%s</button>' % button)
|
print('<button type="submit" class="btn btn-default">%s</button>' % button)
|
||||||
elif role.value == "admin" or role.value == "editor" and level == "editor":
|
elif role.value == "admin" or role.value == "editor" and level == "editor":
|
||||||
print('<button type="submit" class="btn btn-default">%s</button>' % button)
|
print('<button type="submit" class="btn btn-default">%s</button>' % button)
|
||||||
|
|
||||||
|
def head(title):
|
||||||
|
print('Content-type: text/html\n')
|
||||||
|
print('<html><head><title>%s</title>' % title)
|
||||||
|
print('<link href="/favicon.ico" rel="icon" type="image/png" />'
|
||||||
|
'<meta charset="UTF-8">'
|
||||||
|
'<link href="/inc/style.css" rel="stylesheet">'
|
||||||
|
'<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">'
|
||||||
|
'<script src="https://code.jquery.com/jquery-1.12.4.js"></script>'
|
||||||
|
'<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>'
|
||||||
|
'<script src="/inc/js-cookie.js"></script>'
|
||||||
|
'<script src="/inc/script.js"></script>'
|
||||||
|
'</head>'
|
||||||
|
'<body>'
|
||||||
|
'<a name="top"></a>'
|
||||||
|
'<div class="show_menu" style="display: none;">'
|
||||||
|
'<a href="#" id="show_menu" title="Show menu" style="margin-top: 30px;position: absolute;">'
|
||||||
|
'<span class="ui-state-default ui-corner-all">'
|
||||||
|
'<span class="ui-icon ui-icon-arrowthick-1-e" id="arrow"></span>'
|
||||||
|
'</span>'
|
||||||
|
'</a>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="top-menu">'
|
||||||
|
'<div class="LogoText">'
|
||||||
|
'<span style="padding: 10px;">HAproxy-WI</span>'
|
||||||
|
'<a href="#" id="hide_menu" title="Hide menu" style="margin-left: 7px;margin-top: -6px;position: absolute;">'
|
||||||
|
'<span class="ui-state-default ui-corner-all">'
|
||||||
|
'<span class="ui-icon ui-icon-arrowthick-1-w" id="arrow"></span>'
|
||||||
|
'</span>'
|
||||||
|
'</a>'
|
||||||
|
'</div>')
|
||||||
|
if config.get('main', 'logo_enable') == "1":
|
||||||
|
print('<div><img src="%s" title="Logo" class="logo"></div>' % config.get('main', 'logo_path'))
|
||||||
|
print('<div class="top-link">')
|
||||||
|
links()
|
||||||
|
print('</div></div><div class="container">')
|
||||||
|
|
||||||
def links():
|
def links():
|
||||||
print('<nav class="menu">'
|
print('<nav class="menu">'
|
||||||
'<ul>'
|
'<ul>'
|
||||||
|
@ -138,42 +174,6 @@ def links():
|
||||||
print('</ul>'
|
print('</ul>'
|
||||||
'</nav>')
|
'</nav>')
|
||||||
|
|
||||||
|
|
||||||
def head(title):
|
|
||||||
print('Content-type: text/html\n')
|
|
||||||
print('<html><head><title>%s</title>' % title)
|
|
||||||
print('<link href="/favicon.ico" rel="icon" type="image/png" />'
|
|
||||||
'<meta charset="UTF-8">'
|
|
||||||
'<link href="/style.css" rel="stylesheet">'
|
|
||||||
'<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">'
|
|
||||||
'<script src="https://code.jquery.com/jquery-1.12.4.js"></script>'
|
|
||||||
'<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>'
|
|
||||||
'<script src="/script.js"></script>'
|
|
||||||
'</head>'
|
|
||||||
'<body>'
|
|
||||||
'<a name="top"></a>'
|
|
||||||
'<div class="show_menu" style="display: none;">'
|
|
||||||
'<a href="#" id="show_menu" title="Show menu" style="margin-top: 30px;position: absolute;">'
|
|
||||||
'<span class="ui-state-default ui-corner-all">'
|
|
||||||
'<span class="ui-icon ui-icon-arrowthick-1-e" id="arrow"></span>'
|
|
||||||
'</span>'
|
|
||||||
'</a>'
|
|
||||||
'</div>'
|
|
||||||
'<div class="top-menu">'
|
|
||||||
'<div class="LogoText">'
|
|
||||||
'<span style="padding-left: 20px;">HAproxy-WI</span>'
|
|
||||||
'<a href="#" id="hide_menu" title="Hide menu" style="margin-left: 107px;margin-top: -6px;position: absolute;">'
|
|
||||||
'<span class="ui-state-default ui-corner-all">'
|
|
||||||
'<span class="ui-icon ui-icon-arrowthick-1-w" id="arrow"></span>'
|
|
||||||
'</span>'
|
|
||||||
'</a>'
|
|
||||||
'</div>')
|
|
||||||
if config.get('main', 'logo_enable') == "1":
|
|
||||||
print('<div><img src="%s" title="Logo" class="logo"></div>' % config.get('main', 'logo_path'))
|
|
||||||
print('<div class="top-link">')
|
|
||||||
links()
|
|
||||||
print('</div></div><div class="container">')
|
|
||||||
|
|
||||||
def footer():
|
def footer():
|
||||||
print('</center></div>'
|
print('</center></div>'
|
||||||
'<center style="margin-left: 12%;">'
|
'<center style="margin-left: 12%;">'
|
||||||
|
@ -185,7 +185,7 @@ def footer():
|
||||||
'<div class="footer-link">'
|
'<div class="footer-link">'
|
||||||
'<span class="LogoText">HAproxy-WI</span>'
|
'<span class="LogoText">HAproxy-WI</span>'
|
||||||
'</div>'
|
'</div>'
|
||||||
'</div></body></html>-->')
|
'</div>--></body></html>')
|
||||||
|
|
||||||
def ssh_connect(serv):
|
def ssh_connect(serv):
|
||||||
ssh = SSHClient()
|
ssh = SSHClient()
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
/*!
|
||||||
|
* JavaScript Cookie v2.2.0
|
||||||
|
* https://github.com/js-cookie/js-cookie
|
||||||
|
*
|
||||||
|
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||||||
|
* Released under the MIT license
|
||||||
|
*/
|
||||||
|
;(function (factory) {
|
||||||
|
var registeredInModuleLoader = false;
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(factory);
|
||||||
|
registeredInModuleLoader = true;
|
||||||
|
}
|
||||||
|
if (typeof exports === 'object') {
|
||||||
|
module.exports = factory();
|
||||||
|
registeredInModuleLoader = true;
|
||||||
|
}
|
||||||
|
if (!registeredInModuleLoader) {
|
||||||
|
var OldCookies = window.Cookies;
|
||||||
|
var api = window.Cookies = factory();
|
||||||
|
api.noConflict = function () {
|
||||||
|
window.Cookies = OldCookies;
|
||||||
|
return api;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}(function () {
|
||||||
|
function extend () {
|
||||||
|
var i = 0;
|
||||||
|
var result = {};
|
||||||
|
for (; i < arguments.length; i++) {
|
||||||
|
var attributes = arguments[ i ];
|
||||||
|
for (var key in attributes) {
|
||||||
|
result[key] = attributes[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function init (converter) {
|
||||||
|
function api (key, value, attributes) {
|
||||||
|
var result;
|
||||||
|
if (typeof document === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
attributes = extend({
|
||||||
|
path: '/'
|
||||||
|
}, api.defaults, attributes);
|
||||||
|
|
||||||
|
if (typeof attributes.expires === 'number') {
|
||||||
|
var expires = new Date();
|
||||||
|
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
||||||
|
attributes.expires = expires;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We're using "expires" because "max-age" is not supported by IE
|
||||||
|
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = JSON.stringify(value);
|
||||||
|
if (/^[\{\[]/.test(result)) {
|
||||||
|
value = result;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (!converter.write) {
|
||||||
|
value = encodeURIComponent(String(value))
|
||||||
|
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||||
|
} else {
|
||||||
|
value = converter.write(value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
key = encodeURIComponent(String(key));
|
||||||
|
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
||||||
|
key = key.replace(/[\(\)]/g, escape);
|
||||||
|
|
||||||
|
var stringifiedAttributes = '';
|
||||||
|
|
||||||
|
for (var attributeName in attributes) {
|
||||||
|
if (!attributes[attributeName]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stringifiedAttributes += '; ' + attributeName;
|
||||||
|
if (attributes[attributeName] === true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stringifiedAttributes += '=' + attributes[attributeName];
|
||||||
|
}
|
||||||
|
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read
|
||||||
|
|
||||||
|
if (!key) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// To prevent the for loop in the first place assign an empty array
|
||||||
|
// in case there are no cookies at all. Also prevents odd result when
|
||||||
|
// calling "get()"
|
||||||
|
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||||
|
var rdecode = /(%[0-9A-Z]{2})+/g;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (; i < cookies.length; i++) {
|
||||||
|
var parts = cookies[i].split('=');
|
||||||
|
var cookie = parts.slice(1).join('=');
|
||||||
|
|
||||||
|
if (!this.json && cookie.charAt(0) === '"') {
|
||||||
|
cookie = cookie.slice(1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var name = parts[0].replace(rdecode, decodeURIComponent);
|
||||||
|
cookie = converter.read ?
|
||||||
|
converter.read(cookie, name) : converter(cookie, name) ||
|
||||||
|
cookie.replace(rdecode, decodeURIComponent);
|
||||||
|
|
||||||
|
if (this.json) {
|
||||||
|
try {
|
||||||
|
cookie = JSON.parse(cookie);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === name) {
|
||||||
|
result = cookie;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!key) {
|
||||||
|
result[name] = cookie;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
api.set = api;
|
||||||
|
api.get = function (key) {
|
||||||
|
return api.call(api, key);
|
||||||
|
};
|
||||||
|
api.getJSON = function () {
|
||||||
|
return api.apply({
|
||||||
|
json: true
|
||||||
|
}, [].slice.call(arguments));
|
||||||
|
};
|
||||||
|
api.defaults = {};
|
||||||
|
|
||||||
|
api.remove = function (key, attributes) {
|
||||||
|
api(key, '', extend(attributes, {
|
||||||
|
expires: -1
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
api.withConverter = init;
|
||||||
|
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
|
return init(function () {});
|
||||||
|
}));
|
||||||
|
|
|
@ -176,20 +176,33 @@ $( function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$( "#hide_menu" ).click(function() {
|
$( "#hide_menu" ).click(function() {
|
||||||
if ($(".top_menu").css("display", "block")) {
|
$(".top-menu").hide( "drop", "fast" );
|
||||||
$(".top-menu").hide( "drop", "slow" );
|
$(".container").css("max-width", "98%");
|
||||||
$(".container").css("max-width", "98%");
|
$(".container").css("margin-left", "1%");
|
||||||
$(".container").css("margin-left", "1%");
|
$(".show_menu").show();
|
||||||
$(".show_menu").show();
|
Cookies.set('hide_menu', 'hide', { expires: 365 });
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$( "#show_menu" ).click(function() {
|
$( "#show_menu" ).click(function() {
|
||||||
$(".top-menu").show( "drop", "slow" );
|
$(".top-menu").show( "drop", "fast" );
|
||||||
$(".container").css("max-width", "88%");
|
$(".container").css("max-width", "91%");
|
||||||
$(".container").css("margin-left", "307px");
|
$(".container").css("margin-left", "207px");
|
||||||
$(".show_menu").hide();
|
$(".show_menu").hide();
|
||||||
|
Cookies.set('hide_menu', 'show', { expires: 365 });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var hideMenu = Cookies.get('hide_menu');
|
||||||
|
if (hideMenu == "show") {
|
||||||
|
$(".top-menu").show( "drop", "fast" );
|
||||||
|
$(".container").css("max-width", "91%");
|
||||||
|
$(".container").css("margin-left", "207px");
|
||||||
|
}
|
||||||
|
if (hideMenu == "hide") {
|
||||||
|
$(".top-menu").hide();
|
||||||
|
$(".container").css("max-width", "98%");
|
||||||
|
$(".container").css("margin-left", "1%");
|
||||||
|
$(".show_menu").show();
|
||||||
|
}
|
||||||
|
|
||||||
var availableTags = [
|
var availableTags = [
|
||||||
"acl", "http-request", "http-response", "set-uri", "set-url", "set-header", "add-header", "del-header", "replace-header", "path_beg", "url_beg()", "urlp_sub()", "tcpka", "tcplog", "forwardfor", "option"
|
"acl", "http-request", "http-response", "set-uri", "set-url", "set-header", "add-header", "del-header", "replace-header", "path_beg", "url_beg()", "urlp_sub()", "tcpka", "tcplog", "forwardfor", "option"
|
||||||
];
|
];
|
|
@ -37,7 +37,7 @@ iframe {
|
||||||
.top-menu {
|
.top-menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 307px;
|
width: 207px;
|
||||||
float: left;
|
float: left;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -79,14 +79,15 @@ iframe {
|
||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
min-height: calc(100vh - 115px);
|
min-height: calc(100vh - 115px);
|
||||||
max-width: 88%;
|
max-width: 91%;
|
||||||
min-width: 40%;
|
min-width: 40%;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-left: 307px;
|
margin-left: 207px;
|
||||||
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
.configShow, .diff {
|
.configShow, .diff {
|
||||||
margin-left: 16%;
|
margin-left: 16%;
|
||||||
height: 70%;
|
height: 78%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
border: 1px solid #DCDCDC;
|
border: 1px solid #DCDCDC;
|
||||||
|
@ -255,7 +256,6 @@ iframe {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
.menu {
|
.menu {
|
||||||
margin-left: 13%;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
<title>HAProxy web manager</title>
|
<title>HAProxy web manager</title>
|
||||||
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
|
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
|
||||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
||||||
<link href="style.css" rel="stylesheet">
|
<link href="/inc/style.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<center>
|
<center>
|
||||||
|
|
Loading…
Reference in New Issue