HDDS-14840 User Experience Improvements on buckets tab.#9928
HDDS-14840 User Experience Improvements on buckets tab.#9928arunsarin85 wants to merge 3 commits intoapache:masterfrom
Conversation
| const MenuListComponent = useMemo( | ||
| () => ({ children, ...menuListProps }: any) => { | ||
| const { | ||
| searchTerm, | ||
| setSearchTerm, | ||
| showSearch, | ||
| showSelectAll, | ||
| selected, | ||
| selectableOptions, | ||
| fixedOptions, | ||
| options, | ||
| onChange | ||
| } = stateRef.current; |
There was a problem hiding this comment.
Might be better to move this out to it's own component under select/ to avoid memoization.
There was a problem hiding this comment.
MenuListComponent moved out of multiSelect.tsx to avoid useMemo
| const InputComponent = useMemo( | ||
| () => (({ onBlur, ...inputProps }: any) => { | ||
| const handleBlur = (e: React.FocusEvent<HTMLElement>) => { | ||
| if (searchInteracting.current) return; | ||
| if (onBlur) onBlur(e); | ||
| }; | ||
| return <input {...inputProps} onBlur={handleBlur} />; | ||
| }) as React.FC, | ||
| [] // searchInteracting captured by ref — always current | ||
| ); |
There was a problem hiding this comment.
Similarly for this we can move out to it's own component
There was a problem hiding this comment.
InputComponent moved out to its own component
|
|
||
| // Only intercept onMenuClose when showSearch is active so we can keep | ||
| // the dropdown open while the user interacts with the search box. | ||
| const handleMenuClose = useCallback(() => { |
There was a problem hiding this comment.
Is useCallback required?
This uses stable setters and a ref, so nothing would be changing it's "identity", a normal function should be fine here
There was a problem hiding this comment.
handleMenuClose is a plain function - no useCallback, didn't import it.
spacemonkd
left a comment
There was a problem hiding this comment.
Added a few comments @arunsarin85, could you take a look?
Hi @spacemonkd , I have raised a patch to address these review comments . Please review the changes. |
What changes were proposed in this pull request?
User Experience Improvements on buckets tab.
Please describe your PR in detail:
User Experience Improvements on buckets tab.
Implemented the following improvements on the Buckets Tab of Recon (HDDS-14840):
Added fixed: 'left' to both the Bucket (name) and Volume (volumeName) column definitions so they remain anchored to the left edge while the user scrolls horizontally through the remaining columns.
Added an optional showSearch boolean prop (default false) to the shared MultiSelect component. When enabled, a search input is rendered at the top of the dropdown menu, filtering the visible options in real time. Key implementation details:
Options are pre-filtered before being passed to react-select, so filtering works independently of react-select's own input handling.
The dropdown uses controlled menuIsOpen state to stay open while the user interacts with the search box.
A stable InputComponent override suppresses react-select's blur-driven close when focus moves to the search input.
The MenuListComponent is created with useMemo and reads mutable values via a stateRef so its component reference stays stable across re-renders, preventing react-select from unmounting and remounting the menu (which would lose focus mid-typing).
Pressing Escape while the search box is focused closes the dropdown and clears the search term.
Added an optional showSelectAll boolean prop (default false). When enabled, a checkbox row is rendered below the search box (above the option list) that:
Checks all selectable options when none/some are selected.
Unchecks all options (keeping only the mandatory fixed column, e.g. "Bucket") when all are already selected.
onMouseDown on this row prevents blur from firing on the react-select control, so the menu stays open after clicking.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14840
How was this patch tested?
Sticky Vol/Buck

Select unselect & search
