feat(xo-web/backup-ng/new): remove previous backups first (#3260)

Fixes #3212
This commit is contained in:
badrAZ 2018-08-08 14:32:28 +02:00 committed by Pierre Donias
parent dff342d2bd
commit e29ba3e0cf
3 changed files with 53 additions and 17 deletions

View File

@ -12,6 +12,7 @@
- [Health / Alarms] Homogenize action buttons in table and enable bulk deletion [#3179](https://github.com/vatesfr/xen-orchestra/issues/3179) (PR [#3271](https://github.com/vatesfr/xen-orchestra/pull/3271))
- [Backup NG Overview] List the Backup NG job's modes [#3169](https://github.com/vatesfr/xen-orchestra/issues/3169) (PR [#3277](https://github.com/vatesfr/xen-orchestra/pull/3277))
- [Backup NG form] Move "Use compression" checkbox in the advanced settings [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) (PR [#3281](https://github.com/vatesfr/xen-orchestra/pull/3281))
- [Backup NG form] Ability to remove previous backups first before backup the VMs [#3212](https://github.com/vatesfr/xen-orchestra/issues/3212) (PR [#3260](https://github.com/vatesfr/xen-orchestra/pull/3260))
### Bug fixes

View File

@ -426,7 +426,9 @@ const messages = {
editBackupScheduleEnabled: 'Automatically run as scheduled',
editBackupRetentionTitle: 'Retention',
editBackupRemoteTitle: 'Remote',
deleteOldBackupsFirst: 'Delete the old backups first',
deleteOldBackupsFirst: 'Delete first',
deleteOldBackupsFirstMessage:
'Delete old backups before backuping the VMs. If the new backup fails, you will lose your old backups.',
// ------ New Remote -----
remoteList: 'Remote stores for backup',

View File

@ -136,6 +136,19 @@ const getInitialState = () => ({
vms: [],
})
const DeleteOldBackupsFirst = ({ handler, handlerParam, value }) => (
<ActionButton
handler={handler}
handlerParam={handlerParam}
icon={value ? 'toggle-on' : 'toggle-off'}
iconColor={value ? 'text-success' : undefined}
size='small'
tooltip={_('deleteOldBackupsFirstMessage')}
>
{_('deleteOldBackupsFirst')}
</ActionButton>
)
export default [
New => props => (
<Upgrade place='newBackup' required={2}>
@ -291,6 +304,14 @@ export default [
...state,
name: value,
}),
setTargetDeleteFirst: (_, id) => ({
propSettings,
settings = propSettings,
}) => ({
settings: settings.set(id, {
deleteFirst: !settings.getIn([id, 'deleteFirst']),
}),
}),
addRemote: (_, remote) => state => {
return {
...state,
@ -717,14 +738,20 @@ export default [
type: 'remote',
value: remotesById[id],
})}
<ActionButton
btnStyle='danger'
className='pull-right'
handler={effects.deleteRemote}
handlerParam={key}
icon='delete'
size='small'
/>
<div className='pull-right'>
<DeleteOldBackupsFirst
handler={effects.setTargetDeleteFirst}
handlerParam={id}
value={settings.getIn([id, 'deleteFirst'])}
/>{' '}
<ActionButton
btnStyle='danger'
handler={effects.deleteRemote}
handlerParam={key}
icon='delete'
size='small'
/>
</div>
</Li>
))}
</Ul>
@ -760,14 +787,20 @@ export default [
{map(state.srs, (id, key) => (
<Li key={id}>
{renderXoItemFromId(id)}
<ActionButton
btnStyle='danger'
className='pull-right'
icon='delete'
size='small'
handler={effects.deleteSr}
handlerParam={key}
/>
<div className='pull-right'>
<DeleteOldBackupsFirst
handler={effects.setTargetDeleteFirst}
handlerParam={id}
value={settings.getIn([id, 'deleteFirst'])}
/>{' '}
<ActionButton
btnStyle='danger'
icon='delete'
size='small'
handler={effects.deleteSr}
handlerParam={key}
/>
</div>
</Li>
))}
</Ul>