diff --git a/inc/awesome.css b/inc/awesome.css index 89180315..b2492367 100644 --- a/inc/awesome.css +++ b/inc/awesome.css @@ -300,6 +300,9 @@ margin-top: 5px; padding-left: 2px; } +.alert-one-row .fa-exclamation-circle { + margin-top: -5px; +} .note-symbol::after { display: none; font-family: "Font Awesome 5 Solid"; diff --git a/inc/overview.js b/inc/overview.js index 72fc9f14..87409212 100644 --- a/inc/overview.js +++ b/inc/overview.js @@ -23,8 +23,13 @@ function showHapserversCallBack(serv, hostnamea, service) { if (data.indexOf('error:') != '-1') { toastr.error(data); } else { - $("#" + hostnamea).empty(); - $("#" + hostnamea).html(data); + if (data.indexOf('ls: cannot access') != '-1') { + $("#" + hostnamea).empty(); + $("#" + hostnamea).html(); + } else { + $("#" + hostnamea).empty(); + $("#" + hostnamea).html(data); + } } } } ); @@ -193,13 +198,15 @@ function ajaxActionWafServers(action, id) { } ); } $( function() { - ChartsIntervalId = setInterval(updatingCpuRamCharts, 30000); - $(window).focus(function(){ - ChartsIntervalId = setInterval(updatingCpuRamCharts, 30000); - }); - $(window).blur(function(){ - clearInterval(ChartsIntervalId); - }); + if ((cur_url[0] == 'hapservers.py' && cur_url[1].split('=')[0] == 'service') || cur_url[0] == 'overview.py') { + ChartsIntervalId = setInterval(updatingCpuRamCharts, 30000); + $(window).focus(function () { + ChartsIntervalId = setInterval(updatingCpuRamCharts, 30000); + }); + $(window).blur(function () { + clearInterval(ChartsIntervalId); + }); + } $( "#show-all-users" ).click( function() { $( ".show-users" ).show("fast"); $( "#show-all-users" ).text("Hide"); diff --git a/inc/script.js b/inc/script.js index 1276bf35..074f1607 100644 --- a/inc/script.js +++ b/inc/script.js @@ -175,12 +175,12 @@ window.onblur= function() { } }; if(localStorage.getItem('restart')) { - var ip = localStorage.getItem('restart'); + var ip_for_restart = localStorage.getItem('restart'); $.ajax( { url: "options.py", data: { act: "checkrestart", - serv: ip, + serv: ip_for_restart, token: $('#token').val() }, type: "POST", @@ -190,9 +190,10 @@ if(localStorage.getItem('restart')) { $("#apply_div").css('width', '850px'); if (cur_url[0] == "hapservers.py") { $("#apply_div").css('width', '650px'); - $("#apply_div").html("You have made changes to the server: "+ip+". Changes will take effect only afterrestartX"); + $("#apply_div").addClass("alert-one-row"); + $("#apply_div").html("You have made changes to the server: "+ip_for_restart+". Changes will take effect only afterrestartX"); } else { - $("#apply_div").html("You have made changes to the server: "+ip+". Changes will take effect only after restart. Go to the HAProxy Overview page and restartX"); + $("#apply_div").html("You have made changes to the server: "+ip_for_restart+". Changes will take effect only after restart. Go to the HAProxy Overview page and restartX"); } $.getScript('/inc/overview.js'); } @@ -348,7 +349,7 @@ function showStats() { } function openStats() { var serv = $("#serv").val(); - if (cur_url[1] == "service=nginx") { + if (cur_url[1].split('&')[0] == "service=nginx") { var url = "viewsttats.py?service=nginx&serv="+serv+"&open=open" } else { var url = "viewsttats.py?serv="+serv+"&open=open" @@ -358,9 +359,9 @@ function openStats() { } function openVersions() { var serv = $("#serv").val(); - if (cur_url[1] == "service=keepalived") { + if (cur_url[1].split('&')[0] == "service=keepalived") { var url = "versions.py?service=keepalived&serv="+serv+"&open=open" - } else if (cur_url[1] == "service=nginx") { + } else if (cur_url[1].split('&')[0] == "service=nginx") { var url = "versions.py?service=nginx&serv="+serv+"&open=open" } else { var url = "versions.py?serv="+serv+"&open=open"