firmware: show support tiers in plugin list; closes #6374

This commit is contained in:
Franco Fichtner 2023-04-26 09:35:41 +02:00
parent 80af1c5ae9
commit 8db8ceb4b9
2 changed files with 17 additions and 3 deletions

View File

@ -857,8 +857,19 @@ class FirmwareController extends ApiMutableModelControllerBase
$devel = count($devel) == 2 ? $devel[1] == 'devel' : false;
/* need both remote and local, create array earlier */
$packages = array();
$plugins = array();
$packages = [];
$plugins = [];
$tiers = [];
$current = $backend->configdRun('firmware tiers');
$current = explode("\n", trim($current ?? ''));
foreach ($current as $line) {
$expanded = explode('|||', $line);
if (count($expanded) == 3) {
$tiers[$expanded[0]] = $expanded[2];
}
}
/* package infos are flat lists with 3 pipes as delimiter */
foreach (array('remote', 'local') as $type) {
@ -939,6 +950,7 @@ class FirmwareController extends ApiMutableModelControllerBase
$response['plugin'] = array();
foreach ($plugins as $plugin) {
$plugin['tier'] = isset($tiers[$plugin['name']]) ? $tiers[$plugin['name']] : gettext('N/A');
$response['plugin'][] = $plugin;
}

View File

@ -1,5 +1,5 @@
{#
# Copyright (c) 2015-2022 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-2023 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-2018 Deciso B.V.
# All rights reserved.
#
@ -443,6 +443,7 @@
'<tr class="plugin_entry">' + '<td>' + bold_on + row['name'] + status_text + bold_off + '</td>' +
'<td>' + bold_on + row['version'] + bold_off + '</td>' +
'<td>' + bold_on + row['flatsize'] + bold_off + '</td>' +
'<td>' + bold_on + row['tier'] + bold_off + '</td>' +
'<td>' + bold_on + row['repository'] + bold_off + '</td>' +
'<td>' + bold_on + row['comment'] + bold_off + '</td>' +
'<td style="white-space:nowrap;vertical-align:middle;"><div class="input-group">' +
@ -931,6 +932,7 @@
<th style="vertical-align:middle"><input type="text" class="input-sm" autocomplete="off" id="plugin_search" placeholder="{{ lang._('Name') }}"></th>
<th style="vertical-align:middle">{{ lang._('Version') }}</th>
<th style="vertical-align:middle">{{ lang._('Size') }}</th>
<th style="vertical-align:middle">{{ lang._('Tier') }}</th>
<th style="vertical-align:middle">{{ lang._('Repository') }}</th>
<th style="vertical-align:middle">{{ lang._('Comment') }}</th>
<th style="vertical-align:middle"></th>