diff --git a/backend/src/api/analysis_api.py b/backend/src/api/analysis_api.py index ca679f1..a99aa49 100644 --- a/backend/src/api/analysis_api.py +++ b/backend/src/api/analysis_api.py @@ -71,10 +71,10 @@ class InterfaceHostProtocolAnalysisResponse(BaseModel): @router.get("/interface-hosts", response_model=InterfaceHostAnalysisResponse) async def analysis_interface_hosts( since_minutes: Optional[int] = Query( - 60, + None, ge=1, le=60 * 24 * 30, - description="Analyze only packets seen within the last N minutes. Set to a large value to cover more history.", + description="Analyze only packets seen within the last N minutes. Omit to cover all captured history.", ), limit_per_interface: int = Query( 100, @@ -104,10 +104,10 @@ async def analysis_interface_hosts( @router.get("/interface-host-protocols", response_model=InterfaceHostProtocolAnalysisResponse) async def analysis_interface_host_protocols( since_minutes: Optional[int] = Query( - 60, + None, ge=1, le=60 * 24 * 30, - description="Analyze only packets seen within the last N minutes. Set to a large value to cover more history.", + description="Analyze only packets seen within the last N minutes. Omit to cover all captured history.", ), limit_per_interface: int = Query( 50, diff --git a/frontend/src/api/apiClient.ts b/frontend/src/api/apiClient.ts index f0ca022..20d9981 100644 --- a/frontend/src/api/apiClient.ts +++ b/frontend/src/api/apiClient.ts @@ -174,12 +174,12 @@ export const clearPackets = async (): Promise => { }; export const fetchInterfaceHostAnalysis = async ( - sinceMinutes = 60, + sinceMinutes: number | null = null, limitPerInterface = 100, ): Promise => { const res = await api.get('/analysis/interface-hosts', { params: { - since_minutes: sinceMinutes, + since_minutes: sinceMinutes ?? undefined, limit_per_interface: limitPerInterface, }, }); @@ -187,13 +187,13 @@ export const fetchInterfaceHostAnalysis = async ( }; export const fetchInterfaceHostProtocolAnalysis = async ( - sinceMinutes = 60, + sinceMinutes: number | null = null, limitPerInterface = 50, limitProtocolsPerHost = 12, ): Promise => { const res = await api.get('/analysis/interface-host-protocols', { params: { - since_minutes: sinceMinutes, + since_minutes: sinceMinutes ?? undefined, limit_per_interface: limitPerInterface, limit_protocols_per_host: limitProtocolsPerHost, }, diff --git a/frontend/src/pages/Analysis.tsx b/frontend/src/pages/Analysis.tsx index 5611342..fcf98fb 100644 --- a/frontend/src/pages/Analysis.tsx +++ b/frontend/src/pages/Analysis.tsx @@ -544,7 +544,7 @@ function ProtocolHeatmap({ data }: { data: TopologyData }) { } export default function Analysis(): ReactElement { - const [sinceMinutes, setSinceMinutes] = useState(60); + const [sinceMinutes, setSinceMinutes] = useState(null); const [limitPerInterface, setLimitPerInterface] = useState(50); const [limitProtocolsPerHost, setLimitProtocolsPerHost] = useState(12); const [data, setData] = useState(null); @@ -628,8 +628,14 @@ export default function Analysis(): ReactElement { Look back - setSinceMinutes(value ?? 60)} /> - minutes + setSinceMinutes(value == null ? null : Number(value))} + /> + minutes, blank = all history Max hosts per interface