Pavel Loginov 2020-07-30 19:28:58 +02:00
parent a0aaab0efe
commit 69b33495d7
9 changed files with 109 additions and 125 deletions

View File

@ -129,9 +129,6 @@
{% endif %} {% endif %}
</ul> </ul>
</nav> </nav>
<div class="donate-menu">
<a href="https://haproxy-wi.org/donate.py" title="Donate" target="_blank" style="color: #fff; margin-left: -10px; color: red;" class="patreon"> Donate</a>
</div>
</div> </div>
</div> </div>
<div id="cover"></div> <div id="cover"></div>

View File

@ -2,10 +2,6 @@ var ssl_offloading_var = "http-request set-header X-Forwarded-Port %[dst_port] \
"http-request add-header X-Forwarded-Proto https if { ssl_fc } \n"+ "http-request add-header X-Forwarded-Proto https if { ssl_fc } \n"+
"redirect scheme https if !{ ssl_fc } \n" "redirect scheme https if !{ ssl_fc } \n"
$( function() { $( function() {
$('#close').click(function(){
$('.alert-success').remove();
$('.alert-danger').remove();
});
$( "#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") {
$( "#https-listen-span" ).hide("fast"); $( "#https-listen-span" ).hide("fast");
@ -419,8 +415,6 @@ $( function() {
} }
}); });
$('#add-option-new').click(function() { $('#add-option-new').click(function() {
$('#error').remove();
$('.alert-danger').remove();
$.ajax( { $.ajax( {
url: "sql.py", url: "sql.py",
@ -431,12 +425,8 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajax-option").append(data); toastr.error(data);
$('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$("#option_table").append(data); $("#option_table").append(data);
setTimeout(function() { setTimeout(function() {
@ -472,8 +462,6 @@ $( function() {
} }
}); });
$('#add-saved-server-new').click(function() { $('#add-saved-server-new').click(function() {
$('#error').remove();
$('.alert-danger').remove();
$.ajax( { $.ajax( {
url: "sql.py", url: "sql.py",
@ -485,12 +473,8 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajax-option").append(data); toastr.error(data);
$('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$("#servers_table").append(data); $("#servers_table").append(data);
setTimeout(function() { setTimeout(function() {
@ -579,7 +563,7 @@ $( function() {
if($('#name').val() == "") { if($('#name').val() == "") {
$("#optionsInput").append(ddos_var) $("#optionsInput").append(ddos_var)
} }
var ddos_var = "#Start config for DDOS atack protecte\n"+ var ddos_var = "#Start config for DDOS atack protect\n"+
"stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s)\n"+ "stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s)\n"+
"tcp-request connection track-sc1 src\n"+ "tcp-request connection track-sc1 src\n"+
"tcp-request connection reject if { sc1_get_gpc0 gt 0 }\n"+ "tcp-request connection reject if { sc1_get_gpc0 gt 0 }\n"+
@ -602,7 +586,7 @@ $( function() {
if($('#new_frontend').val() == "") { if($('#new_frontend').val() == "") {
$("#optionsInput1").append(ddos_var) $("#optionsInput1").append(ddos_var)
} }
var ddos_var = "#Start config for DDOS atack protecte\n"+ var ddos_var = "#Start config for DDOS atack protect\n"+
"stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s)\n"+ "stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s)\n"+
"tcp-request connection track-sc1 src\n"+ "tcp-request connection track-sc1 src\n"+
"tcp-request connection reject if { sc1_get_gpc0 gt 0 }\n"+ "tcp-request connection reject if { sc1_get_gpc0 gt 0 }\n"+
@ -752,7 +736,6 @@ $( function() {
minLength: -1 minLength: -1
}); });
$( "#ssl_key_upload" ).click(function() { $( "#ssl_key_upload" ).click(function() {
$('.alert-danger').remove();
$.ajax( { $.ajax( {
url: "options.py", url: "options.py",
data: { data: {
@ -764,13 +747,12 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('danger') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajax-ssl").html(data); toastr.error(data);
} else if (data.indexOf('success') != '-1') { } else if (data.indexOf('success') != '-1') {
$('.alert-danger').remove(); toastr.success(data);
$( "#ajax-ssl").html(data);
} else { } else {
$("#ajax-ssl").html('<div class="alert alert-danger">Something wrong, check and try again</div>'); toastr.error('Something wrong, check and try again');
} }
} }
} ); } );
@ -785,10 +767,9 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('danger') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajax-show-ssl").html(data); toastr.error(data);
} else { } else {
$('.alert-danger').remove();
var i; var i;
var new_data = ""; var new_data = "";
data = data.split("\n"); data = data.split("\n");
@ -982,7 +963,7 @@ function removeOption(id) {
} ); } );
} }
function updateOptions(id) { function updateOptions(id) {
$('#error').remove(); toastr.clear();
$.ajax( { $.ajax( {
url: "sql.py", url: "sql.py",
data: { data: {
@ -993,14 +974,9 @@ function updateOptions(id) {
type: "POST", type: "POST",
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-ssh").append(data); toastr.error(data);
$('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove();
$("#option-"+id).addClass( "update", 1000 ); $("#option-"+id).addClass( "update", 1000 );
setTimeout(function() { setTimeout(function() {
$( "#option-"+id ).removeClass( "update" ); $( "#option-"+id ).removeClass( "update" );
@ -1045,7 +1021,7 @@ function removeSavedServer(id) {
} ); } );
} }
function updateSavedServer(id) { function updateSavedServer(id) {
$('#error').remove(); toastr.clear();
$.ajax( { $.ajax( {
url: "sql.py", url: "sql.py",
data: { data: {
@ -1057,14 +1033,9 @@ function updateSavedServer(id) {
type: "POST", type: "POST",
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-ssh").append(data); toastr.error(data);
$('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove();
$("#option-"+id).addClass( "update", 1000 ); $("#option-"+id).addClass( "update", 1000 );
setTimeout(function() { setTimeout(function() {
$( "#option-"+id ).removeClass( "update" ); $( "#option-"+id ).removeClass( "update" );
@ -1083,10 +1054,9 @@ function view_ssl(id) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('danger') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajax-show-ssl").html(data); toastr.error(data);
} else { } else {
$('.alert-danger').remove();
$('#dialog-confirm-body').text(data); $('#dialog-confirm-body').text(data);
$( "#dialog-confirm-cert" ).dialog({ $( "#dialog-confirm-cert" ).dialog({
resizable: false, resizable: false,
@ -1156,11 +1126,20 @@ function createList(color) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
$("#ajax").html(data); if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data);
} else if (data.indexOf('Info') != '-1' ){
toastr.clear();
toastr.info(data);
} else if (data.indexOf('success') != '-1' ) {
toastr.clear();
toastr.success('WAF service has installed');
showOverviewWaf(ip, hostnamea)
setTimeout(function () { setTimeout(function () {
location.reload(); location.reload();
}, 2500); }, 2500);
} }
}
} ); } );
} }
function editList(list, color) { function editList(list, color) {
@ -1174,10 +1153,9 @@ function editList(list, color) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('danger') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajax").html(data); toastr.error(data);
} else { } else {
$('.alert-danger').remove();
$('#edit_lists').text(data); $('#edit_lists').text(data);
$( "#dialog-confirm-cert-edit" ).dialog({ $( "#dialog-confirm-cert-edit" ).dialog({
resizable: false, resizable: false,
@ -1221,7 +1199,17 @@ function saveList(action, list, color) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
$("#ajax").html(data); data = data.split(" , ");
for (i = 0; i < data.length; i++) {
if (data[i]) {
if (data[i].indexOf('error:') != '-1') {
toastr.error(data[i]);
} else {
toastr.success(data[i]);
}
}
}
} }
} ); } );
} }

View File

@ -147,7 +147,7 @@ function loadMetrics() {
}, },
type: "POST", type: "POST",
success: function (data) { success: function (data) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#table_metrics").html(data); $("#table_metrics").html(data);

View File

@ -24,7 +24,7 @@ function showHapserversCallBack(serv, hostnamea, service) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#" + hostnamea).empty(); $("#" + hostnamea).empty();
@ -47,7 +47,7 @@ function overviewHapserverBackends(serv, hostnamea, service) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#top-" + hostnamea).empty(); $("#top-" + hostnamea).empty();
@ -77,7 +77,7 @@ function showOverviewCallBack(serv, hostnamea) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#" + hostnamea).empty(); $("#" + hostnamea).empty();
@ -100,7 +100,7 @@ function showOverviewServer(name,ip,id, service) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#ajax-server-" + id).empty(); $("#ajax-server-" + id).empty();
@ -305,7 +305,7 @@ function updateHapWIServer(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -344,7 +344,7 @@ function showBytes(serv) {
}, },
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') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#bin_bout").html(data); $("#bin_bout").html(data);

View File

@ -34,7 +34,7 @@ $( function() {
type: "POST", type: "POST",
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) alert(data)
} else { } else {
var value = data.split('<br>') var value = data.split('<br>')
@ -66,7 +66,7 @@ $( function() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.success(data); toastr.success(data);
@ -86,7 +86,7 @@ $( function() {
type: "POST", type: "POST",
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) alert(data)
} else { } else {
var value = data.split('<br>') var value = data.split('<br>')
@ -119,7 +119,7 @@ $( function() {
type: "POST", type: "POST",
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) alert(data)
} else { } else {
var value = data.split('<br>') var value = data.split('<br>')
@ -154,7 +154,7 @@ $( function() {
type: "POST", type: "POST",
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) alert(data)
} else { } else {
var server = data.split(':')[0] var server = data.split(':')[0]
@ -181,7 +181,7 @@ $( function() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.success(data); toastr.success(data);
@ -201,7 +201,7 @@ $( function() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
var value = data.split(',') var value = data.split(',')
@ -231,7 +231,7 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
$("#ajaxtable").html(data); $("#ajaxtable").html(data);
} else { } else {
$("#ajaxtable").html(data); $("#ajaxtable").html(data);
@ -256,7 +256,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') {
toastr.error(data); toastr.error(data);
} else { } else {
$(id).parent().parent().remove() $(id).parent().parent().remove()

View File

@ -283,7 +283,7 @@ function showStats() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -349,7 +349,7 @@ function showLog() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -382,7 +382,7 @@ function showMap() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -404,7 +404,7 @@ function showCompare() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -428,7 +428,7 @@ function showCompareConfigs() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -456,7 +456,7 @@ function showConfig() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -482,7 +482,7 @@ function showUploadConfig() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1049,7 +1049,7 @@ function showSmon(action) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('SMON error') != '-1') { if (data.indexOf('SMON error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#smon_dashboard").html(data); $("#smon_dashboard").html(data);

View File

@ -77,7 +77,7 @@ pre {
margin-bottom: 0px; margin-bottom: 0px;
} }
.top-menu { .top-menu {
position: absolute; position: fixed;
min-height: calc(99vh - 50px); min-height: calc(99vh - 50px);
height: 120%; height: 120%;
width: 207px; width: 207px;
@ -289,7 +289,7 @@ pre {
.paramInSec { .paramInSec {
font-weight: bold; font-weight: bold;
} }
.donate-menu { /*.donate-menu {
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
font-size: 15px; font-size: 15px;
@ -298,7 +298,7 @@ pre {
position: fixed; position: fixed;
margin-left: 65px; margin-left: 65px;
margin-top: 15px; margin-top: 15px;
} }*/
.line { .line {
background-color: #f3f8fb; background-color: #f3f8fb;
border: 1px solid #ddd; border: 1px solid #ddd;

View File

@ -25,7 +25,7 @@ $( function() {
}, },
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
response(data.split(" ")); response(data.split(" "));
@ -47,7 +47,7 @@ $( function() {
}, },
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
response(data.split(" ")); response(data.split(" "));
@ -98,7 +98,7 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('alert') != '-1' || data.indexOf('FAILED') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('alert') != '-1' || data.indexOf('FAILED') != '-1') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('info') != '-1' ){ } else if (data.indexOf('info') != '-1' ){
toastr.clear(); toastr.clear();
@ -142,7 +142,7 @@ $( function() {
type: "POST", type: "POST",
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') {
toastr.clear(); toastr.clear();
toastr.error(data); toastr.error(data);
} else if (data.indexOf('success') != '-1'){ } else if (data.indexOf('success') != '-1'){
@ -174,7 +174,7 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('success') != '-1' ){ } else if (data.indexOf('success') != '-1' ){
toastr.remove(); toastr.remove();
@ -206,7 +206,7 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
toastr.clear(); toastr.clear();
toastr.error(data); toastr.error(data);
} else if (data.indexOf('success') != '-1' ){ } else if (data.indexOf('success') != '-1' ){
@ -262,7 +262,7 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
toastr.clear(); toastr.clear();
toastr.error(data); toastr.error(data);
} else if (data.indexOf('success') != '-1' ){ } else if (data.indexOf('success') != '-1' ){
@ -292,7 +292,7 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('success') != '-1' ){ } else if (data.indexOf('success') != '-1' ){
toastr.clear(); toastr.clear();
@ -414,7 +414,7 @@ $( function() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('Complete!') != '-1'){ } else if (data.indexOf('Complete!') != '-1'){
toastr.clear(); toastr.clear();
@ -465,7 +465,7 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -498,7 +498,7 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -533,7 +533,7 @@ $( function() {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#checker_table").append(data); $("#checker_table").append(data);
@ -754,7 +754,7 @@ $( function() {
}); });
$('#search_ldap_user').click(function() { $('#search_ldap_user').click(function() {
var valid = true; var valid = true;
$('#error').remove(); toastr.clear();
allFields = $( [] ).add( $('#new-username') ) allFields = $( [] ).add( $('#new-username') )
allFields.removeClass( "ui-state-error" ); allFields.removeClass( "ui-state-error" );
valid = valid && checkLength( $('#new-username'), "user name", 1 ); valid = valid && checkLength( $('#new-username'), "user name", 1 );
@ -769,7 +769,7 @@ $( function() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
$('#new-email').val(''); $('#new-email').val('');
$('#new-password').attr('readonly', false); $('#new-password').attr('readonly', false);
@ -811,7 +811,6 @@ function checkLength( o, n, min ) {
} }
function addNewSmonServer() { function addNewSmonServer() {
var valid = true; var valid = true;
$('#error').remove();
allFields = $( [] ).add( $('#new-smon-ip') ).add( $('#new-smon-port') ) allFields = $( [] ).add( $('#new-smon-ip') ).add( $('#new-smon-port') )
allFields.removeClass( "ui-state-error" ); allFields.removeClass( "ui-state-error" );
valid = valid && checkLength( $('#new-smon-ip'), "IP", 1 ); valid = valid && checkLength( $('#new-smon-ip'), "IP", 1 );
@ -857,7 +856,7 @@ function addNewSmonServer() {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('unique') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -880,7 +879,7 @@ function addNewSmonServer() {
} }
function addUser() { function addUser() {
var valid = true; var valid = true;
$('#error').remove(); toastr.clear();
allFields = $( [] ).add( $('#new-username') ).add( $('#new-password') ) allFields = $( [] ).add( $('#new-username') ).add( $('#new-password') )
allFields.removeClass( "ui-state-error" ); allFields.removeClass( "ui-state-error" );
valid = valid && checkLength( $('#new-username'), "user name", 1 ); valid = valid && checkLength( $('#new-username'), "user name", 1 );
@ -906,10 +905,10 @@ function addUser() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.remove(); toastr.clear();
$("#ajax-users").append(data); $("#ajax-users").append(data);
var getId = new RegExp('[0-9]+'); var getId = new RegExp('[0-9]+');
var id = data.match(getId); var id = data.match(getId);
@ -971,7 +970,7 @@ function addServer() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear() toastr.clear()
@ -994,7 +993,7 @@ function addServer() {
} }
function addBackup() { function addBackup() {
var valid = true; var valid = true;
$('#error').remove(); toastr.clear();
allFields = $( [] ).add( $('#backup-server') ).add( $('#rserver') ).add( $('#rpath') ).add( $('#backup-time') ).add( $('#backup-credentials') ) allFields = $( [] ).add( $('#backup-server') ).add( $('#rserver') ).add( $('#rpath') ).add( $('#backup-time') ).add( $('#backup-credentials') )
allFields.removeClass( "ui-state-error" ); allFields.removeClass( "ui-state-error" );
valid = valid && checkLength( $('#backup-server'), "backup server ", 1 ); valid = valid && checkLength( $('#backup-server'), "backup server ", 1 );
@ -1019,7 +1018,7 @@ function addBackup() {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('success') != '-1') { } else if (data.indexOf('success') != '-1') {
toastr.remove(); toastr.remove();
@ -1052,7 +1051,7 @@ function updateSettings(param, val) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1427,7 +1426,7 @@ function updateUser(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.remove(); toastr.remove();
@ -1452,7 +1451,7 @@ function updateGroup(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1507,7 +1506,7 @@ function updateServer(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1571,7 +1570,7 @@ function updateSSH(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1601,7 +1600,7 @@ function updateTelegram(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1634,7 +1633,7 @@ function updateBackup(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1670,7 +1669,7 @@ function updateSmon(id) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1725,7 +1724,7 @@ function checkSshConnect(ip) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error:') != '-1') {
toastr.error(data) toastr.error(data)
} else { } else {
toastr.clear(); toastr.clear();
@ -1774,7 +1773,7 @@ function changeUserPassword(id, d) {
$('#missmatchpass').show(); $('#missmatchpass').show();
} else { } else {
$('#missmatchpass').hide(); $('#missmatchpass').hide();
$('#error').remove(); toastr.clear();
$.ajax( { $.ajax( {
url: "options.py", url: "options.py",
data: { data: {
@ -1785,7 +1784,7 @@ function changeUserPassword(id, d) {
type: "POST", type: "POST",
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') {
toastr.error(data); toastr.error(data);
} else { } else {
toastr.clear(); toastr.clear();
@ -1845,7 +1844,7 @@ function changeUserGroup(id) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#user-" + id).addClass("update", 1000); $("#user-" + id).addClass("update", 1000);
@ -1867,7 +1866,7 @@ function addUserGroup(id) {
}, },
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data); toastr.error(data);
} else { } else {
$("#user-" + id).addClass("update", 1000); $("#user-" + id).addClass("update", 1000);

View File

@ -65,7 +65,7 @@ function installWaf(ip1) {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('Info') != '-1' ){ } else if (data.indexOf('Info') != '-1' ){
toastr.clear(); toastr.clear();