diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index a3bef3ec4..e95ebf0fd 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -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” diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index 2878b3840..1682f5d41 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -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!', diff --git a/packages/xo-web/src/common/xo/index.js b/packages/xo-web/src/common/xo/index.js index a0c6d8478..4afa3bdfa 100644 --- a/packages/xo-web/src/common/xo/index.js +++ b/packages/xo-web/src/common/xo/index.js @@ -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 => diff --git a/packages/xo-web/src/xo-app/vm/tab-snapshots.js b/packages/xo-web/src/xo-app/vm/tab-snapshots.js index e4f79de4c..dd879f0cf 100644 --- a/packages/xo-web/src/xo-app/vm/tab-snapshots.js +++ b/packages/xo-web/src/xo-app/vm/tab-snapshots.js @@ -131,7 +131,7 @@ export default class TabSnapshot extends Component {