-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Validate that start/end datetime creates at least 1 schedule. #10898
Conversation
339cc16
to
5089d6f
Compare
@@ -29,7 +29,7 @@ | |||
"react-error-boundary": "^3.1.3", | |||
"react-router-dom": "^5.1.2", | |||
"react-virtualized": "^9.21.1", | |||
"rrule": "^2.6.4", | |||
"rrule": "2.6.4", |
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.
Pinning rrule
due to a known bug with v2.6.6 and higher: jkbrzt/rrule#427
) { | ||
const rule = new RRule(buildRuleObj(values)); | ||
if (rule.all().length === 0) { | ||
errors.startDate = t`Please select a valid start and end date/time.`; |
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.
Can we make the error message a little more informative? Maybe something like "Selected frequency does not occur between start and end dates". Thoughts on this one, @trahman73 ?
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 would also be nice to add this one as a form-level error, rather than field-level on the startDate... though I don't remember the specifics of how we normally do that... ?
5089d6f
to
3a1eae1
Compare
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.
nice work!
3a1eae1
to
da2bf4c
Compare
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.
This is now showing the error message properly when there is no occurrence between start/end date avoiding the user to save the form:
Note: for users who saved the schedule previusly in this scenario will see an error on console until they update the schedule dates.
parseoptions.ts:19 Uncaught (in promise) Error: Invalid options: dtstart
SUMMARY
Related #10718
Include client-side validation for when a user is about to create a schedule set that has no entries. E.g. a schedule that repeats every Sunday however the start and end dates are Mon-Tues will result in an empty schedules list. We now show them a form error if such a scenario is encountered:
ISSUE TYPE
COMPONENT NAME
AWX VERSION
ADDITIONAL INFORMATION