-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: add max validation rule for CPU and memory in Form.Item. #2692
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f90f62e
to
d933aec
Compare
9dc2c91
to
1f8a044
Compare
d933aec
to
3c5c8e7
Compare
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🔴 | Statements | 5.47% | 337/6156 |
🔴 | Branches | 5.06% | 214/4232 |
🔴 | Functions | 3.11% | 63/2023 |
🔴 | Lines | 5.37% | 323/6012 |
Test suite run success
90 tests passing in 11 suites.
Report generated by 🧪jest coverage report action from bacb099
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.
@yomybaby
It's kinda minor issue, but I think validation rule works differently when user add numbers after maximum values and just input number that exceeds maximum value.
For example, if the maximum value of CPU is 19 Core, then we have two cases.
It doesn't affects any error when updating model service since exceeding the maximum value is regarded as invalid, but I want to check whether is acceptable or not.
Here's the video clip that I mentioned about the different validation result.
Your org requires the Graphite merge queue for merging into mainAdd the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
3c5c8e7
to
b191501
Compare
To make it have same behavior with Ant'd Input |
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.
Merge activity
|
### TL;DR Normally, users cannot set the value above the maximum limit because it automatically changes when the user focuses out of the input (blur event). However, it can be set programmatically above the maximum limit. For example, on the model service modification page, the existing model service can have a value above the maximum limit. This PR added maximum value validation for CPU and memory allocation in the resource allocation form. ### What changed? - Added a new rule to validate the maximum CPU value based on resource limits. - Implemented a validator for memory allocation to ensure it doesn't exceed the maximum limit. - Added a new translation key "MaxValueNotification" across all language files to support the new validation messages. ### How to test? 1. Open model service modification page. 2. Change [the initialValue ](https://github.com/lablup/backend.ai-webui/blob/f90f62e5112bab03bbd92d7b6e16611c0ec3d682/react/src/components/ServiceLauncherPageContent.tsx#L601-L607) to value above the maximum limit (ServiceLauncherPageContent.tsx)
967e995
to
bacb099
Compare
TL;DR
Normally, users cannot set the value above the maximum limit because it automatically changes when the user focuses out of the input (blur event). However, it can be set programmatically above the maximum limit. For example, on the model service modification page, the existing model service can have a value above the maximum limit.
This PR added maximum value validation for CPU and memory allocation in the resource allocation form.
What changed?
How to test?