feat: add IP-based flow labels with internal/external classification and redesign workload summary sidebar with compact flow visualization

Add flow_ip_label helper to format flow endpoints with IP addresses and internal/external classification based on subnet membership, extend workload_insights response with source_label/destination_label fields showing IP addresses with context, implement endpointText helper to display formatted flow labels in UI, add CompactFlowList component showing top 3 flows with protocol
This commit is contained in:
2026-07-09 15:42:56 +02:00
parent baa0d24eb4
commit 32906bca1e
2 changed files with 73 additions and 26 deletions
+10
View File
@@ -286,6 +286,12 @@ def flow_endpoint_label(owner: Workload | None, subnets: list[Subnet], value: st
return subnet_label_for_ip(subnets, value) or "external"
def flow_ip_label(owner: Workload | None, subnets: list[Subnet], value: str) -> str:
if owner:
return f"{value} (internal)"
return f"{value} ({'internal' if subnet_label_for_ip(subnets, value) else 'external'})"
def dashboard_top_talkers(db: Session) -> list[dict[str, int | str]]:
totals: dict[str, int] = {}
workloads = db.scalars(select(Workload)).all()
@@ -966,6 +972,8 @@ def workload_insights(workload_id: str, _: CurrentUser, db: Session = Depends(ge
{
"source": flow_endpoint_label(source_owner, known_subnets, flow.source_ip),
"destination": flow_endpoint_label(destination_owner, known_subnets, flow.destination_ip),
"source_label": flow_ip_label(source_owner, known_subnets, flow.source_ip),
"destination_label": flow_ip_label(destination_owner, known_subnets, flow.destination_ip),
"source_ip": flow.source_ip,
"destination_ip": flow.destination_ip,
"protocol": flow.protocol,
@@ -989,6 +997,8 @@ def workload_insights(workload_id: str, _: CurrentUser, db: Session = Depends(ge
{
"source": workload.name,
"destination": "network",
"source_label": f"{workload_ips[0]} (internal)" if workload_ips else workload.name,
"destination_label": "network",
"interface": item.get("interface"),
"protocol": item.get("protocol") or "interface-counter",
"port": None,