Skip to content

Commit

Permalink
fix(tasks): clear existing task schedule when changing types
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirieGray committed Mar 20, 2019
1 parent 160fa26 commit 7c22be9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ui/src/tasks/reducers/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ export default (state: State = defaultState, action: Action): State => {
case 'SET_TASK_OPTION':
const {key, value} = action.payload

if (key === 'taskScheduleType') {
if (value === TaskSchedule.cron) {
return {
...state,
taskOptions: {...state.taskOptions, interval: '', [key]: value},
}
} else if (value === TaskSchedule.interval) {
return {
...state,
taskOptions: {...state.taskOptions, cron: '', [key]: value},
}
}
}

return {
...state,
taskOptions: {...state.taskOptions, [key]: value},
Expand Down

0 comments on commit 7c22be9

Please sign in to comment.