devabhishekpal commented on code in PR #5213:
URL: https://github.com/apache/ozone/pull/5213#discussion_r1313725709


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/columnSearch.tsx:
##########
@@ -69,8 +69,16 @@ class ColumnSearch extends React.PureComponent {
     filterIcon: (filtered: boolean) => (
       <Icon type='search' style={{color: filtered ? '#1890ff' : undefined}}/>
     ),
-    onFilter: (value: string, record: any) =>
-      record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()),
+    onFilter: (value: string, record: any) => {
+      if (record[dataIndex] !== undefined || record[dataIndex] !== null) {
+          return typeof (record[dataIndex]) === typeof {}
+            ? Boolean (record[dataIndex].find(item => 
Object.values(item).toString().toLowerCase().includes(value.toLowerCase())) ? 
true :false)
+            : 
record[dataIndex].toString().toLowerCase().includes(value.toLowerCase())
+        }
+        else {

Review Comment:
   I guess it is safer to have it in place, in case there is a scenario like 
the data-fetching for say DataNodes failed, so now record[DataIndex] is 
undefined. In that case if we try to perform a search in the column, it might 
give error.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/columnSearch.tsx:
##########
@@ -69,8 +69,16 @@ class ColumnSearch extends React.PureComponent {
     filterIcon: (filtered: boolean) => (
       <Icon type='search' style={{color: filtered ? '#1890ff' : undefined}}/>
     ),
-    onFilter: (value: string, record: any) =>
-      record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()),
+    onFilter: (value: string, record: any) => {
+      if (record[dataIndex] !== undefined || record[dataIndex] !== null) {
+          return typeof (record[dataIndex]) === typeof {}
+            ? Boolean (record[dataIndex].find(item => 
Object.values(item).toString().toLowerCase().includes(value.toLowerCase())) ? 
true :false)
+            : 
record[dataIndex].toString().toLowerCase().includes(value.toLowerCase())
+        }
+        else {

Review Comment:
   @devmadhuu I guess it is safer to have it in place, in case there is a 
scenario like the data-fetching for say DataNodes failed, so now 
record[DataIndex] is undefined. In that case if we try to perform a search in 
the column, it might give error.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to