Skip to content

Commit

Permalink
mutualize code
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuRA committed Mar 6, 2023
1 parent 3edb9c7 commit 10a2b36
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 38 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

> Users must be able to say: “Nice enhancement, I'm eager to test it”
- Grouping of alert icons on the `Home` page for `Pool` and `Host` (PR [#6655](https://github.com/vatesfr/xen-orchestra/pull/6655))
- [Home/pool, host] Grouping of alert icons on the `Home` page for `Pool` and `Host` (PR [#6655](https://github.com/vatesfr/xen-orchestra/pull/6655))

### Bug fixes

Expand Down
22 changes: 3 additions & 19 deletions packages/xo-web/src/xo-app/home/host-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
import MiniStats from './mini-stats'
import styles from './index.css'

import { LICENSE_WARNING_BODY } from '../host/license-warning'

import BulkIcons from '../../common/bulk-icons'

@addSubscriptions({
Expand Down Expand Up @@ -120,25 +122,7 @@ export default class HostItem extends Component {
level: 'danger',
render: (
<span>
<Icon icon='alarm' /> {_('licenseRestrictionsModalTitle')}{' '}
<a href='https://xcp-ng.com/pricing.html#xcpngvsxenserver' rel='noopener noreferrer' target='_blank'>
{_('actionsRestricted')}
</a>
<div>
{_('counterRestrictionsOptions')}
<ul>
<li>
<a
href='https://github.com/xcp-ng/xcp/wiki/Upgrade-from-XenServer'
rel='noopener noreferrer'
target='_blank'
>
{_('counterRestrictionsOptionsXcp')}
</a>
</li>
<li>{_('counterRestrictionsOptionsXsLicense')}</li>
</ul>
</div>
<Icon icon='alarm' /> {_('licenseRestrictionsModalTitle')} {LICENSE_WARNING_BODY}
</span>
),
})
Expand Down
36 changes: 18 additions & 18 deletions packages/xo-web/src/xo-app/host/license-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import Icon from 'icon'
import Tooltip from 'tooltip'
import { alert } from 'modal'

const showInfo = () =>
alert(
_('licenseRestrictionsModalTitle'),
<span>
<a href='https://xcp-ng.com/pricing.html#xcpngvsxenserver' rel='noopener noreferrer' target='_blank'>
{_('actionsRestricted')}
</a>{' '}
{_('counterRestrictionsOptions')}
<ul>
<li>
<a href='https://github.com/xcp-ng/xcp/wiki/Upgrade-from-XenServer' rel='noopener noreferrer' target='_blank'>
{_('counterRestrictionsOptionsXcp')}
</a>
</li>
<li>{_('counterRestrictionsOptionsXsLicense')}</li>
</ul>
</span>
)
export const LICENSE_WARNING_BODY = (
<span>
<a href='https://xcp-ng.com/pricing.html#xcpngvsxenserver' rel='noopener noreferrer' target='_blank'>
{_('actionsRestricted')}
</a>{' '}
{_('counterRestrictionsOptions')}
<ul>
<li>
<a href='https://github.com/xcp-ng/xcp/wiki/Upgrade-from-XenServer' rel='noopener noreferrer' target='_blank'>
{_('counterRestrictionsOptionsXcp')}
</a>
</li>
<li>{_('counterRestrictionsOptionsXsLicense')}</li>
</ul>
</span>
)

const showInfo = () => alert(_('licenseRestrictionsModalTitle'), LICENSE_WARNING_BODY)

const LicenseWarning = ({ iconSize = 'sm' }) => (
<Tooltip content={_('licenseRestrictions')}>
Expand Down

0 comments on commit 10a2b36

Please sign in to comment.