|
@@ -1,16 +1,14 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import * as Metrics from 'components/common/Metrics';
|
|
import * as Metrics from 'components/common/Metrics';
|
|
import { Tag } from 'components/common/Tag/Tag.styled';
|
|
import { Tag } from 'components/common/Tag/Tag.styled';
|
|
-import { Table } from 'components/common/table/Table/Table.styled';
|
|
|
|
-import TableHeaderCell from 'components/common/table/TableHeaderCell/TableHeaderCell';
|
|
|
|
-import BytesFormatted from 'components/common/BytesFormatted/BytesFormatted';
|
|
|
|
-import { NavLink } from 'react-router-dom';
|
|
|
|
-import { clusterTopicsPath } from 'lib/paths';
|
|
|
|
import Switch from 'components/common/Switch/Switch';
|
|
import Switch from 'components/common/Switch/Switch';
|
|
import { useClusters } from 'lib/hooks/api/clusters';
|
|
import { useClusters } from 'lib/hooks/api/clusters';
|
|
-import { ServerStatus } from 'generated-sources';
|
|
|
|
|
|
+import { Cluster, ServerStatus } from 'generated-sources';
|
|
|
|
+import { ColumnDef } from '@tanstack/react-table';
|
|
|
|
+import Table, { SizeCell } from 'components/common/NewTable';
|
|
|
|
|
|
import * as S from './ClustersWidget.styled';
|
|
import * as S from './ClustersWidget.styled';
|
|
|
|
+import ClusterName from './ClusterName';
|
|
|
|
|
|
const ClustersWidget: React.FC = () => {
|
|
const ClustersWidget: React.FC = () => {
|
|
const { data } = useClusters();
|
|
const { data } = useClusters();
|
|
@@ -28,6 +26,19 @@ const ClustersWidget: React.FC = () => {
|
|
};
|
|
};
|
|
}, [data, showOfflineOnly]);
|
|
}, [data, showOfflineOnly]);
|
|
|
|
|
|
|
|
+ const columns = React.useMemo<ColumnDef<Cluster>[]>(
|
|
|
|
+ () => [
|
|
|
|
+ { header: 'Cluster name', accessorKey: 'name', cell: ClusterName },
|
|
|
|
+ { header: 'Version', accessorKey: 'version' },
|
|
|
|
+ { header: 'Brokers count', accessorKey: 'brokerCount' },
|
|
|
|
+ { header: 'Partitions', accessorKey: 'onlinePartitionCount' },
|
|
|
|
+ { header: 'Topics', accessorKey: 'topicCount' },
|
|
|
|
+ { header: 'Production', accessorKey: 'bytesInPerSec', cell: SizeCell },
|
|
|
|
+ { header: 'Consumption', accessorKey: 'bytesOutPerSec', cell: SizeCell },
|
|
|
|
+ ],
|
|
|
|
+ []
|
|
|
|
+ );
|
|
|
|
+
|
|
const handleSwitch = () => setShowOfflineOnly(!showOfflineOnly);
|
|
const handleSwitch = () => setShowOfflineOnly(!showOfflineOnly);
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
@@ -51,45 +62,12 @@ const ClustersWidget: React.FC = () => {
|
|
/>
|
|
/>
|
|
<label>Only offline clusters</label>
|
|
<label>Only offline clusters</label>
|
|
</S.SwitchWrapper>
|
|
</S.SwitchWrapper>
|
|
- <Table isFullwidth>
|
|
|
|
- <thead>
|
|
|
|
- <tr>
|
|
|
|
- <TableHeaderCell title="Cluster name" />
|
|
|
|
- <TableHeaderCell title="Version" />
|
|
|
|
- <TableHeaderCell title="Brokers count" />
|
|
|
|
- <TableHeaderCell title="Partitions" />
|
|
|
|
- <TableHeaderCell title="Topics" />
|
|
|
|
- <TableHeaderCell title="Production" />
|
|
|
|
- <TableHeaderCell title="Consumption" />
|
|
|
|
- </tr>
|
|
|
|
- </thead>
|
|
|
|
- <tbody>
|
|
|
|
- {config.list.map((cluster) => (
|
|
|
|
- <tr key={cluster.name}>
|
|
|
|
- <S.TableCell maxWidth="99px" width="350">
|
|
|
|
- {cluster.readOnly && <Tag color="blue">readonly</Tag>}{' '}
|
|
|
|
- {cluster.name}
|
|
|
|
- </S.TableCell>
|
|
|
|
- <S.TableCell maxWidth="99px">{cluster.version}</S.TableCell>
|
|
|
|
- <S.TableCell maxWidth="99px">{cluster.brokerCount}</S.TableCell>
|
|
|
|
- <S.TableCell maxWidth="78px">
|
|
|
|
- {cluster.onlinePartitionCount}
|
|
|
|
- </S.TableCell>
|
|
|
|
- <S.TableCell maxWidth="60px">
|
|
|
|
- <NavLink to={clusterTopicsPath(cluster.name)}>
|
|
|
|
- {cluster.topicCount}
|
|
|
|
- </NavLink>
|
|
|
|
- </S.TableCell>
|
|
|
|
- <S.TableCell maxWidth="85px">
|
|
|
|
- <BytesFormatted value={cluster.bytesInPerSec} />
|
|
|
|
- </S.TableCell>
|
|
|
|
- <S.TableCell maxWidth="85px">
|
|
|
|
- <BytesFormatted value={cluster.bytesOutPerSec} />
|
|
|
|
- </S.TableCell>
|
|
|
|
- </tr>
|
|
|
|
- ))}
|
|
|
|
- </tbody>
|
|
|
|
- </Table>
|
|
|
|
|
|
+ <Table
|
|
|
|
+ columns={columns}
|
|
|
|
+ data={config?.list}
|
|
|
|
+ enableSorting
|
|
|
|
+ emptyMessage="Disk usage data not available"
|
|
|
|
+ />
|
|
</>
|
|
</>
|
|
);
|
|
);
|
|
};
|
|
};
|