mirror of
https://github.com/opnsense/plugins.git
synced 2026-02-03 20:40:37 -05:00
security/q-feeds-connector - Add license expiry date + name to widget (#5040)
This commit is contained in:
parent
b5fd182511
commit
d2a47d4703
2 changed files with 22 additions and 1 deletions
|
|
@ -110,6 +110,13 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
}
|
||||
}
|
||||
}
|
||||
// Add license information from company_info if available
|
||||
if (!empty($info['company_info'])) {
|
||||
$stats['license'] = [
|
||||
'name' => $info['company_info']['license_name'] ?? null,
|
||||
'expiry_date' => $info['company_info']['license_expiry_date'] ?? null
|
||||
];
|
||||
}
|
||||
}
|
||||
return $stats;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ export default class QFeeds extends BaseTableWidget {
|
|||
}
|
||||
let rows = [];
|
||||
let feeds = [];
|
||||
let licenseInfoShown = false;
|
||||
|
||||
for (let feed of data.feeds) {
|
||||
feeds.push(
|
||||
`<b><i class="fa fa-fw fa-angle-right" aria-hidden="true"></i> ${feed.name}</b>`,
|
||||
|
|
@ -78,7 +80,19 @@ export default class QFeeds extends BaseTableWidget {
|
|||
`<div><i class="fa fa-fw fa-circle-o" aria-hidden="true"></i> ${this.translations.next_update}: ${feed.next_update}</div>`
|
||||
);
|
||||
if (feed.licensed) {
|
||||
feeds.push(`<div><i class="fa fa-fw fa-check" aria-hidden="true"></i> ${this.translations.licensed}</div>`);
|
||||
let licenseText = this.translations.licensed;
|
||||
if (data.license && data.license.name) {
|
||||
licenseText += ` (${data.license.name})`;
|
||||
}
|
||||
feeds.push(`<div><i class="fa fa-fw fa-check" aria-hidden="true"></i> ${licenseText}</div>`);
|
||||
if (!licenseInfoShown && data.license && data.license.expiry_date) {
|
||||
const expiryDate = new Date(data.license.expiry_date);
|
||||
if (!isNaN(expiryDate.getTime())) {
|
||||
const formattedDate = expiryDate.toLocaleDateString();
|
||||
feeds.push(`<div><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> Expires: ${formattedDate}</div>`);
|
||||
}
|
||||
licenseInfoShown = true;
|
||||
}
|
||||
} else {
|
||||
feeds.push(`<div><i class="fa fa-fw fa-close" aria-hidden="true"></i> ${this.translations.unlicensed}</div>`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue