progress?
This commit is contained in:
@@ -10,7 +10,7 @@ from rich.text import Text
|
||||
from rich.panel import Panel
|
||||
from rich.console import RenderableType, Group
|
||||
from rich.table import Table
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING, Optional, Dict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ....models import FlowStats, FrameTypeStats
|
||||
@@ -106,19 +106,18 @@ class FlowMainDetailsPanel(Vertical):
|
||||
sections.append(Text("Enhanced Analysis", style="bold green"))
|
||||
sections.append(enhanced_table)
|
||||
|
||||
# Timing analysis - only show if no sub-flows exist
|
||||
# Timing analysis - only show if no enhanced sub-flows exist
|
||||
# Match the same logic as _should_show_subrows in flow_table_v2.py
|
||||
has_subflows = (len(flow.frame_types) > 1 or
|
||||
flow.enhanced_analysis.decoder_type != "Standard")
|
||||
has_enhanced_subflows = self._has_enhanced_subflows(flow)
|
||||
|
||||
# Debug output
|
||||
try:
|
||||
debug_panel = self.app.query_one("#debug-panel")
|
||||
debug_panel.add_debug_message(f"TIMING_LOGIC: {flow.src_ip}:{flow.src_port} - types={len(flow.frame_types)}, decoder={flow.enhanced_analysis.decoder_type}, has_subflows={has_subflows}")
|
||||
debug_panel.add_debug_message(f"TIMING_LOGIC: {flow.src_ip}:{flow.src_port} - types={len(flow.frame_types)}, decoder={flow.enhanced_analysis.decoder_type}, has_enhanced_subflows={has_enhanced_subflows}")
|
||||
except:
|
||||
pass
|
||||
|
||||
if not has_subflows:
|
||||
if not has_enhanced_subflows:
|
||||
try:
|
||||
debug_panel = self.app.query_one("#debug-panel")
|
||||
debug_panel.add_debug_message(f"BRANCH: Taking FULL timing branch for {flow.src_ip}:{flow.src_port}")
|
||||
@@ -160,6 +159,19 @@ class FlowMainDetailsPanel(Vertical):
|
||||
|
||||
return Group(*sections)
|
||||
|
||||
def _has_enhanced_subflows(self, flow: 'FlowStats') -> bool:
|
||||
"""Check if flow has enhanced frame types that warrant sub-rows"""
|
||||
enhanced_protocols = {'CHAPTER10', 'CH10', 'PTP', 'IENA'}
|
||||
|
||||
for frame_type in flow.frame_types.keys():
|
||||
# Check if this frame type belongs to an enhanced protocol
|
||||
if any(enhanced_proto in frame_type for enhanced_proto in enhanced_protocols):
|
||||
return True
|
||||
elif frame_type.startswith(('CH10-', 'PTP-', 'IENA-')):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def _format_bytes(self, bytes_count: int) -> str:
|
||||
"""Format byte count with units"""
|
||||
if bytes_count >= 1_000_000_000:
|
||||
@@ -276,14 +288,23 @@ class SubFlowDetailsPanel(Vertical):
|
||||
return Group(*sections)
|
||||
|
||||
def _create_subflow_summary(self, flow: 'FlowStats') -> RenderableType:
|
||||
"""Create summary of all sub-flows"""
|
||||
if not flow.frame_types or len(flow.frame_types) <= 1:
|
||||
"""Create summary of all sub-flows for enhanced flows"""
|
||||
# For enhanced flows, show ALL frame types, not just enhanced ones
|
||||
if flow.enhanced_analysis.decoder_type != "Standard":
|
||||
frame_types_to_show = flow.frame_types
|
||||
title = "Sub-Flow Summary (All Frame Types)"
|
||||
else:
|
||||
# For standard flows, only show enhanced frame types if any
|
||||
frame_types_to_show = self._get_enhanced_frame_types(flow)
|
||||
title = "Enhanced Sub-Flow Summary"
|
||||
|
||||
if not frame_types_to_show:
|
||||
return Text("No sub-flows available", style="dim")
|
||||
|
||||
sections = []
|
||||
sections.append(Text("Sub-Flow Summary", style="bold yellow"))
|
||||
sections.append(Text(title, style="bold yellow"))
|
||||
|
||||
# Frame type breakdown table
|
||||
# Frame type breakdown table for enhanced protocols only
|
||||
frame_table = Table(show_header=True, box=None)
|
||||
frame_table.add_column("Frame Type", style="blue")
|
||||
frame_table.add_column("Count", justify="right")
|
||||
@@ -294,7 +315,7 @@ class SubFlowDetailsPanel(Vertical):
|
||||
|
||||
total = flow.frame_count
|
||||
for frame_type, stats in sorted(
|
||||
flow.frame_types.items(),
|
||||
frame_types_to_show.items(),
|
||||
key=lambda x: x[1].count,
|
||||
reverse=True
|
||||
):
|
||||
@@ -315,6 +336,22 @@ class SubFlowDetailsPanel(Vertical):
|
||||
sections.append(frame_table)
|
||||
return Group(*sections)
|
||||
|
||||
def _get_enhanced_frame_types(self, flow: 'FlowStats') -> Dict[str, 'FrameTypeStats']:
|
||||
"""Get only frame types that belong to enhanced protocols"""
|
||||
enhanced_protocols = {'CHAPTER10', 'CH10', 'PTP', 'IENA'}
|
||||
enhanced_frame_types = {}
|
||||
|
||||
for frame_type, stats in flow.frame_types.items():
|
||||
# Check if this frame type belongs to an enhanced protocol
|
||||
if any(enhanced_proto in frame_type for enhanced_proto in enhanced_protocols):
|
||||
enhanced_frame_types[frame_type] = stats
|
||||
elif frame_type.startswith(('CH10-', 'PTP-', 'IENA-')):
|
||||
enhanced_frame_types[frame_type] = stats
|
||||
elif frame_type in ('TMATS', 'TMATS-Data'): # TMATS is part of Chapter 10
|
||||
enhanced_frame_types[frame_type] = stats
|
||||
|
||||
return enhanced_frame_types
|
||||
|
||||
def _format_bytes(self, bytes_count: int) -> str:
|
||||
"""Format byte count with units"""
|
||||
if bytes_count >= 1_000_000_000:
|
||||
|
||||
Reference in New Issue
Block a user