Browse Source

[issue-1521] Add Port and Host columns to Broker info (#1642)

* Add port column to brokers info

* Add Port and Host columns to Broker info

Co-authored-by: Anton Zorin <ant.zorin@gmail.com>
Zorii4 3 years ago
parent
commit
d40af6d386
1 changed files with 9 additions and 2 deletions
  1. 9 2
      kafka-ui-react-app/src/components/Brokers/Brokers.tsx

+ 9 - 2
kafka-ui-react-app/src/components/Brokers/Brokers.tsx

@@ -10,6 +10,7 @@ import PageHeading from 'components/common/PageHeading/PageHeading';
 import * as Metrics from 'components/common/Metrics';
 import * as Metrics from 'components/common/Metrics';
 import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
 import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
 import {
 import {
+  fetchBrokers,
   fetchClusterStats,
   fetchClusterStats,
   selectStats,
   selectStats,
 } from 'redux/reducers/brokers/brokersSlice';
 } from 'redux/reducers/brokers/brokersSlice';
@@ -28,6 +29,7 @@ const Brokers: React.FC = () => {
     underReplicatedPartitionCount,
     underReplicatedPartitionCount,
     diskUsage,
     diskUsage,
     version,
     version,
+    items,
   } = useAppSelector(selectStats);
   } = useAppSelector(selectStats);
 
 
   let replicas = inSyncReplicasCount ?? 0;
   let replicas = inSyncReplicasCount ?? 0;
@@ -35,14 +37,15 @@ const Brokers: React.FC = () => {
 
 
   React.useEffect(() => {
   React.useEffect(() => {
     dispatch(fetchClusterStats(clusterName));
     dispatch(fetchClusterStats(clusterName));
-  }, [clusterName, dispatch]);
+    dispatch(fetchBrokers(clusterName));
+  }, [fetchClusterStats, fetchBrokers, clusterName, dispatch]);
 
 
   useInterval(() => {
   useInterval(() => {
     fetchClusterStats(clusterName);
     fetchClusterStats(clusterName);
+    fetchBrokers(clusterName);
   }, 5000);
   }, 5000);
 
 
   const zkOnline = zooKeeperStatus === ZooKeeperStatus.online;
   const zkOnline = zooKeeperStatus === ZooKeeperStatus.online;
-
   return (
   return (
     <>
     <>
       <PageHeading text="Brokers" />
       <PageHeading text="Brokers" />
@@ -122,6 +125,8 @@ const Brokers: React.FC = () => {
             <TableHeaderCell title="Broker" />
             <TableHeaderCell title="Broker" />
             <TableHeaderCell title="Segment Size (Mb)" />
             <TableHeaderCell title="Segment Size (Mb)" />
             <TableHeaderCell title="Segment Count" />
             <TableHeaderCell title="Segment Count" />
+            <TableHeaderCell title="Port" />
+            <TableHeaderCell title="Host" />
           </tr>
           </tr>
         </thead>
         </thead>
         <tbody>
         <tbody>
@@ -133,6 +138,8 @@ const Brokers: React.FC = () => {
                   <BytesFormatted value={segmentSize} />
                   <BytesFormatted value={segmentSize} />
                 </td>
                 </td>
                 <td>{segmentCount}</td>
                 <td>{segmentCount}</td>
+                <td>{items && items[brokerId]?.port}</td>
+                <td>{items && items[brokerId]?.host}</td>
               </tr>
               </tr>
             ))
             ))
           ) : (
           ) : (