firmware: bugs and tweaks #4500

This commit is contained in:
Franco Fichtner 2021-02-12 10:54:42 +01:00
parent 35d88e8da4
commit f059f6cd59
2 changed files with 27 additions and 14 deletions

View File

@ -28,9 +28,9 @@
<script>
function generic_search(that, entries) {
var search = $(that).val().toLowerCase();
let search = $(that).val();
$('.' + entries).each(function () {
let name = $(this).find('td').first().text().toLowerCase();
let name = $(this).text();
if (search.length != 0 && name.indexOf(search) == -1) {
$(this).hide();
} else {
@ -334,7 +334,15 @@
var installed = {};
$.each(data['product'], function(key, value) {
$('#' + key).text(value);
if (key == 'product_check') {
if (value != null) {
$('#product_time_check').text(value['last_check']);
} else {
$('#product_time_check').text("{{ lang._('N/A') }}");
}
} else {
$('#' + key).text(value);
}
});
$("#statustab_progress").removeClass("fa fa-cog fa-spin");
@ -626,13 +634,12 @@
$("#package_search").keyup(function () { generic_search(this, 'package_entry'); });
ajaxGet('/api/core/firmware/running', {}, function(data, status) {
// if action is already running reattach now...
if (data['status'] == 'busy') {
backend('upgrade', {upgrade:$.upgrade_action});
// dashboard link: run check automatically
// if action is already running reattach now...
backend('audit');
} else if (window.location.hash == '#checkupdate') {
// update UI and delay update to avoid races
setTimeout(updateStatus, 1000);
// dashboard link: run check automatically after delay
setTimeout(function () { backend('check'); }, 1000);
}
});
@ -854,10 +861,16 @@
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Commit hash') }}</td>
<td style="width: 150px;">{{ lang._('Commit') }}</td>
<td id="product_hash"></td>
<td></td>
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Mirror') }}</td>
<td id="product_mirror"></td>
<td></td>
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Repositories') }}</td>
@ -866,14 +879,14 @@
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Mirror URL') }}</td>
<td id="product_mirror"></td>
<td style="width: 150px;">{{ lang._('Updated on') }}</td>
<td id="product_time"></td>
<td></td>
</tr>
<tr>
<td style="width: 20px;"></td>
<td style="width: 150px;">{{ lang._('Updated on') }}</td>
<td id="product_time"></td>
<td style="width: 150px;">{{ lang._('Checked on') }}</td>
<td id="product_time_check"></td>
<td></td>
</tr>
<tr>

View File

@ -33,7 +33,7 @@ $ret = json_decode(@file_get_contents($metafile), true);
if ($ret != null) {
$ret['product_crypto'] = trim(shell_exec('opnsense-version -f'));
$ret['product_mirror'] = preg_replace('/\/[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}\//i', '/subscription-key/', trim(shell_exec('opnsense-update -M')));
$ret['product_time'] = date(DATE_RFC2822, filemtime($metafile));
$ret['product_time'] = date('D M j G:i:s T Y', filemtime($metafile));
$repos = explode("\n", trim(shell_exec('opnsense-verify -l')));
sort($repos);
$ret['product_repos'] = implode(', ', $repos);