feat(xo-web/exportVm): support zstd compression (#3891)

Fixes #3773
This commit is contained in:
badrAZ 2019-01-28 15:42:39 +01:00 committed by Pierre Donias
parent 36f7af8576
commit 93985e1a51
3 changed files with 50 additions and 5 deletions

View File

@ -15,6 +15,7 @@
- [Hosts] Ability to enable/disable host multipathing [#3659](https://github.com/vatesfr/xen-orchestra/issues/3659) (PR [#3865](https://github.com/vatesfr/xen-orchestra/pull/3865))
- [Login] Add OTP authentication [#2044](https://github.com/vatesfr/xen-orchestra/issues/2044) (PR [#3879](https://github.com/vatesfr/xen-orchestra/pull/3879))
- [Notifications] New notification page to provide important information about XOA (PR [#3904](https://github.com/vatesfr/xen-orchestra/pull/3904))
- [VM] Ability to export a VM with zstd compression [#3773](https://github.com/vatesfr/xen-orchestra/issues/3773) (PR [#3891](https://github.com/vatesfr/xen-orchestra/pull/3891))
### Bug fixes

View File

@ -0,0 +1,35 @@
import BaseComponent from 'base-component'
import React from 'react'
import _ from '../../intl'
import SelectCompression from '../../select-compression'
import { Container, Row, Col } from '../../grid'
export default class ExportVmModalBody extends BaseComponent {
state = {
compression: '',
}
get value() {
const compression = this.state.compression
return compression === 'zstd' ? 'zstd' : compression === 'native'
}
render() {
return (
<Container>
<Row>
<Col mediumSize={6}>
<strong>{_('compression')}</strong>
</Col>
<Col mediumSize={6}>
<SelectCompression
onChange={this.linkState('compression')}
value={this.state.compression}
/>
</Col>
</Row>
</Container>
)
}
}

View File

@ -1425,12 +1425,21 @@ export const importVms = (vms, sr) =>
)
)
export const exportVm = vm => {
info(_('startVmExport'), vm.id)
return _call('vm.export', { vm: resolveId(vm) }).then(({ $getFrom: url }) => {
window.location = `.${url}`
import ExportVmModalBody from './export-vm-modal' // eslint-disable-line import/first
export const exportVm = vm =>
confirm({
body: <ExportVmModalBody />,
icon: 'export',
title: _('exportVmLabel'),
}).then(compress => {
const id = resolveId(vm)
info(_('startVmExport'), id)
return _call('vm.export', { vm: id, compress }).then(
({ $getFrom: url }) => {
window.location = `.${url}`
}
)
})
}
export const exportVdi = vdi => {
info(_('startVdiExport'), vdi.id)