Skip to content

Commit

Permalink
feat(xo-web/proxy): disable "deploy proxy" for source users (#6199)
Browse files Browse the repository at this point in the history
See xcp-ng-forum#5740
  • Loading branch information
MathieuRA committed Apr 26, 2022
1 parent 3c1239c commit af85df6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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 @@ -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)',
Expand Down
14 changes: 13 additions & 1 deletion packages/xo-web/src/xo-app/proxies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -230,14 +232,24 @@ const Proxies = decorate([
return fetchProxyUpgrades([id])
},
},
computed: {
isFromSource: () => getXoaPlan() === SOURCES,
},
}),
withRouter,
injectState,
({ effects, proxies, router, state }) => (
<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>
Expand Down

0 comments on commit af85df6

Please sign in to comment.