feat(xo-web/backup-ng/new): generate default schedule if no sch… (#4183)
…edules specified Fixes #4036
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [Backup NG/New] Generate default schedule if no schedule is specified [#4036](https://github.com/vatesfr/xen-orchestra/issues/4036) (PR [#4183](https://github.com/vatesfr/xen-orchestra/pull/4183))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
@@ -186,20 +186,40 @@ export default decorate([
|
||||
}
|
||||
}
|
||||
|
||||
await createBackupNgJob({
|
||||
name: state.name,
|
||||
mode: state.isDelta ? 'delta' : 'full',
|
||||
compression: state.compression,
|
||||
schedules: mapValues(
|
||||
let schedules, settings
|
||||
if (!isEmpty(state.schedules)) {
|
||||
schedules = mapValues(
|
||||
state.schedules,
|
||||
({ id, ...schedule }) => schedule
|
||||
),
|
||||
settings: normalizeSettings({
|
||||
)
|
||||
settings = normalizeSettings({
|
||||
settings: state.settings,
|
||||
exportMode: state.exportMode,
|
||||
copyMode: state.copyMode,
|
||||
snapshotMode: state.snapshotMode,
|
||||
}).toObject(),
|
||||
}).toObject()
|
||||
} else {
|
||||
const id = generateId()
|
||||
schedules = {
|
||||
[id]: DEFAULT_SCHEDULE,
|
||||
}
|
||||
settings = {
|
||||
[id]: {
|
||||
copyRetention: state.copyMode ? DEFAULT_RETENTION : undefined,
|
||||
exportRetention: state.exportMode ? DEFAULT_RETENTION : undefined,
|
||||
snapshotRetention: state.snapshotMode
|
||||
? DEFAULT_RETENTION
|
||||
: undefined,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
await createBackupNgJob({
|
||||
name: state.name,
|
||||
mode: state.isDelta ? 'delta' : 'full',
|
||||
compression: state.compression,
|
||||
schedules,
|
||||
settings,
|
||||
remotes:
|
||||
state.deltaMode || state.backupMode
|
||||
? constructPattern(state.remotes)
|
||||
@@ -557,13 +577,16 @@ export default decorate([
|
||||
missingRemotes: state =>
|
||||
(state.backupMode || state.deltaMode) && isEmpty(state.remotes),
|
||||
missingSrs: state => (state.drMode || state.crMode) && isEmpty(state.srs),
|
||||
missingSchedules: state => isEmpty(state.schedules),
|
||||
missingExportRetention: state =>
|
||||
state.exportMode && !state.exportRetentionExists,
|
||||
missingCopyRetention: state =>
|
||||
state.copyMode && !state.copyRetentionExists,
|
||||
missingSnapshotRetention: state =>
|
||||
state.snapshotMode && !state.snapshotRetentionExists,
|
||||
missingSchedules: (state, { job }) =>
|
||||
job !== undefined && isEmpty(state.schedules),
|
||||
missingExportRetention: (state, { job }) =>
|
||||
job !== undefined && state.exportMode && !state.exportRetentionExists,
|
||||
missingCopyRetention: (state, { job }) =>
|
||||
job !== undefined && state.copyMode && !state.copyRetentionExists,
|
||||
missingSnapshotRetention: (state, { job }) =>
|
||||
job !== undefined &&
|
||||
state.snapshotMode &&
|
||||
!state.snapshotRetentionExists,
|
||||
exportMode: state => state.backupMode || state.deltaMode,
|
||||
copyMode: state => state.drMode || state.crMode,
|
||||
exportRetentionExists: createDoesRetentionExist('exportRetention'),
|
||||
|
||||
@@ -6,7 +6,7 @@ import SortedTable from 'sorted-table'
|
||||
import StateButton from 'state-button'
|
||||
import { Card, CardBlock, CardHeader } from 'card'
|
||||
import { injectState, provideState } from 'reaclette'
|
||||
import { isEmpty, find, size } from 'lodash'
|
||||
import { isEmpty, find } from 'lodash'
|
||||
|
||||
import { FormFeedback } from './../utils'
|
||||
|
||||
@@ -23,10 +23,9 @@ export default decorate([
|
||||
injectState,
|
||||
provideState({
|
||||
computed: {
|
||||
disabledDeletion: state => size(state.schedules) <= 1,
|
||||
error: state => find(FEEDBACK_ERRORS, error => state[error]),
|
||||
individualActions: (
|
||||
{ disabledDeletion, disabledEdition },
|
||||
{ disabledEdition },
|
||||
{ effects: { deleteSchedule, showScheduleModal } }
|
||||
) => [
|
||||
{
|
||||
@@ -37,7 +36,6 @@ export default decorate([
|
||||
level: 'primary',
|
||||
},
|
||||
{
|
||||
disabled: disabledDeletion,
|
||||
handler: deleteSchedule,
|
||||
icon: 'delete',
|
||||
label: _('scheduleDelete'),
|
||||
|
||||
Reference in New Issue
Block a user