mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
security/q-feeds-connector - Add license expiry date + name to widget (#5040)
This commit is contained in:
+7
@@ -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>`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user