From 3a5874309e005519633ae289095e821fa44bbfbb Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Wed, 10 Oct 2018 11:53:03 +0200 Subject: [PATCH] Firewall, live log. Don't cleanup visible records when limit isn't reached. Without this fix it's difficult to keep track on logs which change often. --- .../views/OPNsense/Diagnostics/fw_log.volt | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt index 0ab8c6fe7..5ed4aeaeb 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt @@ -96,10 +96,27 @@ POSSIBILITY OF SUCH DAMAGE. $("#grid-log > tbody > tr:first").before(log_tr); } } - // limit output - $("#grid-log > tbody > tr:gt("+(parseInt($("#limit").val())-1)+")").remove(); // apply filter after load $("#filter").keyup(); + + // limit output, try to keep max X records on screen. + var tr_count = 0; + var visible_count = 0; + var max_rows = parseInt($("#limit").val()); + $("#grid-log > tbody > tr").each(function(){ + if ($(this).is(':visible')) { + ++visible_count; + if (visible_count > max_rows) { + // more then [max_rows] visible, safe to remove the rest + $(this).remove(); + } + } else if (tr_count > max_rows) { + // invisible rows starting at [max_rows] rownumber + $(this).remove(); + } + ++tr_count; + }); + // bind info buttons $(".act_info").unbind('click').click(function(){ var sender_tr = $(this).parent().parent();