feat(xo-web/snapshot with memory): add confirm modal (#4917)

Fixes #4914
This commit is contained in:
Pierre Donias 2020-04-09 16:51:09 +02:00 committed by GitHub
parent 6fe1da1587
commit 0847267069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

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”
- [Snapshot] Confirmation message before creating a snapshot with memory [#4914](https://github.com/vatesfr/xen-orchestra/issues/4914) (PR [#4917](https://github.com/vatesfr/xen-orchestra/pull/4917))
### 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”

View File

@ -1129,6 +1129,8 @@ const messages = {
// ----- VM snapshot tab ----- // ----- VM snapshot tab -----
noSnapshots: 'No snapshots', noSnapshots: 'No snapshots',
newSnapshotWithMemory: 'New snapshot with memory', newSnapshotWithMemory: 'New snapshot with memory',
newSnapshotWithMemoryConfirm:
'Are you sure you want to create a snapshot with memory? This could take a while and the VM will be unusable during that time.',
snapshotMemorySaved: 'Memory saved', snapshotMemorySaved: 'Memory saved',
snapshotCreateButton: 'New snapshot', snapshotCreateButton: 'New snapshot',
tipCreateSnapshotLabel: 'Just click on the snapshot button to create one!', tipCreateSnapshotLabel: 'Just click on the snapshot button to create one!',

View File

@ -1251,8 +1251,25 @@ export const deleteTemplates = templates =>
}, noop) }, noop)
}, noop) }, noop)
export const snapshotVm = (vm, name, saveMemory, description) => export const snapshotVm = async (vm, name, saveMemory, description) => {
_call('vm.snapshot', { id: resolveId(vm), name, description, saveMemory }) if (saveMemory) {
try {
await confirm({
title: _('newSnapshotWithMemory'),
body: _('newSnapshotWithMemoryConfirm'),
icon: 'memory',
})
} catch (error) {
return
}
}
return _call('vm.snapshot', {
id: resolveId(vm),
name,
description,
saveMemory,
})
}
import SnapshotVmModalBody from './snapshot-vm-modal' // eslint-disable-line import/first import SnapshotVmModalBody from './snapshot-vm-modal' // eslint-disable-line import/first
export const snapshotVms = vms => export const snapshotVms = vms =>

View File

@ -131,7 +131,7 @@ export default class TabSnapshot extends Component {
<Col className='text-xs-right'> <Col className='text-xs-right'>
{vm.power_state !== 'Halted' && ( {vm.power_state !== 'Halted' && (
<TabButton <TabButton
btnStyle='primary' btnStyle='warning'
handler={_snapshotVmWithMemory} handler={_snapshotVmWithMemory}
handlerParam={vm} handlerParam={vm}
icon='memory' icon='memory'