feat(xo-web/snapshot with memory): add confirm modal (#4917)
Fixes #4914
This commit is contained in:
parent
6fe1da1587
commit
0847267069
@ -7,6 +7,8 @@
|
||||
|
||||
> 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
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
@ -1129,6 +1129,8 @@ const messages = {
|
||||
// ----- VM snapshot tab -----
|
||||
noSnapshots: 'No snapshots',
|
||||
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',
|
||||
snapshotCreateButton: 'New snapshot',
|
||||
tipCreateSnapshotLabel: 'Just click on the snapshot button to create one!',
|
||||
|
@ -1251,8 +1251,25 @@ export const deleteTemplates = templates =>
|
||||
}, noop)
|
||||
}, noop)
|
||||
|
||||
export const snapshotVm = (vm, name, saveMemory, description) =>
|
||||
_call('vm.snapshot', { id: resolveId(vm), name, description, saveMemory })
|
||||
export const snapshotVm = async (vm, name, saveMemory, description) => {
|
||||
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
|
||||
export const snapshotVms = vms =>
|
||||
|
@ -131,7 +131,7 @@ export default class TabSnapshot extends Component {
|
||||
<Col className='text-xs-right'>
|
||||
{vm.power_state !== 'Halted' && (
|
||||
<TabButton
|
||||
btnStyle='primary'
|
||||
btnStyle='warning'
|
||||
handler={_snapshotVmWithMemory}
|
||||
handlerParam={vm}
|
||||
icon='memory'
|
||||
|
Loading…
Reference in New Issue
Block a user