-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update validation text msg for legacy name fields #718
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,10 +106,10 @@ export enum StepType { | |
|
||
export const dnsLabelNameSchema = yup | ||
.string() | ||
.max(63) | ||
.matches(/^(?=.{1,253}$)[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/, { | ||
.max(253) | ||
.matches(/^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was nice to keep the exact regexp as the new code, but this works too, for next time, please keep changes in the legacy code to minimum. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yaacov Please note that without this fix:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
63 id fine, this code is working since the begining, it hasn't bothered anyone until now, and will not in the future.
that is fine too, name is good enough, again this code worked from the first version of this application. note: on the other hand, we should not touch the legacy code, we don't want to maintain it, and every change we do, means we own the new code change and need to maintain it. |
||
message: ({ label }) => | ||
`${label} can only contain lowercase alphanumeric characters, dashes and dots, and must start and end with an alphanumeric character, see k8s documentation for more details.`, | ||
`${label} must be a valid Kubernetes name (i.e., must contain no more than 253 characters, consists of lower case alphanumeric characters , '-' or '.' and starts and ends with an alphanumeric character).`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oww, didn't notice the , I'll remove it in a folowup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm missing the "for more information see k8s documention" I'll add it in a folowup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not added for the provider name error message. I think we should try being consisted. Once we say In separate PRs :) |
||
excludeEmptyString: 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.
For future reference, please do minimal changes when fixing the legacy code, this change can be avoided.
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.
@yaacov Without this change, the error message will not include the entity name, i.e. it will be displayed for mapping field as "Name should be..." instead of "Mapping name should be..."
For Plan and namespace it was already set, so it's nicer to do the same for mapping as well.
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.
yes, but this is the legacy code, we should not touch it if we don't need to, in this case we don't need to.