From 0bfa4a0a30fa04ba02b145efed1677c9e360c9f1 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 13 Aug 2015 17:23:33 +0200 Subject: [PATCH] (ids) fix for https://github.com/opnsense/core/issues/314 This patch fixes a few different issues. - Prevent the user from selecting all rules at once, the browser probably can't render that amount of data resulting in sloppy behaviour. - When querying the alerts, show an overlay during the process. This might take some time, depending on the amount of logged items - Change number of rows selection to more sane defaults. - Refresh data after "apply selection", to return to the right page --- .../mvc/app/views/OPNsense/IDS/index.volt | 66 +++++++++++++++++-- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt index 6202b2984..65f885192 100644 --- a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt @@ -95,12 +95,24 @@ POSSIBILITY OF SUCH DAMAGE. } /** - * Add fileid to alert filter + * add filter criteria to log query */ function addAlertQryFilters(request) { - var selected =$('#alert-logfile').find("option:selected").val(); - if ( selected != "") { - request['fileid'] = selected; + var selected_logfile =$('#alert-logfile').find("option:selected").val(); + var selected_max_entries =$('#alert-logfile-max').find("option:selected").val(); + var search_phrase = $("#inputSearchAlerts").val(); + + // add loading overlay + $('#processing-dialog').modal('show'); + $("#grid-alerts").bootgrid().on("loaded.rs.jquery.bootgrid", function (e){ + $('#processing-dialog').modal('hide'); + }); + + + if ( selected_logfile != "") { + request['fileid'] = selected_logfile; + request['rowCount'] = selected_max_entries; + request['searchPhrase'] = search_phrase; } return request; } @@ -170,7 +182,7 @@ POSSIBILITY OF SUCH DAMAGE. // refresh when all toggles are executed $.when.apply(null, deferreds).done(function(){ - $("#"+gridId).bootgrid("reload"); + $("#"+gridId).bootgrid("refresh"); }); } } @@ -200,6 +212,7 @@ POSSIBILITY OF SUCH DAMAGE. get:'/api/ids/settings/getRuleInfo/', options:{ requestHandler:addRuleFilters, + rowCount:[10, 25, 50,100,500,1000] , formatters:{ rowtoggle: function (column, row) { var toggle = " "; @@ -227,12 +240,15 @@ POSSIBILITY OF SUCH DAMAGE. options:{ multiSelect:false, selection:false, + templates : { + header: "" + }, requestHandler:addAlertQryFilters, formatters:{ info: function (column, row) { return " "; } - } + }, } }); } @@ -343,6 +359,13 @@ POSSIBILITY OF SUCH DAMAGE. actionToggleSelected(gridId, url, 1, 100); }); + /** + * link query alerts button. + */ + $("#actQueryAlerts").click(function(){ + $('#grid-alerts').bootgrid('reload'); + }); + /** * Initialize */ @@ -442,6 +465,23 @@ POSSIBILITY OF SUCH DAMAGE.
+ +
@@ -469,5 +509,19 @@ POSSIBILITY OF SUCH DAMAGE. + + + {{ partial("layout_partials/base_dialog",['fields':formDialogRule,'id':'DialogRule','label':'Rule details','hasSaveBtn':'false','msgzone_width':1])}} {{ partial("layout_partials/base_dialog",['fields':formDialogAlert,'id':'DialogAlert','label':'Alert details','hasSaveBtn':'false','msgzone_width':1])}}