feat(xo-web/backup-ng/new): ability to edit a schedule's name (#3143)
See #2711 Fixes #3071
This commit is contained in:
parent
eff38b9aee
commit
0ed1df3af6
@ -7,6 +7,7 @@
|
|||||||
- Export VDI content [#2432](https://github.com/vatesfr/xen-orchestra/issues/2432) (PR [#3194](https://github.com/vatesfr/xen-orchestra/pull/3194))
|
- Export VDI content [#2432](https://github.com/vatesfr/xen-orchestra/issues/2432) (PR [#3194](https://github.com/vatesfr/xen-orchestra/pull/3194))
|
||||||
- Search syntax support wildcard (`*`) and regular expressions [#3190](https://github.com/vatesfr/xen-orchestra/issues/3190) (PRs [#3198](https://github.com/vatesfr/xen-orchestra/pull/3198) & [#3199](https://github.com/vatesfr/xen-orchestra/pull/3199))
|
- Search syntax support wildcard (`*`) and regular expressions [#3190](https://github.com/vatesfr/xen-orchestra/issues/3190) (PRs [#3198](https://github.com/vatesfr/xen-orchestra/pull/3198) & [#3199](https://github.com/vatesfr/xen-orchestra/pull/3199))
|
||||||
- Import VDI content [#2432](https://github.com/vatesfr/xen-orchestra/issues/2432) (PR [#3216](https://github.com/vatesfr/xen-orchestra/pull/3216))
|
- Import VDI content [#2432](https://github.com/vatesfr/xen-orchestra/issues/2432) (PR [#3216](https://github.com/vatesfr/xen-orchestra/pull/3216))
|
||||||
|
- [Backup NG form] Ability to edit a schedule's name [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) [#3071](https://github.com/vatesfr/xen-orchestra/issues/3071) (PR [#3143](https://github.com/vatesfr/xen-orchestra/pull/3143))
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
|
@ -227,11 +227,13 @@ export default [
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
newSchedule.cron !== oldSchedule.cron ||
|
newSchedule.cron !== oldSchedule.cron ||
|
||||||
|
newSchedule.name !== oldSchedule.name ||
|
||||||
newSchedule.timezone !== oldSchedule.timezone
|
newSchedule.timezone !== oldSchedule.timezone
|
||||||
) {
|
) {
|
||||||
return editSchedule({
|
return editSchedule({
|
||||||
id,
|
id,
|
||||||
cron: newSchedule.cron,
|
cron: newSchedule.cron,
|
||||||
|
name: newSchedule.name,
|
||||||
timezone: newSchedule.timezone,
|
timezone: newSchedule.timezone,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -245,6 +247,7 @@ export default [
|
|||||||
if (props.schedules[tmpId] === undefined) {
|
if (props.schedules[tmpId] === undefined) {
|
||||||
const { id } = await createSchedule(props.job.id, {
|
const { id } = await createSchedule(props.job.id, {
|
||||||
cron: schedule.cron,
|
cron: schedule.cron,
|
||||||
|
name: schedule.name,
|
||||||
timezone: schedule.timezone,
|
timezone: schedule.timezone,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -408,8 +411,16 @@ export default [
|
|||||||
},
|
},
|
||||||
saveSchedule: (
|
saveSchedule: (
|
||||||
_,
|
_,
|
||||||
{ cron, timezone, exportRetention, copyRetention, snapshotRetention }
|
{
|
||||||
|
copyRetention,
|
||||||
|
cron,
|
||||||
|
exportRetention,
|
||||||
|
name,
|
||||||
|
snapshotRetention,
|
||||||
|
timezone,
|
||||||
|
}
|
||||||
) => async (state, props) => {
|
) => async (state, props) => {
|
||||||
|
name = name !== undefined && name.trim() === '' ? undefined : name
|
||||||
if (state.editionMode === 'creation') {
|
if (state.editionMode === 'creation') {
|
||||||
const id = generateRandomId()
|
const id = generateRandomId()
|
||||||
return {
|
return {
|
||||||
@ -418,8 +429,9 @@ export default [
|
|||||||
schedules: {
|
schedules: {
|
||||||
...state.schedules,
|
...state.schedules,
|
||||||
[id]: {
|
[id]: {
|
||||||
id,
|
|
||||||
cron,
|
cron,
|
||||||
|
id,
|
||||||
|
name,
|
||||||
timezone,
|
timezone,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -441,6 +453,7 @@ export default [
|
|||||||
schedules[id] = {
|
schedules[id] = {
|
||||||
...schedules[id],
|
...schedules[id],
|
||||||
cron,
|
cron,
|
||||||
|
name,
|
||||||
timezone,
|
timezone,
|
||||||
}
|
}
|
||||||
settings[id] = {
|
settings[id] = {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import _ from 'intl'
|
import _ from 'intl'
|
||||||
import ActionButton from 'action-button'
|
import ActionButton from 'action-button'
|
||||||
|
import defined from 'xo-defined'
|
||||||
import moment from 'moment-timezone'
|
import moment from 'moment-timezone'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Scheduler, { SchedulePreview } from 'scheduling'
|
import Scheduler, { SchedulePreview } from 'scheduling'
|
||||||
@ -9,7 +10,7 @@ import { injectState, provideState } from '@julien-f/freactal'
|
|||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { Number } from 'form'
|
import { Number } from 'form'
|
||||||
|
|
||||||
import { FormFeedback, FormGroup } from './utils'
|
import { FormFeedback, FormGroup, Input } from './utils'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
injectState,
|
injectState,
|
||||||
@ -26,10 +27,12 @@ export default [
|
|||||||
timezone = moment.tz.guess(),
|
timezone = moment.tz.guess(),
|
||||||
},
|
},
|
||||||
}) => ({
|
}) => ({
|
||||||
|
copyRetention,
|
||||||
cron,
|
cron,
|
||||||
exportRetention,
|
exportRetention,
|
||||||
copyRetention,
|
|
||||||
formId: generateRandomId(),
|
formId: generateRandomId(),
|
||||||
|
idInputName: generateRandomId(),
|
||||||
|
name: undefined,
|
||||||
snapshotRetention,
|
snapshotRetention,
|
||||||
timezone,
|
timezone,
|
||||||
}),
|
}),
|
||||||
@ -51,6 +54,9 @@ export default [
|
|||||||
cron: cronPattern,
|
cron: cronPattern,
|
||||||
timezone,
|
timezone,
|
||||||
}),
|
}),
|
||||||
|
setName: (_, { target: { value } }) => () => ({
|
||||||
|
name: value,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isScheduleInvalid: ({ retentionNeeded, scheduleNotEdited }) =>
|
isScheduleInvalid: ({ retentionNeeded, scheduleNotEdited }) =>
|
||||||
@ -70,10 +76,11 @@ export default [
|
|||||||
),
|
),
|
||||||
scheduleNotEdited: (
|
scheduleNotEdited: (
|
||||||
{
|
{
|
||||||
|
copyRetention,
|
||||||
cron,
|
cron,
|
||||||
editionMode,
|
editionMode,
|
||||||
exportRetention,
|
exportRetention,
|
||||||
copyRetention,
|
name,
|
||||||
snapshotRetention,
|
snapshotRetention,
|
||||||
timezone,
|
timezone,
|
||||||
},
|
},
|
||||||
@ -82,16 +89,18 @@ export default [
|
|||||||
editionMode !== 'creation' &&
|
editionMode !== 'creation' &&
|
||||||
isEqual(
|
isEqual(
|
||||||
{
|
{
|
||||||
|
copyRetention: schedule.copyRetention,
|
||||||
cron: schedule.cron,
|
cron: schedule.cron,
|
||||||
exportRetention: schedule.exportRetention,
|
exportRetention: schedule.exportRetention,
|
||||||
copyRetention: schedule.copyRetention,
|
name: schedule.name,
|
||||||
snapshotRetention: schedule.snapshotRetention,
|
snapshotRetention: schedule.snapshotRetention,
|
||||||
timezone: schedule.timezone,
|
timezone: schedule.timezone,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
copyRetention,
|
||||||
cron,
|
cron,
|
||||||
exportRetention,
|
exportRetention,
|
||||||
copyRetention,
|
name,
|
||||||
snapshotRetention,
|
snapshotRetention,
|
||||||
timezone,
|
timezone,
|
||||||
}
|
}
|
||||||
@ -107,6 +116,16 @@ export default [
|
|||||||
message={_('retentionNeeded')}
|
message={_('retentionNeeded')}
|
||||||
>
|
>
|
||||||
<CardBlock>
|
<CardBlock>
|
||||||
|
<FormGroup>
|
||||||
|
<label htmlFor={state.idInputName}>
|
||||||
|
<strong>{_('formName')}</strong>
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
id={state.idInputName}
|
||||||
|
onChange={effects.setName}
|
||||||
|
value={defined(state.name, state.tmpSchedule.name, '')}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
{state.exportMode && (
|
{state.exportMode && (
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<label>
|
<label>
|
||||||
@ -152,9 +171,10 @@ export default [
|
|||||||
<br />
|
<br />
|
||||||
<ActionButton
|
<ActionButton
|
||||||
btnStyle='primary'
|
btnStyle='primary'
|
||||||
|
data-copyRetention={state.copyRetention}
|
||||||
data-cron={state.cron}
|
data-cron={state.cron}
|
||||||
data-exportRetention={state.exportRetention}
|
data-exportRetention={state.exportRetention}
|
||||||
data-copyRetention={state.copyRetention}
|
data-name={state.name}
|
||||||
data-snapshotRetention={state.snapshotRetention}
|
data-snapshotRetention={state.snapshotRetention}
|
||||||
data-timezone={state.timezone}
|
data-timezone={state.timezone}
|
||||||
disabled={state.isScheduleInvalid}
|
disabled={state.isScheduleInvalid}
|
||||||
|
Loading…
Reference in New Issue
Block a user