-
Notifications
You must be signed in to change notification settings - Fork 75
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
fix(FR-386): add max value for User/Project setting modal #3050
base: main
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🔴 | Statements | 4.95% (+0.03% 🔼) |
400/8077 |
🔴 | Branches | 4.25% (+0.01% 🔼) |
239/5621 |
🔴 | Functions | 2.95% (+0% 🔼) |
78/2640 |
🔴 | Lines | 4.87% (+0.04% 🔼) |
385/7902 |
Test suite run success
124 tests passing in 14 suites.
Report generated by 🧪jest coverage report action from a7b2451
message.error( | ||
painKiller.relieve(res.create_keypair_resource_policy.msg), | ||
); |
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.
Basically, I think we've been talking about returning a massage that shows the graphql error message directly to the user, so we don't need to include the message handling logic in painkiller.
I looked through the history, but I didn't find anything, so please check this again.
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 agree with that. That’s why I plan to use a painkiller
only when the error message might be undefined
, as I think it’s strange not to show any message for an error. What do you think?
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. For the future, I think fixing the error message is the right way to go. For now, It would be better to output a specific phrase via i18n when the error message is undefined, rather than via painkiller.
{_.chain(resourceSlots) | ||
.keys() | ||
.chunk(2) | ||
.map((resourceSlotKeys, index) => ( | ||
<Row gutter={[16, 16]} key={index}> | ||
{_.map(resourceSlotKeys, (resourceSlotKey) => ( | ||
<Col | ||
span={12} | ||
key={resourceSlotKey} | ||
style={{ alignSelf: 'end', marginBottom: token.marginLG }} | ||
> | ||
<FormItemWithUnlimited | ||
unlimitedValue={undefined} | ||
label={ | ||
_.get(mergedResourceSlots, resourceSlotKey) | ||
?.description || resourceSlotKey | ||
} | ||
name={['parsedTotalResourceSlots', resourceSlotKey]} | ||
rules={[ | ||
{ | ||
validator(__, value) { | ||
if ( | ||
_.includes(resourceSlotKey, 'mem') && | ||
value && | ||
// @ts-ignore | ||
convertBinarySizeUnit(value, 'p').number > | ||
{_.chain(resourceSlotKeys) | ||
.map((resourceSlotKey) => ( | ||
<Col |
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.
Is there a reason for this change?
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 structure of HOF (Higher-Order Functions) often requires reading the code from right to left, which I believe negatively impacts readability. (And honestly, I switched to the chaining approach because I found the code difficult to read.)
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.
In my opinion, that code doesn't use lodash methods enough to use chains, so the addition of chains actually makes it less readable. The second chain only uses the map method, so there's no need to use them too.
resolves #3055 (FR-386)
max
value for each time in the setting modal on theResource Policy
pageusePainkilerr
changes
onCompleted
MAX_CPU_QUOTA
,SIGNED_32BIT_MAX_INT
MAX_CPU_QUOTA
, since the CPU type is afloat
, we limited the range to1e16
after consulting with @fregataa.Checklist: (if applicable)