mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
firmware: show update pending hint in system widget; closes #5013
This commit is contained in:
parent
f1b67df57f
commit
ddfd1cb562
@ -423,6 +423,7 @@ class FirmwareController extends ApiControllerBase
|
||||
$backend = new Backend();
|
||||
$response = array();
|
||||
if ($this->request->isPost()) {
|
||||
$backend->configdRun('firmware flush');
|
||||
$response['msg_uuid'] = trim($backend->configdRun('firmware update', true));
|
||||
$response['status'] = 'ok';
|
||||
} else {
|
||||
@ -442,6 +443,7 @@ class FirmwareController extends ApiControllerBase
|
||||
$backend = new Backend();
|
||||
$response = array();
|
||||
if ($this->request->isPost()) {
|
||||
$backend->configdRun('firmware flush');
|
||||
$response['msg_uuid'] = trim($backend->configdRun('firmware upgrade', true));
|
||||
$response['status'] = 'ok';
|
||||
} else {
|
||||
@ -1133,6 +1135,7 @@ class FirmwareController extends ApiControllerBase
|
||||
$this->sessionClose(); // long running action, close session
|
||||
|
||||
$backend = new Backend();
|
||||
$backend->configdRun('firmware flush');
|
||||
$backend->configdRun("firmware configure");
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,18 @@ parameters:
|
||||
type:script
|
||||
message:Retrieve firmware update status
|
||||
|
||||
[flush]
|
||||
command:rm -f /tmp/pkg_upgrade.json
|
||||
parameters:
|
||||
type:script
|
||||
message:Flush firmware update status
|
||||
|
||||
[probe]
|
||||
command:/usr/local/opnsense/scripts/firmware/launcher.sh check
|
||||
parameters:
|
||||
type:script
|
||||
message:Running firmware update status
|
||||
description:Firmware update check
|
||||
|
||||
[changelog.fetch]
|
||||
command: /usr/local/opnsense/scripts/firmware/changelog.sh fetch
|
||||
|
||||
@ -162,6 +162,25 @@ function system_api_versions()
|
||||
return $result;
|
||||
}
|
||||
|
||||
function system_api_firmware()
|
||||
{
|
||||
$ret = gettext('Click to check for updates.');
|
||||
|
||||
$product = json_decode(configd_run('firmware product'), true);
|
||||
if (
|
||||
!empty($product['product_check']['upgrade_sets']) ||
|
||||
!empty($product['product_check']['downgrade_packages']) ||
|
||||
!empty($product['product_check']['new_packages']) ||
|
||||
!empty($product['product_check']['reinstall_packages']) ||
|
||||
!empty($product['product_check']['remove_packages']) ||
|
||||
!empty($product['product_check']['upgrade_packages'])
|
||||
) {
|
||||
$ret = gettext('Click to view pending updates.');
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* widget system data
|
||||
*/
|
||||
@ -178,6 +197,7 @@ function system_api()
|
||||
$result['config'] = system_api_config();
|
||||
$result['kernel'] = system_api_kernel();
|
||||
$result['disk'] = system_api_disk();
|
||||
$result['firmware'] = system_api_firmware();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -73,6 +73,8 @@ require_once("system.inc");
|
||||
// update cpu usage chart
|
||||
system_information_widget_cpu_update(sender, data);
|
||||
|
||||
$("#system_information_widget_firmware").html(data['firmware']);
|
||||
|
||||
$("#system_information_widget_cpu_type").html(data['cpu']['model'] + ' ('+data['cpu']['cpus']+' cores)');
|
||||
var uptime_days = parseInt(moment.duration(parseInt(data['uptime']), 'seconds').asDays());
|
||||
var uptime_str = "";
|
||||
@ -181,7 +183,7 @@ require_once("system.inc");
|
||||
<tr>
|
||||
<td><?= gettext('Updates') ?></td>
|
||||
<td>
|
||||
<a href='/ui/core/firmware#checkupdate'><?= gettext('Click to check for updates.') ?></a>
|
||||
<a href='/ui/core/firmware#checkupdate'><span id="system_information_widget_firmware"><?= gettext('Retrieving internal update status...') ?></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user