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 1838065: Add validation for the app name length (max 63 characters) #5503
Bug 1838065: Add validation for the app name length (max 63 characters) #5503
Conversation
@jerolimov: This pull request references Bugzilla bug 1838065, 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. |
/cc @serenamarie125 @beaumorley @openshift/team-devconsole-ux |
name: yup.string().when('selectedKey', { | ||
is: CREATE_APPLICATION_KEY, | ||
then: yup.string().required('Required'), | ||
then: yup | ||
.string() | ||
.max(63, 'Cannot be longer than 63 characters.') | ||
.required('Required'), |
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.
@jerolimov This would only work when we already have an application and CREATE_APPLICATION_KEY is selected from the dropdown. For this to work properly please remove when
block validation and simply add max
name: yup.string().max(63, 'Cannot be longer than 63 characters.').required('Required'),
Currently, this is not working if there are no applications in the project
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.
@sahil143 You're right, adding the max check to the when condition was wrong, because it ignores the case that there is "no application available, yet".
But removing the when condition would remove the required check when there is already an application available. I think this time this matches all cases
- No app is available:
- Show a text input field. Input is not required, but max length is validated.
- An app is available:
- Select an existing app works
- If the user selected create new app -> Input is required (max length also)
- Unassigned -> Text field was not shown, so input is not required.
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.
Agreed! This will work properly.
8bf3ace
to
95d0360
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
/assign @andrewballantyne |
/assign @invincibleJai |
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.
/approve
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: invincibleJai, jerolimov, 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 |
/retest Please review the full test history for this PR and help us cut down flakes. |
@jerolimov: All pull requests linked via external trackers have merged: openshift/console#5503. Bugzilla bug 1838065 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-2510
Analysis / Root cause:
Form does not validate application name length.
Solution Description:
Extend the form validation from "required string" to "required string, max 63. charachters".
Screen shots / Gifs for design review:
Before:
After:
Unit test coverage report:
Did not change any test.
Test setup:
Browser conformance: