Skip to content

Commit

Permalink
feat(xo-web): merge backups synchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-m-dev committed Dec 5, 2024
1 parent d67a2ad commit 5d3c98b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const MixinRemoteWriter = (BaseClass = Object) =>
const { disableMergeWorker } = this._config
// merge worker only compatible with local remotes
const { handler } = this._adapter
const willMergeInWorker = !disableMergeWorker && typeof handler.getRealPath === 'function'

const synchronousMerge = this._settings.mergeBackupSynchronouslyTpl === 'compactMjml'
const willMergeInWorker = !synchronousMerge && !disableMergeWorker && typeof handler.getRealPath === 'function'
const { merge } = await this._cleanVm({ remove: true, merge: !willMergeInWorker })
await this.#lock.dispose()

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

> Users must be able to say: “Nice enhancement, I'm eager to test it”
- [Backups/Advanced settings] Add merge backups synchronously (PR [#8177](https://github.com/vatesfr/xen-orchestra/pull/8177))

### Bug fixes

> Users must be able to say: “I had this issue, happy to know it's fixed”
Expand All @@ -31,7 +33,9 @@
<!--packages-start-->

- @xen-orchestra/backups minor
- @xen-orchestra/web patch
- @xen-orchestra/web-core minor
- xo-web minor

<!--packages-end-->
1 change: 1 addition & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ const messages = {
reportRecipients: 'Report recipients',
reportWhen: 'Report when',
concurrency: 'Concurrency',
mergeBackupsSynchronously: 'Merge backups synchronously',
newBackupSelection: 'Select your backup type:',
snapshotRetention: 'Snapshot retention',
backupName: 'Name',
Expand Down
18 changes: 18 additions & 0 deletions packages/xo-web/src/xo-app/backup/new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,11 @@ const New = decorate([
backupReportTpl: compactBackupTpl ? 'compactMjml' : 'mjml',
})
},
setMergeBackupsSynchronouslyTpl({ setGlobalSettings }, compactMergeTpl) {
setGlobalSettings({
mergeBackupSynchronouslyTpl: compactMergeTpl ? 'compactMjml' : 'mjml',
})
},
},
computed: {
compressionId: generateId,
Expand All @@ -711,6 +716,7 @@ const New = decorate([
inputNbdConcurrency: generateId,
inputNRetriesVmBackupFailures: generateId,
inputBackupReportTplId: generateId,
inputMergeBackupsSynchronously: generateId,
inputTimeoutId: generateId,
inputLongTermRetentionDaily: generateId,
inputLongTermRetentionWeekly: generateId,
Expand Down Expand Up @@ -836,6 +842,7 @@ const New = decorate([
reportRecipients,
reportWhen = 'failure',
backupReportTpl = 'mjml',
mergeBackupSynchronouslyTpl = 'mjml',
timeout,
} = settings.get('') || {}

Expand Down Expand Up @@ -1230,6 +1237,17 @@ const New = decorate([
onChange={effects.setBackupReportTpl}
/>
</FormGroup>
<FormGroup>
<label htmlFor={state.inputMergeBackupsSynchronously}>
<strong>{_('mergeBackupsSynchronously')}</strong>
</label>
<Toggle
className='pull-right'
id={state.inputMergeBackupsSynchronously}
value={mergeBackupSynchronouslyTpl === 'compactMjml'}
onChange={effects.setMergeBackupsSynchronouslyTpl}
/>
</FormGroup>
</div>
)}
</CardBlock>
Expand Down

0 comments on commit 5d3c98b

Please sign in to comment.