feat(VM/Snapshots): add grouped deletion to the SortedTable (#2597)
Fixes #2595
This commit is contained in:
parent
ed3ecc6f4e
commit
5ecc31b977
@ -816,6 +816,7 @@ const messages = {
|
|||||||
tipCreateSnapshotLabel: 'Just click on the snapshot button to create one!',
|
tipCreateSnapshotLabel: 'Just click on the snapshot button to create one!',
|
||||||
revertSnapshot: 'Revert VM to this snapshot',
|
revertSnapshot: 'Revert VM to this snapshot',
|
||||||
deleteSnapshot: 'Remove this snapshot',
|
deleteSnapshot: 'Remove this snapshot',
|
||||||
|
deleteSnapshots: 'Remove selected snapshots',
|
||||||
copySnapshot: 'Create a VM from this snapshot',
|
copySnapshot: 'Create a VM from this snapshot',
|
||||||
exportSnapshot: 'Export this snapshot',
|
exportSnapshot: 'Export this snapshot',
|
||||||
snapshotDate: 'Creation date',
|
snapshotDate: 'Creation date',
|
||||||
@ -919,7 +920,8 @@ const messages = {
|
|||||||
usersStatePanel: 'Users',
|
usersStatePanel: 'Users',
|
||||||
srStatePanel: 'Storage state',
|
srStatePanel: 'Storage state',
|
||||||
ofUsage: '{usage} (of {total})',
|
ofUsage: '{usage} (of {total})',
|
||||||
ofCpusUsage: '{nVcpus, number} vCPU{nVcpus, plural, one {} other {s}} (of {nCpus, number} CPU{nCpus, plural, one {} other {s}})',
|
ofCpusUsage:
|
||||||
|
'{nVcpus, number} vCPU{nVcpus, plural, one {} other {s}} (of {nCpus, number} CPU{nCpus, plural, one {} other {s}})',
|
||||||
noSrs: 'No storage',
|
noSrs: 'No storage',
|
||||||
srName: 'Name',
|
srName: 'Name',
|
||||||
srPool: 'Pool',
|
srPool: 'Pool',
|
||||||
@ -1232,6 +1234,9 @@ const messages = {
|
|||||||
'Are you sure you want to delete {nVifs, number} VIF{nVifs, plural, one {} other {s}}?',
|
'Are you sure you want to delete {nVifs, number} VIF{nVifs, plural, one {} other {s}}?',
|
||||||
deleteSnapshotModalTitle: 'Delete snapshot',
|
deleteSnapshotModalTitle: 'Delete snapshot',
|
||||||
deleteSnapshotModalMessage: 'Are you sure you want to delete this snapshot?',
|
deleteSnapshotModalMessage: 'Are you sure you want to delete this snapshot?',
|
||||||
|
deleteSnapshotsModalTitle: 'Delete snapshot{nVms, plural, one {} other {s}}',
|
||||||
|
deleteSnapshotsModalMessage:
|
||||||
|
'Are you sure you want to delete {nVms, number} snapshot{nVms, plural, one {} other {s}}?',
|
||||||
revertVmModalMessage:
|
revertVmModalMessage:
|
||||||
'Are you sure you want to revert this VM to the snapshot state? This operation is irreversible.',
|
'Are you sure you want to revert this VM to the snapshot state? This operation is irreversible.',
|
||||||
revertVmModalSnapshotBefore: 'Snapshot before',
|
revertVmModalSnapshotBefore: 'Snapshot before',
|
||||||
|
@ -969,6 +969,20 @@ export const deleteSnapshot = vm =>
|
|||||||
noop
|
noop
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export const deleteSnapshots = vms =>
|
||||||
|
confirm({
|
||||||
|
title: _('deleteSnapshotsModalTitle', { nVms: vms.length }),
|
||||||
|
body: _('deleteSnapshotsModalMessage', { nVms: vms.length }),
|
||||||
|
}).then(
|
||||||
|
() =>
|
||||||
|
Promise.all(
|
||||||
|
map(vms, vm =>
|
||||||
|
_call('vm.delete', { id: resolveId(vm), delete_disks: true })
|
||||||
|
)
|
||||||
|
),
|
||||||
|
noop
|
||||||
|
)
|
||||||
|
|
||||||
import MigrateVmModalBody from './migrate-vm-modal' // eslint-disable-line import/first
|
import MigrateVmModalBody from './migrate-vm-modal' // eslint-disable-line import/first
|
||||||
export const migrateVm = (vm, host) =>
|
export const migrateVm = (vm, host) =>
|
||||||
confirm({
|
confirm({
|
||||||
|
@ -13,6 +13,7 @@ import { createGetObjectsOfType } from 'selectors'
|
|||||||
import {
|
import {
|
||||||
copyVm,
|
copyVm,
|
||||||
deleteSnapshot,
|
deleteSnapshot,
|
||||||
|
deleteSnapshots,
|
||||||
exportVm,
|
exportVm,
|
||||||
editVm,
|
editVm,
|
||||||
revertSnapshot,
|
revertSnapshot,
|
||||||
@ -66,6 +67,14 @@ const COLUMNS = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const GROUPED_ACTIONS = [
|
||||||
|
{
|
||||||
|
handler: deleteSnapshots,
|
||||||
|
icon: 'delete',
|
||||||
|
label: _('deleteSnapshots'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
const INDIVIDUAL_ACTIONS = [
|
const INDIVIDUAL_ACTIONS = [
|
||||||
{
|
{
|
||||||
handler: copyVm,
|
handler: copyVm,
|
||||||
@ -131,6 +140,7 @@ export default class TabSnapshot extends Component {
|
|||||||
<SortedTable
|
<SortedTable
|
||||||
collection={snapshots}
|
collection={snapshots}
|
||||||
columns={COLUMNS}
|
columns={COLUMNS}
|
||||||
|
groupedActions={GROUPED_ACTIONS}
|
||||||
individualActions={INDIVIDUAL_ACTIONS}
|
individualActions={INDIVIDUAL_ACTIONS}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
Loading…
Reference in New Issue
Block a user