From 84836ed6b4e9eff402b5779f37a97df582c7c170 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sat, 16 Dec 2017 21:28:33 +0000 Subject: [PATCH] firmware: confirm reboot on set reinstall; closes #1992 --- .../mvc/app/views/OPNsense/Core/firmware.volt | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt index 8a815e1b7..f5fa9689e 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt @@ -196,6 +196,38 @@ POSSIBILITY OF SUCH DAMAGE. }); } + /** + * perform package action that requires reboot confirmation + */ + function action_may_reboot(pkg_act, pkg_name) + { + if (pkg_act == 'reinstall' && (pkg_name == 'kernel' || pkg_name == 'base')) { + reboot_msg = "{{ lang._('The firewall will reboot directly after this set reinstall.') }}"; + + // reboot required, inform the user. + BootstrapDialog.show({ + type:BootstrapDialog.TYPE_WARNING, + title: "{{ lang._('Reboot required') }}", + message: reboot_msg, + buttons: [{ + label: "{{ lang._('OK') }}", + cssClass: 'btn-warning', + action: function(dialogRef){ + dialogRef.close(); + action(pkg_act, pkg_name); + } + },{ + label: "{{ lang._('Abort') }}", + action: function(dialogRef){ + dialogRef.close(); + } + }] + }); + } else { + action(pkg_act, pkg_name); + } + } + /** * perform package action, install poller to update status */ @@ -461,7 +493,7 @@ POSSIBILITY OF SUCH DAMAGE. // link buttons to actions $(".act_reinstall").click(function(event) { event.preventDefault(); - action('reinstall', $(this).data('package')); + action_may_reboot('reinstall', $(this).data('package')); }); $(".act_unlock").click(function(event) { event.preventDefault();