New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backup-ng/new): group saved & new schedules #3093
Conversation
@@ -47,14 +46,21 @@ import { FormFeedback, FormGroup, Input, Number, Ul, Li } from './utils' | |||
|
|||
const normaliseTagValues = values => resolveIds(values).map(value => [value]) | |||
|
|||
const normaliseCopyRentention = settings => { | |||
const normaliseCopyRetention = settings => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...getNewSettings({ | ||
schedules: state.newSchedules, | ||
...normaliseSettings({ | ||
settings: cloneDeep(state.settings), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to clone this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the function normalizeSettings
mutate the settings' properties in deep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, my bad 🙂
@@ -202,10 +178,10 @@ export default [ | |||
name: state.name, | |||
mode: state.isDelta ? 'delta' : 'full', | |||
compression: state.compression ? 'native' : '', | |||
schedules: getNewSchedules(state.newSchedules), | |||
schedules: normalizeSchedules(cloneDeep(state.schedules)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, this would be simpler:
schedules: mapValues(state.schedules, ({ id, ...schedule }) => schedule)
|
||
if (newSchedule === undefined) { | ||
return deleteSchedule(scheduleId) | ||
return deleteSchedule(id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is settings
correctly updated regarding this deletion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the effect deleteSchedule
update the schedules
and settings
vars.
) { | ||
return editSchedule({ | ||
id, | ||
jobId: props.job.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to send this property?
Can it change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, i will fix it.
}) | ||
if ( | ||
newSchedule.cron !== oldSchedule.cron || | ||
newSchedule.timezone !== oldSchedule.timezone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newSchedule
should simply contains the values that has been edited by the user.
const newSetting = settings[id] | ||
const settings = cloneDeep(state.settings) | ||
await Promise.all([ | ||
...map(state.schedules, async schedule => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why [...map()]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an error, i will fix it.
for (const id in oldSettings) { | ||
const oldSetting = oldSettings[id] | ||
const newSetting = settings[id] | ||
const settings = cloneDeep(state.settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need cloneDeep
?
Isn't { ...state.settings }
enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, my bad, due to the normalizeSettings
below.
See #2711
Check list
Fixes #007
)Process
WiP:
(Work in Progress) if not ready to be mergedList of packages to release