feat(xo-web/new-vm): show error when getting coreOS default template fails (#3343)
Fixes #3227
This commit is contained in:
parent
20dc4af4a4
commit
def9f947b7
@ -14,6 +14,7 @@
|
||||
- [Backup NG form] Move VMs' selection to a dedicated card [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) (PR [#3338](https://github.com/vatesfr/xen-orchestra/pull/3338))
|
||||
- [Backup NG smart mode] Exclude replicated VMs [#2338](https://github.com/vatesfr/xen-orchestra/issues/2338) (PR [#3312](https://github.com/vatesfr/xen-orchestra/pull/3312))
|
||||
- [Backup NG form] Show the compression checkbox when the full mode is active [#3236](https://github.com/vatesfr/xen-orchestra/issues/3236) (PR [#3345](https://github.com/vatesfr/xen-orchestra/pull/3345))
|
||||
- [New VM] Display an error when the getting of the coreOS default template fails [#3227](https://github.com/vatesfr/xen-orchestra/issues/3227) (PR [#3343](https://github.com/vatesfr/xen-orchestra/pull/3343))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -1181,6 +1181,8 @@ const messages = {
|
||||
availableTemplateVarsTitle: 'Available template variables',
|
||||
templateNameInfo: 'the VM\'s name. It must not contain "_"',
|
||||
templateIndexInfo: "the VM's index, it will take 0 in case of single VM",
|
||||
coreOsDefaultTemplateError:
|
||||
'Error on getting the default coreOS cloud template',
|
||||
newVmBootAfterCreate: 'Boot VM after creation',
|
||||
newVmMacPlaceholder: 'Auto-generated if empty',
|
||||
newVmCpuWeightLabel: 'CPU weight',
|
||||
|
@ -6,6 +6,7 @@ import classNames from 'classnames'
|
||||
import defined, { get } from 'xo-defined'
|
||||
import Icon from 'icon'
|
||||
import isIp from 'is-ip'
|
||||
import Link from 'link'
|
||||
import Page from '../page'
|
||||
import PropTypes from 'prop-types'
|
||||
import React from 'react'
|
||||
@ -76,7 +77,6 @@ import {
|
||||
formatSize,
|
||||
getCoresPerSocketPossibilities,
|
||||
generateReadableRandomString,
|
||||
noop,
|
||||
resolveIds,
|
||||
resolveResourceSet,
|
||||
} from 'utils'
|
||||
@ -526,8 +526,9 @@ export default class NewVm extends BaseComponent {
|
||||
|
||||
if (template.name_label === 'CoreOS') {
|
||||
getCloudInitConfig(template.id).then(
|
||||
cloudConfig => this._setState({ cloudConfig }),
|
||||
noop
|
||||
cloudConfig =>
|
||||
this._setState({ cloudConfig, coreOsDefaultTemplateError: false }),
|
||||
() => this._setState({ coreOsDefaultTemplateError: true })
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1017,7 +1018,7 @@ export default class NewVm extends BaseComponent {
|
||||
}
|
||||
|
||||
_renderInstallSettings = () => {
|
||||
const { template } = this.state.state
|
||||
const { template, coreOsDefaultTemplateError } = this.state.state
|
||||
if (!template) {
|
||||
return
|
||||
}
|
||||
@ -1204,13 +1205,19 @@ export default class NewVm extends BaseComponent {
|
||||
)}
|
||||
{template.name_label === 'CoreOS' && (
|
||||
<div>
|
||||
<label>{_('newVmCloudConfig')}</label>
|
||||
<DebounceTextarea
|
||||
className='form-control'
|
||||
onChange={this._linkState('cloudConfig')}
|
||||
rows={7}
|
||||
value={cloudConfig}
|
||||
/>
|
||||
<label>{_('newVmCloudConfig')}</label>{' '}
|
||||
{!coreOsDefaultTemplateError ? (
|
||||
<DebounceTextarea
|
||||
className='form-control'
|
||||
onChange={this._linkState('cloudConfig')}
|
||||
rows={7}
|
||||
value={cloudConfig}
|
||||
/>
|
||||
) : (
|
||||
<Link to='settings/logs' target='_blank' className='text-danger'>
|
||||
<Icon icon='alarm' /> {_('coreOsDefaultTemplateError')}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</Section>
|
||||
|
Loading…
Reference in New Issue
Block a user