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 { 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 }) {
job.userId = this.apiContext.user.id
return this.createBackupNgJob(job, schedules).then(({ id }) => id)
@ -36,9 +53,7 @@ createJob.params = {
type: 'object',
optional: true,
},
settings: {
type: 'object',
},
settings: SCHEMA_SETTINGS,
srs: {
type: 'object',
optional: true,
@ -91,10 +106,7 @@ editJob.params = {
type: 'object',
optional: true,
},
settings: {
type: 'object',
optional: true,
},
settings: SCHEMA_SETTINGS,
srs: {
type: 'object',
optional: true,
@ -139,13 +151,7 @@ runJob.params = {
schedule: {
type: 'string',
},
settings: {
type: 'object',
properties: {
'*': { type: 'object' },
},
optional: true,
},
settings: SCHEMA_SETTINGS,
vm: {
type: 'string',
optional: true,

View File

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