feat(xo-web/licenses): rebind license to this XOA (#5110)

See xoa#55
Requires xoa#58

When an XOA license is bound to another XOA, allow the user to move it to the
current XOA (thus unbinding it from the other one).
This commit is contained in:
Pierre Donias 2020-06-26 13:12:53 +02:00 committed by GitHub
parent 0326ce1d85
commit fe722c8b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View File

@ -16,6 +16,7 @@
- [Home/VM] Homogenize the list of backed up VMs with the normal list (PR [#5046](https://github.com/vatesfr/xen-orchestra/pull/5046))
- [SR/Disks] Add tooltip for disabled migration (PR [#4884](https://github.com/vatesfr/xen-orchestra/pull/4884))
- [SR/Advanced, SR selector] Show thin/thick provisioning [#2208](https://github.com/vatesfr/xen-orchestra/issues/2208) (PR [#5081](https://github.com/vatesfr/xen-orchestra/pull/5081))
- [Licenses] Ability to move a license from another XOA to the current XOA (PR [#5110](https://github.com/vatesfr/xen-orchestra/pull/5110))
### Bug fixes

View File

@ -2334,6 +2334,7 @@ const messages = {
xosanInstallXoaPlugin: 'Install XOA plugin first',
xosanLoadXoaPlugin: 'Load XOA plugin first',
bindXoaLicense: 'Activate license',
rebindXoaLicense: 'Move license to this XOA',
bindXoaLicenseConfirm:
'Are you sure you want to activate this license on your XOA? This action is not reversible!',
bindXoaLicenseConfirmText: 'activate {licenseType} license',

View File

@ -3072,7 +3072,7 @@ export const getLicense = (productId, boundObjectId) =>
export const unlockXosan = (licenseId, srId) =>
_call('xosan.unlock', { licenseId, sr: srId })
export const selfBindLicense = ({ id, plan }) =>
export const selfBindLicense = ({ id, plan, oldXoaId }) =>
confirm({
title: _('bindXoaLicense'),
body: _('bindXoaLicenseConfirm'),
@ -3082,7 +3082,10 @@ export const selfBindLicense = ({ id, plan }) =>
},
icon: 'unlock',
})
.then(() => _call('xoa.licenses.bindToSelf', { licenseId: id }), noop)
.then(
() => _call('xoa.licenses.bindToSelf', { licenseId: id, oldXoaId }),
noop
)
::tap(subscribeSelfLicenses.forceRefresh)
export const subscribeSelfLicenses = createSubscription(() =>

View File

@ -93,7 +93,22 @@ const LicenseManager = ({ item, userData }) => {
)
}
return <span>{_('licenseBoundToOtherXoa')}</span>
return (
<span>
{_('licenseBoundToOtherXoa')}
<br />
<ActionButton
btnStyle='danger'
data-id={item.id}
data-plan={item.product}
data-oldXoaId={item.xoaId}
handler={selfBindLicense}
icon='unlock'
>
{_('rebindXoaLicense')}
</ActionButton>
</span>
)
}
if (type === 'proxy') {