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 1838065: Add validation for the app name length (max 63 characters) #5503

Conversation

jerolimov
Copy link
Member

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:
before

After:
after

Unit test coverage report:
Did not change any test.

Test setup:

  1. Switch into the Developer console
  2. Select Add+ > Container Image
  3. Under General > Application Name select "Create Application"
  4. Enter a long application name into the text field "Name". (More than 63 characters)

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

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

@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
  • 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 1838065: Add validation for the app name length (max 63 characters)

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.

@sahil143
Copy link
Contributor

/cc @serenamarie125 @beaumorley @openshift/team-devconsole-ux

Comment on lines 37 to 42
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'),
Copy link
Contributor

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
Screenshot from 2020-05-20 22-41-27

Copy link
Member Author

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.

Copy link
Contributor

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.

@jerolimov jerolimov force-pushed the add-appname-length-validation branch from 8bf3ace to 95d0360 Compare May 21, 2020 16:30
@jerolimov jerolimov requested a review from sahil143 May 21, 2020 16:31
Copy link
Contributor

@sahil143 sahil143 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 21, 2020
@jerolimov
Copy link
Member Author

/assign @andrewballantyne

@invincibleJai
Copy link
Member

/assign @invincibleJai

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.

/approve

@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 27, 2020
@invincibleJai
Copy link
Member

/lgtm

@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

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

@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:

Bug 1838065: Add validation for the app name length (max 63 characters)

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 28, 2020
@jerolimov jerolimov deleted the add-appname-length-validation branch August 7, 2023 11:19
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-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/dev-console Related to dev-console 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

9 participants