firmware: confirm reboot on set reinstall; closes #1992

This commit is contained in:
Franco Fichtner 2017-12-16 21:28:33 +00:00
parent 4d54029ec2
commit 84836ed6b4

View File

@ -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();