You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/16 11:59:45 UTC

[GitHub] [pinot] jayeshchoudhary commented on a diff in pull request #9742: have query table list show search bar; fix InstancesTables filter

jayeshchoudhary commented on code in PR #9742:
URL: https://github.com/apache/pinot/pull/9742#discussion_r1023903442


##########
pinot-controller/src/main/resources/app/components/Homepage/InstancesTables.tsx:
##########
@@ -17,23 +17,30 @@
  * under the License.
  */
 
-import React, {  } from 'react';
-import map from 'lodash/map';
-import get from 'lodash/get';
+import React from 'react';
+import _ from 'lodash';
 import InstanceTable from './InstanceTable';
 
-const Instances = ({instances, clusterName}) => {
+const Instances = ({ instances, clusterName }) => {
   const order = ['Controller', 'Broker', 'Server', 'Minion'];
   return (
     <>
-      {
-        map(order, (key) => {
-          const value = get(instances, key, []);
-          return <InstanceTable key={key} name={`${key}s`} instances={value} clusterName={clusterName} />;
+      {_(order)
+        .filter((key) => _.has(instances, key))
+        .map((key) => {
+          const value = _.get(instances, key, []);
+          return (
+            <InstanceTable
+              key={key}
+              name={`${key}s`}
+              instances={value}
+              clusterName={clusterName}
+            />
+          );

Review Comment:
   I think we don't need `.value` here, we are simply filtering instances that don't have key.
   
   ```js
   {order
     .filter((key) => _.has(instances, key))
     .map((key) => {
       const value = _.get(instances, key, []);
       return (
         <InstanceTable
           key={key}
           name={`${key}s`}
           instances={value}
           clusterName={clusterName}
         />
       );
     })
   }
   ```



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org