Commit c7922913 authored by Franco Fichtner's avatar Franco Fichtner

firmware: refactor slightly, closes #414

parent ed83d1bf
...@@ -73,9 +73,9 @@ class FirmwareController extends ApiControllerBase ...@@ -73,9 +73,9 @@ class FirmwareController extends ApiControllerBase
$response['status'] = 'ok'; $response['status'] = 'ok';
if ($response['updates'] == 1) { if ($response['updates'] == 1) {
/* keep this dynamic for template translation even though %s is always '1' */ /* keep this dynamic for template translation even though %s is always '1' */
$response['status_msg'] = sprintf(gettext('There is %s update available.'), $response['updates']); $response['status_msg'] = sprintf(gettext('There is %s update available, total download size is %s.'), $response['updates'], $response['download_size']);
} else { } else {
$response['status_msg'] = sprintf(gettext('There are %s updates available.'), $response['updates']); $response['status_msg'] = sprintf(gettext('There are %s updates available, total download size is %s.'), $response['updates'], $response['download_size']);
} }
if ($response['upgrade_needs_reboot'] == 1) { if ($response['upgrade_needs_reboot'] == 1) {
$response['status_msg'] = sprintf( $response['status_msg'] = sprintf(
......
...@@ -192,22 +192,23 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -192,22 +192,23 @@ POSSIBILITY OF SUCH DAMAGE.
// link event handlers // link event handlers
$('#checkupdate').click(updateStatus); $('#checkupdate').click(updateStatus);
$('#upgrade').click(upgrade_ui); $('#upgrade').click(upgrade_ui);
if (window.location.hash == '#checkupdate') { // show upgrade message if there
if ($('#message').html() != '') {
$('#message').attr('style', '');
}
// repopulate package information
packagesInfo();
// dashboard link: run check automatically // dashboard link: run check automatically
if (window.location.hash == '#checkupdate') {
updateStatus(); updateStatus();
} }
packagesInfo();
}); });
</script> </script>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php $message = @file_get_contents('/usr/local/opnsense/firmware-message'); <div id="message" style="display:none" class="alert alert-warning" role="alert"><?= @file_get_contents('/usr/local/opnsense/firmware-message') ?></div>
if (!empty($message)): ?>
<div class="alert alert-warning" role="alert"><?= $message ?></div>
<?php endif; ?>
<div class="alert alert-info" role="alert" style="min-height: 65px;"> <div class="alert alert-info" role="alert" style="min-height: 65px;">
<button class='btn btn-primary pull-right' id="upgrade" style="display:none"><i id="upgrade_progress" class=""></i> {{ lang._('Upgrade now') }}</button> <button class='btn btn-primary pull-right' id="upgrade" style="display:none"><i id="upgrade_progress" class=""></i> {{ lang._('Upgrade now') }}</button>
<button class='btn btn-default pull-right' id="checkupdate" style="margin-right: 8px;"><i id="checkupdate_progress" class=""></i> {{ lang._('Fetch updates')}}</button> <button class='btn btn-default pull-right' id="checkupdate" style="margin-right: 8px;"><i id="checkupdate_progress" class=""></i> {{ lang._('Fetch updates')}}</button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment