diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 492daff1c..00b6ae5ff 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -14,6 +14,7 @@ - [VIF] Ability for admins to set any allowed IPs, including IPv6 and IPs that are not in an IP pool [#2535](https://github.com/vatesfr/xen-orchestra/issues/2535) [#1872](https://github.com/vatesfr/xen-orchestra/issues/1872) (PR [#5367](https://github.com/vatesfr/xen-orchestra/pull/5367)) - [Proxy] Ability to restore a file from VM backup (PR [#5359](https://github.com/vatesfr/xen-orchestra/pull/5359)) - [Web Hooks] `backupNg.runJob` is now triggered by scheduled runs [#5205](https://github.com/vatesfr/xen-orchestra/issues/5205) (PR [#5360](https://github.com/vatesfr/xen-orchestra/pull/5360)) +- [Licensing] Add trial end information banner (PR [#5374](https://github.com/vatesfr/xen-orchestra/pull/5374)) ### Bug fixes diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index d59b003aa..da0de3a5c 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -2303,6 +2303,8 @@ const messages = { starterLicense: 'Starter license', enterpriseLicense: 'Enterprise license', premiumLicense: 'Premium license', + trialLicenseInfo: + 'You are currently in a {edition} trial period that will end on {date, date, medium}', // ----- proxies ----- forgetProxyApplianceTitle: 'Forget prox{n, plural, one {y} other {ies}}', diff --git a/packages/xo-web/src/xo-app/index.js b/packages/xo-web/src/xo-app/index.js index 8fcf04293..643f3dc46 100644 --- a/packages/xo-web/src/xo-app/index.js +++ b/packages/xo-web/src/xo-app/index.js @@ -9,9 +9,10 @@ import React from 'react' import Shortcuts from 'shortcuts' import themes from 'themes' import _, { IntlProvider } from 'intl' -import { blockXoaAccess } from 'xoa-updater' +import { blockXoaAccess, isTrialRunning } from 'xoa-updater' import { connectStore, getXoaPlan, routes } from 'utils' import { Notification } from 'notification' +import { productId2Plan } from 'xoa-plans' import { ShortcutManager } from 'react-shortcuts' import { ThemeProvider } from 'styled-components' import { TooltipViewer } from 'tooltip' @@ -124,6 +125,7 @@ export default class XoApp extends Component { state = { dismissedSourceBanner: Boolean(cookies.get('dismissedSourceBanner')), + dismissedTrialBanner: Boolean(cookies.get('dismissedTrialBanner')), } displayOpenSourceDisclaimer() { @@ -153,6 +155,11 @@ export default class XoApp extends Component { this.setState({ dismissedSourceBanner: true }) } + dismissTrialBanner = () => { + cookies.set('dismissedTrialBanner', true, { expires: 1 }) + this.setState({ dismissedTrialBanner: true }) + } + componentDidMount() { this.refs.bodyWrapper.style.minHeight = this.refs.menu.getWrappedInstance().height + 'px' if (+process.env.XOA_PLAN === 5) { @@ -259,6 +266,17 @@ export default class XoApp extends Component { )} + {isTrialRunning(trial.trial) && !this.state.dismissedTrialBanner && ( +
+ {_('trialLicenseInfo', { + edition: getXoaPlan(productId2Plan[trial.trial.productId]), + date: new Date(trial.trial.end), + })} + +
+ )}