feat(xo-web/import/disk): UI improvement for ISO files (#6874)

See https://xcp-ng.org/forum/topic/7243
This commit is contained in:
Mathieu
2023-06-29 10:51:16 +02:00
committed by GitHub
parent 5932ada717
commit c63fb6173d
4 changed files with 24 additions and 6 deletions
+4
View File
@@ -7,6 +7,8 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it” > Users must be able to say: “Nice enhancement, I'm eager to test it”
- [Import/Disk] Enhance clarity for importing ISO files [Forum#7243](https://xcp-ng.org/forum/topic/7243/can-t-import-iso-through-ova-not-a-supported-filetype?_=1685710667937) (PR [#6874](https://github.com/vatesfr/xen-orchestra/pull/6874))
### Bug fixes ### Bug fixes
> Users must be able to say: “I had this issue, happy to know it's fixed” > Users must be able to say: “I had this issue, happy to know it's fixed”
@@ -27,4 +29,6 @@
<!--packages-start--> <!--packages-start-->
- xo-web minor
<!--packages-end--> <!--packages-end-->
@@ -3836,8 +3836,8 @@ export default {
// Original text: 'Disk import success' // Original text: 'Disk import success'
diskImportSuccess: 'Importazione del disco riuscita', diskImportSuccess: 'Importazione del disco riuscita',
// Original text: 'Drop VMDK or VHD files here to import disks.' // Original text: 'Drop {types} files here to import disks.'
dropDisksFiles: 'Rilascia qui i file ISO, VMDK o VHD per importare i dischi.', dropDisksFiles: 'Rilascia qui i file {types} per importare i dischi.',
// Original text: 'To SR' // Original text: 'To SR'
importToSr: 'A SR', importToSr: 'A SR',
+2 -1
View File
@@ -1685,8 +1685,9 @@ const messages = {
// ---- Disk import --- // ---- Disk import ---
diskImportFailed: 'Disk import failed', diskImportFailed: 'Disk import failed',
diskImportSuccess: 'Disk import success', diskImportSuccess: 'Disk import success',
dropDisksFiles: 'Drop ISO, VMDK or VHD files here to import disks.', dropDisksFiles: 'Drop {types} files here to import disks.',
importToSr: 'To SR', importToSr: 'To SR',
isoImportRequirement: 'To import ISO files, an ISO repository is required',
// ---- Tasks --- // ---- Tasks ---
poolTasks: 'Pool tasks', poolTasks: 'Pool tasks',
@@ -100,12 +100,25 @@ const DiskImport = decorate([
onChangeSr: (_, sr) => ({ sr }), onChangeSr: (_, sr) => ({ sr }),
reset: getInitialState, reset: getInitialState,
}, },
computed: {
isSrIso: ({ sr }) => sr.content_type === 'iso',
},
}), }),
injectIntl, injectIntl,
injectState, injectState,
({ effects, state: { disks, loadingDisks, mapDescriptions, mapNames, sr } }) => ( ({ effects, state: { disks, loadingDisks, mapDescriptions, mapNames, sr, isSrIso } }) => (
<Container> <Container>
<form id='import-form'> <form id='import-form'>
<div className='mb-1'>
<a
className='text-info'
href='https://xcp-ng.org/blog/2022/05/05/how-to-create-a-local-iso-repository-in-xcp-ng/'
rel='noreferrer'
target='_blank'
>
<Icon icon='info' /> {_('isoImportRequirement')}
</a>
</div>
<Row> <Row>
<LabelCol>{_('importToSr')}</LabelCol> <LabelCol>{_('importToSr')}</LabelCol>
<InputCol> <InputCol>
@@ -116,8 +129,8 @@ const DiskImport = decorate([
<div> <div>
<Dropzone <Dropzone
onDrop={effects.handleDrop} onDrop={effects.handleDrop}
message={_('dropDisksFiles')} message={_('dropDisksFiles', { types: isSrIso ? 'ISO' : ['VHD', 'VMDK'] })}
accept={sr.content_type === 'iso' ? '.iso' : ['.vhd', '.vmdk']} accept={isSrIso ? '.iso' : ['.vhd', '.vmdk']}
/> />
{loadingDisks && <Icon icon='loading' />} {loadingDisks && <Icon icon='loading' />}
{disks.length > 0 && ( {disks.length > 0 && (