feat(xo-web/home/vm): add "Create backup" bulk action (#4257)

Fixes #2573
This commit is contained in:
HamadaBrest
2019-06-21 10:36:00 +02:00
committed by Pierre Donias
parent 2388593b8a
commit a3e4253005
6 changed files with 49 additions and 23 deletions

View File

@@ -6,6 +6,7 @@
- [Sr/new] Ability to select NFS version when creating NFS storage [#3951](https://github.com/vatesfr/xen-orchestra/issues/3951) (PR [#4277](https://github.com/vatesfr/xen-orchestra/pull/4277))
- [auth-saml] Improve compatibility with Microsoft Azure Active Directory (PR [#4294](https://github.com/vatesfr/xen-orchestra/pull/4294))
- [Host] Display warning when "Citrix Hypervisor" license has restrictions [#4251](https://github.com/vatesfr/xen-orchestra/issues/4164) (PR [#4235](https://github.com/vatesfr/xen-orchestra/pull/4279))
- [VM/Backup] Create backup bulk action [#2573](https://github.com/vatesfr/xen-orchestra/issues/2573) (PR [#4257](https://github.com/vatesfr/xen-orchestra/pull/4257))
### Bug fixes

View File

@@ -676,6 +676,7 @@ const messages = {
cloneVmLabel: 'Clone',
fastCloneVmLabel: 'Fast clone',
vmConsoleLabel: 'Console',
backupLabel: 'Backup',
// ----- SR advanced tab -----

View File

@@ -53,3 +53,7 @@ export const setXoaConfiguration = createAction(
'XOA_CONFIGURATION',
configuration => configuration
)
export const setHomeVmIdsSelection = createAction(
'SET_HOME_VM_IDS_SELECTION',
homeVmIdsSelection => homeVmIdsSelection
)

View File

@@ -86,6 +86,12 @@ export default {
}
),
// These IDs are used temporarily to be preselected in backup-ng/new/vms
homeVmIdsSelection: combineActionHandlers([], {
[actions.setHomeVmIdsSelection]: (_, homeVmIdsSelection) =>
homeVmIdsSelection,
}),
objects: combineActionHandlers(
{
all: {}, // Mutable for performance!

View File

@@ -120,28 +120,31 @@ const createDoesRetentionExist = name => {
return ({ propSettings, settings = propSettings }) => settings.some(predicate)
}
const getInitialState = () => ({
_displayAdvancedSettings: undefined,
_vmsPattern: undefined,
backupMode: false,
compression: undefined,
crMode: false,
deltaMode: false,
drMode: false,
name: '',
paramsUpdated: false,
remotes: [],
schedules: {},
settings: undefined,
showErrors: false,
smartMode: false,
snapshotMode: false,
srs: [],
tags: {
notValues: ['Continuous Replication', 'Disaster Recovery', 'XOSAN'],
},
vms: [],
})
const getInitialState = ({ preSelectedVmIds, setHomeVmIdsSelection }) => {
setHomeVmIdsSelection([]) // Clear preselected vmIds
return {
_displayAdvancedSettings: undefined,
_vmsPattern: undefined,
backupMode: false,
compression: undefined,
crMode: false,
deltaMode: false,
drMode: false,
name: '',
paramsUpdated: false,
remotes: [],
schedules: {},
settings: undefined,
showErrors: false,
smartMode: false,
snapshotMode: false,
srs: [],
tags: {
notValues: ['Continuous Replication', 'Disaster Recovery', 'XOSAN'],
},
vms: preSelectedVmIds,
}
}
const DeleteOldBackupsFirst = ({ handler, handlerParam, value }) => (
<ActionButton
@@ -169,6 +172,7 @@ export default decorate([
hostsById: createGetObjectsOfType('host'),
poolsById: createGetObjectsOfType('pool'),
srsById: createGetObjectsOfType('SR'),
preSelectedVmIds: state => state.homeVmIdsSelection,
})),
injectIntl,
provideState({

View File

@@ -178,6 +178,14 @@ const OPTIONS = {
icon: 'vm-snapshot',
labelId: 'snapshotVmLabel',
},
{
handler: (vmIds, _, { setHomeVmIdsSelection }, { router }) => {
setHomeVmIdsSelection(vmIds)
router.push('backup-ng/new/vms')
},
icon: 'backup',
labelId: 'backupLabel',
},
{
handler: deleteVms,
icon: 'vm-delete',
@@ -1010,7 +1018,9 @@ export default class Home extends Component {
onClick={() => {
action.handler(
this._getSelectedItemsIds(),
action.params
action.params,
this.props,
this.context
)
}}
>