From 168ec390c357a1b2ffbac60eed03dbdad703be48 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Wed, 29 Jul 2015 10:17:24 +0200 Subject: [PATCH] (ids) reload general settings after download (part 2) --- .../mvc/app/views/OPNsense/IDS/index.volt | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt index a3259dc1c..38861420c 100644 --- a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt @@ -120,6 +120,29 @@ POSSIBILITY OF SUCH DAMAGE. }); } + /** + * save (general) settings and reconfigure + */ + function actionReconfigure() { + saveFormToEndpoint(url="/api/ids/settings/set",formid='frm_GeneralSettings',callback_ok=function(){ + $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); + ajaxCall(url="/api/ids/service/reconfigure", sendData={}, callback=function(data,status) { + // when done, disable progress animation. + $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); + updateStatus(); + + if (status != "success" || data['status'].toLowerCase().trim() != "ok") { + BootstrapDialog.show({ + type: BootstrapDialog.TYPE_WARNING, + title: "Error reconfiguring IDS", + message: data['status'], + draggable: true + }); + } + }); + }); + } + loadGeneralSettings(); updateStatus(); @@ -217,23 +240,7 @@ POSSIBILITY OF SUCH DAMAGE. * save settings and reconfigure ids */ $("#reconfigureAct").click(function(){ - saveFormToEndpoint(url="/api/ids/settings/set",formid='frm_GeneralSettings',callback_ok=function(){ - $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); - ajaxCall(url="/api/ids/service/reconfigure", sendData={}, callback=function(data,status) { - // when done, disable progress animation. - $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); - updateStatus(); - - if (status != "success" || data['status'].toLowerCase().trim() != "ok") { - BootstrapDialog.show({ - type: BootstrapDialog.TYPE_WARNING, - title: "Error reconfiguring IDS", - message: data['status'], - draggable: true - }); - } - }); - }); + actionReconfigure(); }); /** @@ -246,7 +253,11 @@ POSSIBILITY OF SUCH DAMAGE. $("#updateRulesAct_progress").removeClass("fa fa-spinner fa-pulse"); $('#grid-rule-files').bootgrid('reload'); updateStatus(); - loadGeneralSettings(); + if ($('#scheduled_updates').is(':hidden') ){ + // save and reconfigure on initial download (tries to create a cron job) + actionReconfigure(); + loadGeneralSettings(); + } }); });