Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-web/license): fix undefined expiration date #6730

Merged
merged 5 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [Backup/Restore] Fix restore via a proxy showing as interupted (PR [#6702](https://github.com/vatesfr/xen-orchestra/pull/6702))
- [REST API] Backup logs are now available at `/rest/v0/backups/logs`
- [Plugin/auth-oidc] Fix empty user names when using default config [Forum#59587](https://xcp-ng.org/forum/post/59587)
- [Pool/Pro License] Licenses with no expiration date are no longer considered "expired" for icon status (PR [#6730](https://github.com/vatesfr/xen-orchestra/pull/6730))
MathieuRA marked this conversation as resolved.
Show resolved Hide resolved

### Packages to release

Expand Down
1 change: 1 addition & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const messages = {
browseFiles: 'Browse files',
showLogs: 'Show logs',
noValue: 'None',
noExpiration: 'No expiration',
compression: 'Compression',
core: 'Core',
cpu: 'CPU',
Expand Down
5 changes: 4 additions & 1 deletion packages/xo-web/src/xo-app/home/pool-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export default class PoolItem extends Component {
reacletteState.poolLicenseInfoByPoolId[pool.id]

if (supportLevel === 'total') {
tooltip = _('earliestExpirationDate', { dateString: <ShortDate timestamp={earliestExpirationDate} /> })
tooltip = _('earliestExpirationDate', {
dateString:
earliestExpirationDate === Infinity ? _('noExpiration') : <ShortDate timestamp={earliestExpirationDate} />,
})
}
if (supportLevel === 'partial') {
tooltip = _('poolPartialSupport', { nHostsLicense: nHostsUnderLicense, nHosts })
Expand Down
7 changes: 6 additions & 1 deletion packages/xo-web/src/xo-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ export const ICON_POOL_LICENSE = {

for (const host of hosts) {
const license = xcpngLicenseByBoundObjectId[host.id]
if (license !== undefined && license.expires > Date.now()) {
if (license === undefined) {
continue
}
license.expires = license.expires ?? Infinity

if (license.expires > Date.now()) {
nHostsUnderLicense++
if (earliestExpirationDate === undefined || license.expires < earliestExpirationDate) {
earliestExpirationDate = license.expires
Expand Down