Skip to content
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

Merged
merged 1 commit into from
Aug 20, 2021

Conversation

kialam
Copy link
Member

@kialam kialam commented Aug 17, 2021

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:

rrule_validation

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • UI
AWX VERSION
19.3.0
ADDITIONAL INFORMATION

@@ -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",
Copy link
Member Author

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.`;
Copy link
Member

@keithjgrant keithjgrant Aug 18, 2021

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 ?

Copy link
Member

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... ?

Copy link
Member

@keithjgrant keithjgrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

Copy link
Contributor

@tiagodread tiagodread left a 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:

Screenshot from 2021-08-20 14-29-11

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

@kialam kialam merged commit c6a63d0 into ansible:devel Aug 20, 2021
@kialam kialam deleted the fix-10718-null-datetime branch August 20, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants