You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "arunsarin85 (via GitHub)" <gi...@apache.org> on 2026/03/04 18:21:56 UTC

[PR] HDDS-14727 Improvements on File Size Distribution Tab - Add search an… [ozone]

arunsarin85 opened a new pull request, #9865:
URL: https://github.com/apache/ozone/pull/9865

   …d select/unselect all in volume and bucket dropdowns.
   
   ## What changes were proposed in this pull request?
   HDDS-14727. [Recon] Improvements on File Size Distribution Tab
   
   - Add Search box inside Volumes and Buckets dropdowns to filter by name
   - Add Select All / Unselect All toggle in Volumes and Buckets dropdowns
   - Fix extra blank space at bottom of Buckets dropdown (remove hardcoded height: 100px)
   - Fix blank rows in Buckets dropdown caused by null/empty API response entries
   
   Please describe your PR in detail:
   * What changes are proposed in the PR? and Why? It would be better if it is written from third person's
   perspective not just for the reviewer.
   * Provide as much context and rationale for the pull request as possible. It could be copy-paste from
   the Jira's description if the jira is well defined.
   * If it is complex code, describe the approach used to solve the issue. If possible attach design doc,
   issue investigation, github discussion, etc.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-14727
   
   ## How was this patch tested?
   <img width="748" height="725" alt="image" src="https://github.com/user-attachments/assets/d1e4bab2-b0ce-4193-89f3-6e7a7f2c0923" />
   <img width="743" height="731" alt="image" src="https://github.com/user-attachments/assets/7ac689cc-e16f-4215-a921-22b73bc1e4bc" />
   <img width="749" height="724" alt="image" src="https://github.com/user-attachments/assets/985219f5-8f8c-4b33-be2b-5222ba9d7574" />
   <img width="748" height="725" alt="image" src="https://github.com/user-attachments/assets/de1fd192-a871-4eab-b3f6-659e5828cbd7" />
   <img width="1516" height="752" alt="image" src="https://github.com/user-attachments/assets/2b83ec99-7935-4281-bd60-50283ae1ea1a" />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r2956055156


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -98,27 +147,162 @@ const MultiSelect: React.FC<MultiSelectProps> = ({
         {isDisabled
           ? placeholder
           : `${placeholder}: ${selected.length} selected`
-}
+        }
       </components.ValueContainer>
     );
   };
 
-  const finalStyles = {...selectStyles, ...style ?? {}}
+  // ── Custom Input override (search mode only) ─────────────────────────────
+  // React-select v3's onInputBlur steals focus back to its hidden input whenever
+  // a child element gains focus.  By intercepting onBlur here we suppress that
+  // call while the search box is active, preventing the dropdown from closing.
+  const InputComponent = React.useMemo(
+    () => (({ onBlur, ...inputProps }: any) => {
+      const handleBlur = (e: React.FocusEvent) => {
+        // While the user is interacting with the search box, skip react-select's
+        // onInputBlur so it does not steal focus back or close the menu.
+        if (searchInteracting.current) return;
+        if (onBlur) onBlur(e);
+      };
+      return <components.Input {...inputProps} onBlur={handleBlur} />;
+    }) as React.FC<any>,
+    [] // searchInteracting captured by ref — always current
+  );
 
-  return (
+  // ── Stable MenuList ───────────────────────────────────────────────────────
+  // Created once so react-select updates (not remounts) it on every render.
+  // All mutable values are read from stateRef.current at call time.
+  const MenuListComponent = React.useMemo(

Review Comment:
   Can we extract this to it's own component and avoid using memoization?
   Usually useMemo is an expensive operation, this is a relatively lightweight component, hence re-render is fine.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "arunsarin85 (via GitHub)" <gi...@apache.org>.
arunsarin85 commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r2971993599


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -98,27 +147,162 @@ const MultiSelect: React.FC<MultiSelectProps> = ({
         {isDisabled
           ? placeholder
           : `${placeholder}: ${selected.length} selected`
-}
+        }
       </components.ValueContainer>
     );
   };
 
-  const finalStyles = {...selectStyles, ...style ?? {}}
+  // ── Custom Input override (search mode only) ─────────────────────────────
+  // React-select v3's onInputBlur steals focus back to its hidden input whenever
+  // a child element gains focus.  By intercepting onBlur here we suppress that
+  // call while the search box is active, preventing the dropdown from closing.
+  const InputComponent = React.useMemo(

Review Comment:
   Addressed the comment , please check .
   By mistake did a force push , so history is not maintained please check



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -98,27 +147,162 @@ const MultiSelect: React.FC<MultiSelectProps> = ({
         {isDisabled
           ? placeholder
           : `${placeholder}: ${selected.length} selected`
-}
+        }
       </components.ValueContainer>
     );
   };
 
-  const finalStyles = {...selectStyles, ...style ?? {}}
+  // ── Custom Input override (search mode only) ─────────────────────────────
+  // React-select v3's onInputBlur steals focus back to its hidden input whenever
+  // a child element gains focus.  By intercepting onBlur here we suppress that
+  // call while the search box is active, preventing the dropdown from closing.
+  const InputComponent = React.useMemo(
+    () => (({ onBlur, ...inputProps }: any) => {
+      const handleBlur = (e: React.FocusEvent) => {
+        // While the user is interacting with the search box, skip react-select's
+        // onInputBlur so it does not steal focus back or close the menu.
+        if (searchInteracting.current) return;
+        if (onBlur) onBlur(e);
+      };
+      return <components.Input {...inputProps} onBlur={handleBlur} />;
+    }) as React.FC<any>,
+    [] // searchInteracting captured by ref — always current
+  );
 
-  return (
+  // ── Stable MenuList ───────────────────────────────────────────────────────
+  // Created once so react-select updates (not remounts) it on every render.
+  // All mutable values are read from stateRef.current at call time.
+  const MenuListComponent = React.useMemo(

Review Comment:
   Addressed the comment , please check .
   By mistake did a force push , so history is not maintained please check



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r2956056604


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -98,27 +147,162 @@ const MultiSelect: React.FC<MultiSelectProps> = ({
         {isDisabled
           ? placeholder
           : `${placeholder}: ${selected.length} selected`
-}
+        }
       </components.ValueContainer>
     );
   };
 
-  const finalStyles = {...selectStyles, ...style ?? {}}
+  // ── Custom Input override (search mode only) ─────────────────────────────
+  // React-select v3's onInputBlur steals focus back to its hidden input whenever
+  // a child element gains focus.  By intercepting onBlur here we suppress that
+  // call while the search box is active, preventing the dropdown from closing.
+  const InputComponent = React.useMemo(

Review Comment:
   Here also we can avoid useMemo



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r3006724664


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -28,13 +28,11 @@ import {
 } from 'react-select';
 
 import { selectStyles } from "@/v2/constants/select.constants";
+import MultiSelectMenuList, { MultiSelectInput, Option } from './multiSelectMenuList';

Review Comment:
   These don't seem to be included in the PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r2989413502


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -69,6 +90,117 @@ const Option: React.FC<OptionProps<Option, true>> = (props) => {
   )
 }
 
+// Intercepts react-select v3's onInputBlur, which steals focus back to its
+// hidden input whenever a child element gains focus.  While the user is
+// interacting with the search box we suppress that call so the dropdown
+// stays open.
+const CustomInput: React.FC<any> = ({ onBlur, ...inputProps }) => {
+  const ctx = React.useContext(MultiSelectCtx);
+  const handleBlur = (e: React.FocusEvent) => {
+    if (ctx?.searchInteracting.current) return;
+    if (onBlur) onBlur(e);
+  };
+  return <components.Input {...inputProps} onBlur={handleBlur} />;
+};
+
+const CustomMenuList: React.FC<any> = ({ children, ...menuListProps }) => {
+  const ctx = React.useContext(MultiSelectCtx);
+  if (!ctx) return <components.MenuList {...menuListProps}>{children}</components.MenuList>;
+
+  const {
+    searchTerm,
+    setSearchTerm,
+    showSearch,
+    showSelectAll,
+    selected,
+    selectableOptions,
+    onChange,
+    searchWrapperRef,
+    searchInteracting,
+    containerRef,
+    setIsMenuOpen
+  } = ctx;

Review Comment:
   Can these be extracted to it's own component?
   Seems to be useful and can be re-used later on by others.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "arunsarin85 (via GitHub)" <gi...@apache.org>.
arunsarin85 commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r3011927020


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -28,13 +28,11 @@ import {
 } from 'react-select';
 
 import { selectStyles } from "@/v2/constants/select.constants";
+import MultiSelectMenuList, { MultiSelectInput, Option } from './multiSelectMenuList';

Review Comment:
   This is merged in master , in another PR #9928 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd merged PR #9865:
URL: https://github.com/apache/ozone/pull/9865


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd commented on PR #9865:
URL: https://github.com/apache/ozone/pull/9865#issuecomment-4162148231

   Thanks for the patch @arunsarin85.
   Merging this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14727. Improve volume/bucket selection in File Size Distribution [ozone]

Posted by "arunsarin85 (via GitHub)" <gi...@apache.org>.
arunsarin85 commented on code in PR #9865:
URL: https://github.com/apache/ozone/pull/9865#discussion_r2996173590


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/multiSelect.tsx:
##########
@@ -69,6 +90,117 @@ const Option: React.FC<OptionProps<Option, true>> = (props) => {
   )
 }
 
+// Intercepts react-select v3's onInputBlur, which steals focus back to its
+// hidden input whenever a child element gains focus.  While the user is
+// interacting with the search box we suppress that call so the dropdown
+// stays open.
+const CustomInput: React.FC<any> = ({ onBlur, ...inputProps }) => {
+  const ctx = React.useContext(MultiSelectCtx);
+  const handleBlur = (e: React.FocusEvent) => {
+    if (ctx?.searchInteracting.current) return;
+    if (onBlur) onBlur(e);
+  };
+  return <components.Input {...inputProps} onBlur={handleBlur} />;
+};
+
+const CustomMenuList: React.FC<any> = ({ children, ...menuListProps }) => {
+  const ctx = React.useContext(MultiSelectCtx);
+  if (!ctx) return <components.MenuList {...menuListProps}>{children}</components.MenuList>;
+
+  const {
+    searchTerm,
+    setSearchTerm,
+    showSearch,
+    showSelectAll,
+    selected,
+    selectableOptions,
+    onChange,
+    searchWrapperRef,
+    searchInteracting,
+    containerRef,
+    setIsMenuOpen
+  } = ctx;

Review Comment:
   Added the patch .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org