Skip to content

Commit

Permalink
Add traffic direction cell
Browse files Browse the repository at this point in the history
Signed-off-by: Yannik Messerli <[email protected]>
  • Loading branch information
yannikmesserli authored and geakstr committed Feb 13, 2025
1 parent e45f178 commit 17853a9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/components/FlowsTable/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export const Cell = observer(function FlowsTableCell(props: CellProps) {
</div>
);
}
case Column.TrafficDirection: {
return (
<div className={classnames(css.cell, css.trafficDirection)}>
{props.flow.trafficDirectionLabel}
</div>
);
}
case Column.Verdict: {
const className = classnames(css.cell, css.verdict, {
[css.forwardedVerdict]: props.flow.verdict === Verdict.Forwarded,
Expand Down
5 changes: 5 additions & 0 deletions src/components/FlowsTable/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const Header = memo<CommonProps>(function FlowsTableHeader(props) {
{props.visibleColumns.has(Column.L7Info) && (
<div className={classnames(css.cell, css.l7info)}>{getColumnLabel(Column.L7Info)}</div>
)}
{props.visibleColumns.has(Column.TrafficDirection) && (
<div className={classnames(css.cell, css.trafficDirection)}>
{getColumnLabel(Column.TrafficDirection)}
</div>
)}
{props.visibleColumns.has(Column.Verdict) && (
<div className={classnames(css.cell, css.verdict)}>{getColumnLabel(Column.Verdict)}</div>
)}
Expand Down
3 changes: 3 additions & 0 deletions src/components/FlowsTable/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export const Row = memo<RowProps>(function FlowsTableRow(props) {
)}
{props.visibleColumns.has(Column.DstPort) && <Cell flow={props.flow} kind={Column.DstPort} />}
{props.visibleColumns.has(Column.L7Info) && <Cell flow={props.flow} kind={Column.L7Info} />}
{props.visibleColumns.has(Column.TrafficDirection) && (
<Cell flow={props.flow} kind={Column.TrafficDirection} />
)}
{props.visibleColumns.has(Column.Verdict) && <Cell flow={props.flow} kind={Column.Verdict} />}
{props.visibleColumns.has(Column.Auth) && <Cell flow={props.flow} kind={Column.Auth} />}
{props.visibleColumns.has(Column.TcpFlags) && (
Expand Down
4 changes: 3 additions & 1 deletion src/components/FlowsTable/__tests__/Row.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ const runTest = (ntest: number, hf: HubbleFlow, exps: Expectations) => {
row = renderRow(
<Row
flow={flow}
visibleColumns={new Set(Object.values(Column))}
visibleColumns={
new Set(Object.values(Column).filter(f => f !== Column.TrafficDirection))
}
isSelected={selected}
onSelect={onSelect}
></Row>,
Expand Down
5 changes: 5 additions & 0 deletions src/components/FlowsTable/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
text-align: right;
}

&.trafficDirection {
max-width: 130px;
text-align: right;
}

&.verdict {
max-width: 130px;
}
Expand Down

0 comments on commit 17853a9

Please sign in to comment.