-
Notifications
You must be signed in to change notification settings - Fork 16
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
Task/t UI 336 create user credential #404
Conversation
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.
Unfortunately you added in react-hook-form
. We don't use that library and so it would be good to not add in anything more. I linked to an example which uses our form library above. We use formik
.
If you could switch over to that and remove the react-hook-form
library that would be great. The two systems are similar, so you should just need to change the CreateUserCredentialsModal.tsx file.
scripts/init-project.sh
Outdated
install_command="npm ci" | ||
install_command="npm install" |
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.
npm ci
should be used, please uncommit.
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.
Unfortunately you added in react-hook-form
. We don't use that library and so it would be good to not add in anything more. I linked to an example which uses our form library above. We use formik
.
If you could switch over to that and remove the react-hook-form
library that would be great.
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 changed it to formik library.
// Custom transformation to ensure privateKey is a one-liner | ||
const transformPrivateKey = (value: string) => value.replace(/\n/gm, '\\n'); | ||
|
||
const schema = yup.object().shape({ |
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.
It would be good to add:
- minimum and maximum character limits. Maximum should be a reasonable number for the field. Minimum is optional.
- you can optionally add in regex to give warnings when users inputs invalid characters. (You would need to figure out which characters are in/valid)
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.
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 key changes and additions:
Updated the Yup schema to include character limits and regex patterns:
- systemId: 3-50 characters, only letters, numbers, hyphens, and underscores.
- publicKey: 20-4096 characters, must match SSH public key format.
- privateKey: 1000-4096 characters.
- loginUser: Up to 32 characters, must start with a lowercase letter or underscore, followed by lowercase letters, numbers, hyphens, or underscores.
Added maxLength attributes to the Input components to enforce maximum character limits on the UI:
- systemId: 50 characters
- publicKey: 4096 characters
- privateKey: 4096 characters
- loginUser: 32 characters
The existing error handling will now display more specific error messages for invalid input formats or lengths.
These changes provide:
- Minimum and maximum character limits for all fields.
- Regex patterns to validate input format for all fields.
- UI enforcement of maximum character limits.
- Clear error messages for invalid inputs.
package.json
Outdated
@@ -34,6 +34,7 @@ | |||
"react-copy-to-clipboard": "^5.0.2", | |||
"react-dom": "^18.3.1", | |||
"react-dropzone": "^10.2.1", | |||
"react-hook-form": "^7.52.1", |
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.
Because we're using formik
, this react-hook-form
should be removed.
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.
Don't commit package-lock.jsons unless you have a specific reason to.
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.
Don't commit package-lock.jsons unless you have a specific reason to.
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.
Don't commit package-lock.jsons unless you have a specific reason to.
package-lock.json
Outdated
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.
Because we're using formik, this react-hook-form should be removed.
I was testing it and saw a few issues:
If you could fix those and push to the PR again that would be great. |
1f4d6dc
to
5bef0d8
Compare
Overview:
Related Github Issues:
Summary of Changes:
Testing Steps:
UI Photos:
Notes: