mirror of https://github.com/Aidaho12/haproxy-wi
parent
c1f3fe4a97
commit
d19ddc23eb
|
@ -147,7 +147,11 @@ function loadMetrics() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$( "#table_metrics" ).html( data );
|
if (data.indexOf('error') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$("#table_metrics").html(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -166,7 +170,6 @@ function getChartDataHapWiRam(ip) {
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push(result.chartData.rams);
|
data.push(result.chartData.rams);
|
||||||
|
|
||||||
renderChartHapWiRam(data);
|
renderChartHapWiRam(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -227,7 +230,6 @@ function getChartDataHapWiCpu(ip) {
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push(result.chartData.cpus);
|
data.push(result.chartData.cpus);
|
||||||
|
|
||||||
renderChartHapWiCpu(data);
|
renderChartHapWiCpu(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,8 +24,12 @@ function showHapserversCallBack(serv, hostnamea, service) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#"+hostnamea).empty();
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#"+hostnamea).html(data);
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$("#" + hostnamea).empty();
|
||||||
|
$("#" + hostnamea).html(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -43,8 +47,12 @@ function overviewHapserverBackends(serv, hostnamea, service) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#top-"+hostnamea).empty();
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#top-"+hostnamea).html(data);
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$("#top-" + hostnamea).empty();
|
||||||
|
$("#top-" + hostnamea).html(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -69,8 +77,12 @@ function showOverviewCallBack(serv, hostnamea) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#"+hostnamea).empty();
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#"+hostnamea).html(data);
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$("#" + hostnamea).empty();
|
||||||
|
$("#" + hostnamea).html(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -88,22 +100,26 @@ function showOverviewServer(name,ip,id, service) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax-server-"+id).empty();
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-server-"+id).css('display', 'block');
|
toastr.error(data);
|
||||||
$("#ajax-server-"+id).css('background-color', '#fbfbfb');
|
} else {
|
||||||
$("#ajax-server-"+id).css('border', '1px solid #A4C7F5');
|
$("#ajax-server-" + id).empty();
|
||||||
|
$("#ajax-server-" + id).css('display', 'block');
|
||||||
|
$("#ajax-server-" + id).css('background-color', '#fbfbfb');
|
||||||
|
$("#ajax-server-" + id).css('border', '1px solid #A4C7F5');
|
||||||
$(".ajax-server").css('display', 'block');
|
$(".ajax-server").css('display', 'block');
|
||||||
$(".div-server").css('clear', 'both');
|
$(".div-server").css('clear', 'both');
|
||||||
$(".div-pannel").css('clear', 'both');
|
$(".div-pannel").css('clear', 'both');
|
||||||
$(".div-pannel").css('display', 'block');
|
$(".div-pannel").css('display', 'block');
|
||||||
$(".div-pannel").css('padding-top', '10px');
|
$(".div-pannel").css('padding-top', '10px');
|
||||||
$(".div-pannel").css('height', '70px');
|
$(".div-pannel").css('height', '70px');
|
||||||
$("#div-pannel-"+id).insertBefore('#up-pannel')
|
$("#div-pannel-" + id).insertBefore('#up-pannel')
|
||||||
$("#ajax-server-"+id).html(data);
|
$("#ajax-server-" + id).html(data);
|
||||||
$.getScript("/inc/fontawesome.min.js")
|
$.getScript("/inc/fontawesome.min.js")
|
||||||
getChartDataHapWiRam()
|
getChartDataHapWiRam()
|
||||||
getChartDataHapWiCpu()
|
getChartDataHapWiCpu()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -119,7 +135,7 @@ function ajaxActionServers(action, id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if( data == 'Bad config, check please ' ) {
|
if( data == 'Bad config, check please ' ) {
|
||||||
alert(data);
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
if (cur_url[0] == "hapservers.py") {
|
if (cur_url[0] == "hapservers.py") {
|
||||||
location.reload()
|
location.reload()
|
||||||
|
@ -171,7 +187,7 @@ function ajaxActionWafServers(action, id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if( data == 'Bad config, check please ' ) {
|
if( data == 'Bad config, check please ' ) {
|
||||||
alert(data);
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(showOverviewWaf(ip, hostnamea), 2000)
|
setTimeout(showOverviewWaf(ip, hostnamea), 2000)
|
||||||
}
|
}
|
||||||
|
@ -290,11 +306,7 @@ function updateHapWIServer(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-servers").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
$('.alert-danger').remove();
|
||||||
$("#server-"+id).addClass( "update", 1000 );
|
$("#server-"+id).addClass( "update", 1000 );
|
||||||
|
@ -318,3 +330,26 @@ function change_pos(pos, id) {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
function showBytes(serv) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
showBytes: serv,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
beforeSend: function() {
|
||||||
|
$("#show_bin_bout").html('<img class="loading_small_bin_bout" src="/inc/images/loading.gif" />');
|
||||||
|
$("#sessions").html('<img class="loading_small_bin_bout" src="/inc/images/loading.gif" />');
|
||||||
|
},
|
||||||
|
success: function( data ) {
|
||||||
|
data = data.replace(/\s+/g,' ');
|
||||||
|
if (data.indexOf('error') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$("#bin_bout").html(data);
|
||||||
|
$.getScript("/inc/fontawesome.min.js")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajaxmaxconn").html('<div class="alert alert-danger" style="margin: 10px;">'+data+'</div>');
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
$("#ajaxmaxconn").html('<div class="alert alert-success" style="margin: 10px;">'+data+'</div>');
|
toastr.success(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -182,9 +182,9 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajaxip").html('<div class="alert alert-danger" style="margin: 10px;">'+data+'</div>');
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
$("#ajaxip").html('<div class="alert alert-success" style="margin: 10px;">'+data+'</div>');
|
toastr.success(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -202,7 +202,7 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,'');
|
data = data.replace(/\s+/g,'');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
alert(data)
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
var value = data.split(',')
|
var value = data.split(',')
|
||||||
$('#table_select').find('option').remove();
|
$('#table_select').find('option').remove();
|
||||||
|
@ -245,8 +245,7 @@ $( function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
function deleteTableEntry(id, table, ip) {
|
function deleteTableEntry(id, table, ip) {
|
||||||
console.log(table)
|
$(id).parent().parent().css("background-color", "#f2dede");
|
||||||
console.log(ip)
|
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -258,7 +257,7 @@ function deleteTableEntry(id, table, ip) {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
alert(data);
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
$(id).parent().parent().remove()
|
$(id).parent().parent().remove()
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
<script src="/inc/codemirror/codemirror.js"></script>
|
<script src="/inc/codemirror/codemirror.js"></script>
|
||||||
<script src="/inc/codemirror/nginx.js"></script>
|
<script src="/inc/codemirror/nginx.js"></script>
|
||||||
<script src="/inc/codemirror/haproxy.js"></script>
|
<script src="/inc/codemirror/haproxy.js"></script>
|
||||||
|
<link href="/inc/toastr.css" rel="stylesheet"/>
|
||||||
|
<script src="/inc/toastr.js"></script>
|
||||||
<meta http-equiv="refresh" content="0; url=/app/overview.py" />
|
<meta http-equiv="refresh" content="0; url=/app/overview.py" />
|
||||||
</head>
|
</head>
|
||||||
<body style="background-color: #239dee;">
|
<body style="background-color: #239dee;">
|
||||||
|
|
Loading…
Reference in New Issue