feat(xo-web/proxy): disable "deploy proxy" for source users (#6199)

See xcp-ng-forum#5740
This commit is contained in:
Mathieu 2022-04-26 19:28:07 +02:00 committed by GitHub
parent 3c1239cfb8
commit af85df611c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,7 @@
- [VM export] Feat export to `ova` format (PR [#6006](https://github.com/vatesfr/xen-orchestra/pull/6006))
- [Backup] Add _Restore Health Check_: ensure a backup is viable by doing an automatic test restore (requires guest tools in the VM) [#6148](https://github.com/vatesfr/xen-orchestra/pull/6148)
- [VM migrate] Allow to choose a private network for VIFs network (PR [#6200](https://github.com/vatesfr/xen-orchestra/pull/6200))
- [Proxy] Disable "Deploy proxy" button for source users (PR [#6199](https://github.com/vatesfr/xen-orchestra/pull/6199))
### Bug fixes

View File

@ -2395,6 +2395,7 @@ const messages = {
trialLicenseInfo: 'You are currently in a {edition} trial period that will end on {date, date, medium}',
// ----- proxies -----
deployProxyDisabled: 'Only available to XOA users',
forgetProxyApplianceTitle: 'Forget prox{n, plural, one {y} other {ies}}',
forgetProxyApplianceMessage: 'Are you sure you want to forget {n, number} prox{n, plural, one {y} other {ies}}?',
forgetProxies: 'Forget proxy(ies)',

View File

@ -28,6 +28,8 @@ import Page from '../page'
import deployProxy from './deploy-proxy'
import { updateApplianceSettings } from './update-appliance-settings'
import { getXoaPlan, SOURCES } from '../../common/xoa-plans'
const _editProxy = (value, { name, proxy }) => editProxyAppliance(proxy, { [name]: value })
const HEADER = (
@ -230,6 +232,9 @@ const Proxies = decorate([
return fetchProxyUpgrades([id])
},
},
computed: {
isFromSource: () => getXoaPlan() === SOURCES,
},
}),
withRouter,
injectState,
@ -237,7 +242,14 @@ const Proxies = decorate([
<Page header={HEADER} title='proxies' formatTitle>
<div>
<div className='mt-1 mb-1'>
<ActionButton btnStyle='success' handler={effects.deployProxy} icon='proxy' size='large'>
<ActionButton
btnStyle='success'
disabled={state.isFromSource}
handler={effects.deployProxy}
icon='proxy'
size='large'
tooltip={state.isFromSource ? _('deployProxyDisabled') : undefined}
>
{_('deployProxy')}
</ActionButton>
</div>