Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a987bfac
Commit
a987bfac
authored
May 19, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(firmware) warn user about upcomming reboot
parent
fd6c5101
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
14 deletions
+47
-14
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+1
-0
firmware.volt
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
+46
-14
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
a987bfac
...
...
@@ -44,6 +44,7 @@ class FirmwareController extends ApiControllerBase
public
function
statusAction
()
{
$this
->
sessionClose
();
// long running action, close session
return
array
(
"upgrade_needs_reboot"
=>
"1"
,
"status"
=>
"ok"
,
"status_msg"
=>
"test"
);
$backend
=
new
Backend
();
$response
=
json_decode
(
trim
(
$backend
->
configdRun
(
"firmware pkgstatus"
)),
true
);
...
...
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
View file @
a987bfac
...
...
@@ -53,26 +53,28 @@ POSSIBILITY OF SUCH DAMAGE.
if (data['status'] == "ok") {
$.upgrade_action = data['status_upgrade_action'];
$.upgrade_needs_reboot = data['upgrade_needs_reboot'];
// unhide upgrade button
$("#upgrade").attr("style","");
// show upgrade list
$("#updatelist").html("<tr><th>{{ lang._('Package Name') }}</th>" +
"<th>{{ lang._('Current Version') }}</th><th>{{ lang._('New Version') }}</th></tr>");
$.each(['upgrade_packages','new_packages','reinstall_packages'], function(type_idx,type_name){
$.each(data[type_name],function(index,row){
if (type_name == "new_packages") {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
"<td><strong>{{ lang._('NEW') }}</strong></td><td>"+row['version']+"</td></tr>");
} else if (type_name == "reinstall_packages") {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
"<td>"+row['version']+"</td><td><strong>{{ lang._('REINSTALL') }}</strong></td></tr>");
} else {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
'<td>'+row['current_version']+'</td><td>'+row['new_version']+'</td></tr>');
}
});
if ( data[type_name] != undefined ) {
$.each(data[type_name],function(index,row){
if (type_name == "new_packages") {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
"<td><strong>{{ lang._('NEW') }}</strong></td><td>"+row['version']+"</td></tr>");
} else if (type_name == "reinstall_packages") {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
"<td>"+row['version']+"</td><td><strong>{{ lang._('REINSTALL') }}</strong></td></tr>");
} else {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
'<td>'+row['current_version']+'</td><td>'+row['new_version']+'</td></tr>');
}
});
}
});
}
});
...
...
@@ -92,6 +94,36 @@ POSSIBILITY OF SUCH DAMAGE.
});
}
/**
* check if a reboot is required, warn user or just upgrade
*/
function upgrade_ui(){
if ( $.upgrade_needs_reboot == "1" ) {
// reboot required, inform the user.
BootstrapDialog.show({
type:BootstrapDialog.TYPE_WARNING,
title: 'Reboot required',
message: 'This upgrade requires a reboot, when you install the firewall will automatically reboot!',
buttons: [{
label: 'Ok',
action: function(dialogRef){
dialogRef.close();
upgrade();
}
},{
label: 'Abort',
action: function(dialogRef){
dialogRef.close();
}
}]
});
} else {
upgrade();
}
}
/**
* handle update status
*/
...
...
@@ -136,7 +168,7 @@ POSSIBILITY OF SUCH DAMAGE.
$( document ).ready(function() {
// link event handlers
$('#checkupdate').click(updateStatus);
$('#upgrade').click(upgrade);
$('#upgrade').click(upgrade
_ui
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment