Skip to content

Commit

Permalink
fix schedule validation errors not clearing after selecting run now (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq authored Nov 2, 2022
1 parent f1afc63 commit 77570d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/components/create-schedule-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,26 @@ export function CreateScheduleOptions(
// so that in case there's an error with the schedule,
// the form can still be submitted.
if (value === 'Job') {
// Change from 'JobDefinition'
// Change from 'JobDefinition' and clear all job definition specific errors
props.handleErrorsChange({
...props.errors,
schedule: ''
schedule: '',
scheduleInterval: '',
timezone: '',
scheduleHourMinute: '',
scheduleMinute: '',
scheduleHour: '',
scheduleMonthDay: '',
scheduleWeekDay: '',
scheduleTime: ''
});
}
if (value === 'JobDefinition') {
if (value === 'JobDefinition' && props.model.schedule) {
// If the schedule is not populated, don't display an error for now.
if (props.model.schedule) {
props.handleErrorsChange({
...props.errors,
schedule: validator.validateSchedule(props.model.schedule)
});
}
props.handleErrorsChange({
...props.errors,
schedule: validator.validateSchedule(props.model.schedule)
});
}

props.handleModelChange({ ...props.model, [name]: value });
Expand Down
1 change: 1 addition & 0 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type ModelWithScheduleFields = {
scheduleMonthDayInput?: string;
scheduleMonthDay?: number;
scheduleWeekDay?: string;
scheduleTime?: number;
};

export interface ICreateJobModel
Expand Down

0 comments on commit 77570d8

Please sign in to comment.