db test
This commit is contained in:
@@ -71,10 +71,10 @@ class InterfaceHostProtocolAnalysisResponse(BaseModel):
|
|||||||
@router.get("/interface-hosts", response_model=InterfaceHostAnalysisResponse)
|
@router.get("/interface-hosts", response_model=InterfaceHostAnalysisResponse)
|
||||||
async def analysis_interface_hosts(
|
async def analysis_interface_hosts(
|
||||||
since_minutes: Optional[int] = Query(
|
since_minutes: Optional[int] = Query(
|
||||||
60,
|
None,
|
||||||
ge=1,
|
ge=1,
|
||||||
le=60 * 24 * 30,
|
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(
|
limit_per_interface: int = Query(
|
||||||
100,
|
100,
|
||||||
@@ -104,10 +104,10 @@ async def analysis_interface_hosts(
|
|||||||
@router.get("/interface-host-protocols", response_model=InterfaceHostProtocolAnalysisResponse)
|
@router.get("/interface-host-protocols", response_model=InterfaceHostProtocolAnalysisResponse)
|
||||||
async def analysis_interface_host_protocols(
|
async def analysis_interface_host_protocols(
|
||||||
since_minutes: Optional[int] = Query(
|
since_minutes: Optional[int] = Query(
|
||||||
60,
|
None,
|
||||||
ge=1,
|
ge=1,
|
||||||
le=60 * 24 * 30,
|
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(
|
limit_per_interface: int = Query(
|
||||||
50,
|
50,
|
||||||
|
|||||||
@@ -174,12 +174,12 @@ export const clearPackets = async (): Promise<any> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const fetchInterfaceHostAnalysis = async (
|
export const fetchInterfaceHostAnalysis = async (
|
||||||
sinceMinutes = 60,
|
sinceMinutes: number | null = null,
|
||||||
limitPerInterface = 100,
|
limitPerInterface = 100,
|
||||||
): Promise<InterfaceHostAnalysisResponse> => {
|
): Promise<InterfaceHostAnalysisResponse> => {
|
||||||
const res = await api.get<InterfaceHostAnalysisResponse>('/analysis/interface-hosts', {
|
const res = await api.get<InterfaceHostAnalysisResponse>('/analysis/interface-hosts', {
|
||||||
params: {
|
params: {
|
||||||
since_minutes: sinceMinutes,
|
since_minutes: sinceMinutes ?? undefined,
|
||||||
limit_per_interface: limitPerInterface,
|
limit_per_interface: limitPerInterface,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -187,13 +187,13 @@ export const fetchInterfaceHostAnalysis = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const fetchInterfaceHostProtocolAnalysis = async (
|
export const fetchInterfaceHostProtocolAnalysis = async (
|
||||||
sinceMinutes = 60,
|
sinceMinutes: number | null = null,
|
||||||
limitPerInterface = 50,
|
limitPerInterface = 50,
|
||||||
limitProtocolsPerHost = 12,
|
limitProtocolsPerHost = 12,
|
||||||
): Promise<InterfaceHostProtocolAnalysisResponse> => {
|
): Promise<InterfaceHostProtocolAnalysisResponse> => {
|
||||||
const res = await api.get<InterfaceHostProtocolAnalysisResponse>('/analysis/interface-host-protocols', {
|
const res = await api.get<InterfaceHostProtocolAnalysisResponse>('/analysis/interface-host-protocols', {
|
||||||
params: {
|
params: {
|
||||||
since_minutes: sinceMinutes,
|
since_minutes: sinceMinutes ?? undefined,
|
||||||
limit_per_interface: limitPerInterface,
|
limit_per_interface: limitPerInterface,
|
||||||
limit_protocols_per_host: limitProtocolsPerHost,
|
limit_protocols_per_host: limitProtocolsPerHost,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ function ProtocolHeatmap({ data }: { data: TopologyData }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Analysis(): ReactElement {
|
export default function Analysis(): ReactElement {
|
||||||
const [sinceMinutes, setSinceMinutes] = useState(60);
|
const [sinceMinutes, setSinceMinutes] = useState<number | null>(null);
|
||||||
const [limitPerInterface, setLimitPerInterface] = useState(50);
|
const [limitPerInterface, setLimitPerInterface] = useState(50);
|
||||||
const [limitProtocolsPerHost, setLimitProtocolsPerHost] = useState(12);
|
const [limitProtocolsPerHost, setLimitProtocolsPerHost] = useState(12);
|
||||||
const [data, setData] = useState<InterfaceHostProtocolAnalysisResponse | null>(null);
|
const [data, setData] = useState<InterfaceHostProtocolAnalysisResponse | null>(null);
|
||||||
@@ -628,8 +628,14 @@ export default function Analysis(): ReactElement {
|
|||||||
<Space wrap size={[12, 12]}>
|
<Space wrap size={[12, 12]}>
|
||||||
<Space>
|
<Space>
|
||||||
<Text>Look back</Text>
|
<Text>Look back</Text>
|
||||||
<InputNumber min={1} max={60 * 24 * 30} value={sinceMinutes} onChange={(value) => setSinceMinutes(value ?? 60)} />
|
<InputNumber
|
||||||
<Text type="secondary">minutes</Text>
|
min={1}
|
||||||
|
max={60 * 24 * 30}
|
||||||
|
value={sinceMinutes}
|
||||||
|
placeholder="All history"
|
||||||
|
onChange={(value) => setSinceMinutes(value == null ? null : Number(value))}
|
||||||
|
/>
|
||||||
|
<Text type="secondary">minutes, blank = all history</Text>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<Space>
|
||||||
<Text>Max hosts per interface</Text>
|
<Text>Max hosts per interface</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user