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

Bug 1836902: validate event sources form and enable create button on yaml form #5479

Merged

Conversation

sahil143
Copy link
Contributor

Fixes: https://issues.redhat.com/browse/ODC-3591

Analysis / Root cause:

create button on the YAML form for event sources is disabled which should be enabled. yup validation was being called for other forms even when YAML form card was selected. For example: Initially ApiServeSource form is selected and when camel form(yaml form) card is clicked on form is switched to camel but the validation error from the ApiServerSource form remains because of which create button was disabled.

Solution Description:

fixed the yup validation by making it manual instead of being called through ValidationOnChange and ValidationOnBlur.

Screen shots / Gifs for design review:

Peek 2020-05-18 18-44

Unit test coverage report:

Test setup:

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels May 18, 2020
@openshift-ci-robot
Copy link
Contributor

@sahil143: This pull request references Bugzilla bug 1836902, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1836902: validate event sources form and enable create button on yaml form

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the component/knative Related to knative-plugin label May 18, 2020
@sahil143 sahil143 force-pushed the disable-submit-yaml branch 3 times, most recently from b35e24c to 5275820 Compare May 18, 2020 15:11
const handleItemChange = React.useCallback(
(item: string) => {
setErrors({});
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, to clear any validation error once another form is selected.

@invincibleJai
Copy link
Member

/test images

@invincibleJai
Copy link
Member

Thanks @sahil143, verified locally seems to work as expected.

@invincibleJai
Copy link
Member

/approve

/assign @rohitkrai03

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2020
@@ -33,6 +33,7 @@ const ApiServerSection: React.FC = () => {
Ref: 'Ref',
Resource: 'Resource',
};
useFormikValidationFix(values);
Copy link
Contributor

Choose a reason for hiding this comment

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

@sahil143 Instead of calling useFormikValidationFix in each section of the form, i think it would be better to called it once in EventSourceForm. Ultimately our goal is to trigger validateForm whenever anything inside values changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Will update this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the hook in EventSourceSection should work.

fix unit tests

fix lint error

fix unit tests

update validation
Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 19, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: invincibleJai, rohitkrai03, sahil143

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rohitkrai03
Copy link
Contributor

/retest

@openshift-merge-robot openshift-merge-robot merged commit d5bc402 into openshift:master May 19, 2020
@openshift-ci-robot
Copy link
Contributor

@sahil143: All pull requests linked via external trackers have merged: openshift/console#5479. Bugzilla bug 1836902 has been moved to the MODIFIED state.

In response to this:

Bug 1836902: validate event sources form and enable create button on yaml form

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.5 milestone May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/knative Related to knative-plugin lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants