Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add production/consumption to topic list and topic overview #2789

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions kafka-ui-react-app/src/components/Topics/List/TopicTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ import { TopicTitleCell } from './TopicTitleCell';
import ActionsCell from './ActionsCell';
import BatchActionsbar from './BatchActionsBar';

import BytesFormatted from 'components/common/BytesFormatted/BytesFormatted';

function formatThroughput(row: Topic) {
const production = row.bytesInPerSec;
const consumption = row.bytesOutPerSec;
if (production === undefined && consumption === undefined) {
return (<tr>N/A</tr>);
} else if (production === undefined) {
return (<tr>out: <BytesFormatted value={consumption}/> </tr>);
} else if (consumption === undefined) {
return (<tr>in: <BytesFormatted value={production}/></tr>);
} else {
return (
<div>
<tr>in: <BytesFormatted value={production}/></tr>
<tr>out: <BytesFormatted value={consumption}/></tr>
</div>
);
}
}

const TopicTable: React.FC = () => {
const { clusterName } = useAppParams<{ clusterName: ClusterName }>();
const [searchParams] = useSearchParams();
Expand Down Expand Up @@ -85,6 +106,14 @@ const TopicTable: React.FC = () => {
accessorKey: 'segmentSize',
cell: SizeCell,
},
{
header: 'Throughput',
accessorFn: row => formatThroughput(row),
enableSorting: false,
cell: ({ getValue }) => {
return getValue();
},
},
{
id: 'actions',
header: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ const Overview: React.FC = () => {
<Metrics.Indicator label="Message Count">
{messageCount}
</Metrics.Indicator>
<Metrics.Indicator label="Production">
<BytesFormatted value={data?.bytesInPerSec}/>
</Metrics.Indicator>
<Metrics.Indicator label="Consumption">
<BytesFormatted value={data?.bytesOutPerSec}/>
</Metrics.Indicator>
</Metrics.Section>
</Metrics.Wrapper>
<Table
Expand Down