-
Notifications
You must be signed in to change notification settings - Fork 68
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: autoSelectDefault and showUsageStatus props of StorageSelector #2180
Conversation
…sageStatus cases: 1. all props are "false" or only showUsageStatus is "false : no auto selected value 2. only autoSelectDefault is "true" : use query response's default field 3. autoSelectDefault and showUsageStatus are both "true" : set default value that have minimum usage
This pull request is automatically being deployed by Amplify Hosting (learn more). |
This comment was marked as resolved.
This comment was marked as resolved.
- no use : select nothing - 'default' : select default value in RQ response - 'usage' : select by minimum usage host
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.
Works okay, but there are a few touchups needed. Please refer to the comments above.
<Flex justify="between" align="center"> | ||
<Badge | ||
// @ts-ignore | ||
status={status[idx]} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
}, [vhostInfo]); | ||
|
||
const optionRender = useMemo(() => { | ||
const status = ['success', 'warning', 'error']; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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 just found some minor test failures in github action, originated from dependency array in hooks(useEffect and useMemo). You could either follow the guidance from github action or just input (// eslint-disable-next-line react-hooks/exhaustive-deps
) right above the line if there has certain reason (facebook/create-react-app#6880 (comment)).
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.
Please resolve test failure on github action following the comments above.
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🔴 | Statements | 3.14% (+0.01% 🔼) |
101/3214 |
🔴 | Branches | 3.32% (+0.01% 🔼) |
67/2016 |
🔴 | Functions | 1.56% (+0.01% 🔼) |
17/1093 |
🔴 | Lines | 3.2% (+0.01% 🔼) |
101/3154 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🔴 | ... / StorageSelect.tsx |
0% | 0% | 0% | 0% |
Test suite run success
20 tests passing in 4 suites.
Report generated by 🧪jest coverage report action from 876731c
I thought the "vhostInfo" data is used directly within the useEffect, and changes in it have a significant impact on determining the selectd host. So I added vhostInfo to the dependencies array. However, the other items are only configurable in code, so I removed them from the Dependencies array because I thought they were less likely to be changed because the user can't change their settings. |
794b1e2
to
7a68d36
Compare
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.
- Refactoring code by using defaultValue - Add conditional rendering for when usage is not included
const [state, setState] = useControllableValue({ value, onChange }); | ||
|
||
useEffect(() => { | ||
console.log('!'); |
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.
Please remove this line.
minWidth: 165, | ||
direction: 'ltr', |
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 any reason to set the direction here?
{/* TODO: add tooltip for '여유/주의/부족' */} | ||
{vhostInfo?.volume_info[host]?.usage && ( | ||
<Tooltip | ||
title="여유 or 주의 or 부족" | ||
// @ts-ignore | ||
getPopupContainer={() => shadowRoot} |
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 push a commit to add a tooltip with getPopupContainer
. Please add a proper text for each case. @ironAiken2
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!
I pushed commits to display search highlights and update type definition. @ironAiken2 , Please check. |
This PR resolves #2151
feature:
: set default selected host, "default" | "usage" or no use.
: "true" for showing usage in each host, "false" for disabling the feature.
: StorageSelect component can be controllable or not. If the parent passes state, it uses it; otherwise, it uses its own state.
Checklist: (if applicable)