fix(xo-server,xo-web): prevent backup concurrency from being <=0

Fixes #6338
This commit is contained in:
Julien Fontanet 2022-07-31 20:04:47 +02:00
parent 1c9552fa58
commit 26e7e6467c
2 changed files with 26 additions and 15 deletions

View File

@ -6,6 +6,23 @@ import createNdJsonStream from '../_createNdJsonStream.mjs'
import { REMOVE_CACHE_ENTRY } from '../_pDebounceWithKey.mjs' import { REMOVE_CACHE_ENTRY } from '../_pDebounceWithKey.mjs'
import { safeDateFormat } from '../utils.mjs' import { safeDateFormat } from '../utils.mjs'
const SCHEMA_SETTINGS = {
type: 'object',
properties: {
'*': {
type: 'object',
properties: {
concurrency: {
type: 'number',
gt: 0,
optional: true,
},
},
},
},
optional: true,
}
export function createJob({ schedules, ...job }) { export function createJob({ schedules, ...job }) {
job.userId = this.apiContext.user.id job.userId = this.apiContext.user.id
return this.createBackupNgJob(job, schedules).then(({ id }) => id) return this.createBackupNgJob(job, schedules).then(({ id }) => id)
@ -36,9 +53,7 @@ createJob.params = {
type: 'object', type: 'object',
optional: true, optional: true,
}, },
settings: { settings: SCHEMA_SETTINGS,
type: 'object',
},
srs: { srs: {
type: 'object', type: 'object',
optional: true, optional: true,
@ -91,10 +106,7 @@ editJob.params = {
type: 'object', type: 'object',
optional: true, optional: true,
}, },
settings: { settings: SCHEMA_SETTINGS,
type: 'object',
optional: true,
},
srs: { srs: {
type: 'object', type: 'object',
optional: true, optional: true,
@ -139,13 +151,7 @@ runJob.params = {
schedule: { schedule: {
type: 'string', type: 'string',
}, },
settings: { settings: SCHEMA_SETTINGS,
type: 'object',
properties: {
'*': { type: 'object' },
},
optional: true,
},
vm: { vm: {
type: 'string', type: 'string',
optional: true, optional: true,

View File

@ -957,7 +957,12 @@ const New = decorate([
<label htmlFor={state.inputConcurrencyId}> <label htmlFor={state.inputConcurrencyId}>
<strong>{_('concurrency')}</strong> <strong>{_('concurrency')}</strong>
</label> </label>
<Number id={state.inputConcurrencyId} onChange={effects.setConcurrency} value={concurrency} /> <Number
id={state.inputConcurrencyId}
min={1}
onChange={effects.setConcurrency}
value={concurrency}
/>
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<label htmlFor={state.inputTimeoutId}> <label htmlFor={state.inputTimeoutId}>