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 1829445: Fixes: Container image does not validate dynamically #5231
Bug 1829445: Fixes: Container image does not validate dynamically #5231
Conversation
@sahil143: This pull request references Bugzilla bug 1829445, 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
In response to this:
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. |
kind: 'DockerImage', | ||
name: _.trim(searchTermImage), | ||
const handleSearch = React.useCallback( | ||
_.debounce((newValues: any) => { |
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.
nit: type here
921bc0a
to
b0543ed
Compare
@@ -151,8 +136,8 @@ const ImageSearch: React.FC = () => { | |||
helpText={getHelpText()} | |||
helpTextInvalid={helpTextInvalid} | |||
validated={validated} | |||
onBlur={() => { | |||
handleSearch(); | |||
onKeyUp={() => { |
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.
Why not use onChange
here?
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.
fixed
b0543ed
to
290f902
Compare
@@ -125,10 +120,6 @@ const ImageSearch: React.FC = () => { | |||
<span>{values.searchTerm === '' ? 'Required' : values.isi.status?.message}</span> | |||
); | |||
|
|||
React.useEffect(() => { |
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 would break edit application scenario. We need this logic here.
onBlur={() => { | ||
handleSearch(); | ||
onChange={(e: KeyboardEvent) => { | ||
handleSearch((e.target as HTMLInputElement).value); | ||
setFieldTouched('searchTerm', true); |
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.
Pretty sure you don't need to do that now since default onBlur
on the field will handle this.
|
||
const handleSave = (name: string) => { | ||
setNewImageSecret(name); | ||
values.searchTerm && handleSearch(); |
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.
I think this one is being used to trigger the validation again when a pull secret is added. So we need this one as well.
290f902
to
3ca0209
Compare
/assign |
The gif looks odd to me. Secondly as soon as the user inputs a value which no longer matches that which is currently validating or that which has already errored I think that the helper text should be cleared immediately. Please involve UX for approval. |
/cc @serenamarie125 @beaumorley @openshift/team-devconsole-ux |
5033c43
to
355ac27
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.
/lgtm
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 looks great thanks @sahil143 !
/lgtm cancel I can submit the form after immediately changing the image name to something that is invalid. The form submits with the previous valid value. The field state should be immediately invalidated on change of the image name value. |
Fixed. @christianvogt Please review again |
18f2bcb
to
fe8095b
Compare
@sahil143 while the create button is properly disabled, the helper text remains while typing. This helper text should also be cleared. |
fe8095b
to
705578a
Compare
fixed! |
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.
I also noticed that after entering a valid image, then changing to a new valid image, the old app name and name values remain which no longer coincide with the new image. They should be modified again if the user never touched those fields. I'm ok if we tackle this in a new issue though
handleSearch(); | ||
setFieldTouched('searchTerm', true); | ||
onChange={(e: KeyboardEvent) => { | ||
setFieldValue('disableSubmit', true); |
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.
I really don't think this field is necessary. We were able to have a disabled submit button without it. You should be resetting the values previously set by the error or success conditions. See what is done in the catch
of the search.
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.
disabled submit button is based on only two props i.e. dirty
and errors
. Not sure how we can disable the button based on these and in catch block we are only setting the image stream data to empty values and error.
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.
The submit button disabled state is controlled by the validation of the form data. By deleting the required image values the form will be in an invalid state, thereby disabling the submit button.
By not having a valid image, the submit button will be disabled. So setting the values back to empty (as they were on initializing the form) and any other state necessary, we get the desired outcome.
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.
We can remove the disableSubmit
prop from everywhere and here we can set setFieldValue('isi', {});
so the form will be disabled when user starts to type and if there is no valid image in the isi
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.
fixed!
705578a
to
bf17a1c
Compare
fixed! added a method to reset the fields based on form type |
/bugzilla refresh |
@abhi-kn: This pull request references Bugzilla bug 1829445, which is valid. 3 validation(s) were run on this bug
In response to this:
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. |
…lidates fix changes
bf17a1c
to
468ff5c
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: beaumorley, christianvogt, rohitkrai03, sahil143, serenamarie125 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 |
@sahil143: All pull requests linked via external trackers have merged: openshift/console#5231. Bugzilla bug 1829445 has been moved to the MODIFIED state. In response to this:
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. |
Fixes: https://issues.redhat.com/browse/ODC-3178
Analysis / Root cause:
container image validation only happens on blur, which caused some issue
Solution Description:
enable image validation while user types
Screen shots / Gifs for design review:
Unit test coverage report:
Test setup:
Browser conformance: