fix(xo-web/new-vm): cloud init should only be available in Premium (#4174)
This commit is contained in:
@@ -87,3 +87,5 @@ export const DEFAULT_NETWORK_CONFIG_TEMPLATE = `#network:
|
||||
# name: eth0
|
||||
# subnets:
|
||||
# - type: dhcp`
|
||||
|
||||
export const CAN_CLOUD_INIT = +process.env.XOA_PLAN > 3
|
||||
|
||||
@@ -1321,6 +1321,7 @@ const messages = {
|
||||
newVmSshKey: 'SSH key',
|
||||
noConfigDrive: 'No config drive',
|
||||
newVmCustomConfig: 'Custom config',
|
||||
premiumOnly: 'Only available in Premium',
|
||||
availableTemplateVarsInfo:
|
||||
'Click here to see the available template variables',
|
||||
availableTemplateVarsTitle: 'Available template variables',
|
||||
|
||||
@@ -37,7 +37,9 @@ export class TooltipViewer extends Component {
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
show ? styles.tooltipEnabled : styles.tooltipDisabled,
|
||||
show && content !== undefined
|
||||
? styles.tooltipEnabled
|
||||
: styles.tooltipDisabled,
|
||||
className
|
||||
)}
|
||||
style={{
|
||||
|
||||
@@ -16,6 +16,7 @@ import Tooltip from 'tooltip'
|
||||
import Wizard, { Section } from 'wizard'
|
||||
import {
|
||||
AvailableTemplateVars,
|
||||
CAN_CLOUD_INIT,
|
||||
DEFAULT_CLOUD_CONFIG_TEMPLATE,
|
||||
DEFAULT_NETWORK_CONFIG_TEMPLATE,
|
||||
NetworkConfigInfo,
|
||||
@@ -1163,13 +1164,18 @@ export default class NewVm extends BaseComponent {
|
||||
<br />
|
||||
<LineItem>
|
||||
<label>
|
||||
<input
|
||||
checked={installMethod === 'SSH'}
|
||||
name='installMethod'
|
||||
onChange={this._linkState('installMethod')}
|
||||
type='radio'
|
||||
value='SSH'
|
||||
/>
|
||||
<Tooltip
|
||||
content={CAN_CLOUD_INIT ? undefined : _('premiumOnly')}
|
||||
>
|
||||
<input
|
||||
checked={installMethod === 'SSH'}
|
||||
disabled={!CAN_CLOUD_INIT}
|
||||
name='installMethod'
|
||||
onChange={this._linkState('installMethod')}
|
||||
type='radio'
|
||||
value='SSH'
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
{_('newVmSshKey')}
|
||||
</label>
|
||||
@@ -1201,13 +1207,18 @@ export default class NewVm extends BaseComponent {
|
||||
<br />
|
||||
<LineItem>
|
||||
<label>
|
||||
<input
|
||||
checked={installMethod === 'customConfig'}
|
||||
name='installMethod'
|
||||
onChange={this._linkState('installMethod')}
|
||||
type='radio'
|
||||
value='customConfig'
|
||||
/>
|
||||
<Tooltip
|
||||
content={CAN_CLOUD_INIT ? undefined : _('premiumOnly')}
|
||||
>
|
||||
<input
|
||||
checked={installMethod === 'customConfig'}
|
||||
disabled={!CAN_CLOUD_INIT}
|
||||
name='installMethod'
|
||||
onChange={this._linkState('installMethod')}
|
||||
type='radio'
|
||||
value='customConfig'
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
{_('newVmCustomConfig')}
|
||||
</label>
|
||||
|
||||
Reference in New Issue
Block a user