CI / changes (push) Successful in 5s
CI / commitlint (push) Skipped
CI / openapi (push) Successful in 28s
CI / web (push) Successful in 1m6s
CI / go (push) Successful in 57s
CI / bird2 (push) Successful in 15s
CI / release (push) Successful in 4m6s
Для FQDN после проверки DOMAINS выполняется live DNS (A/AAAA), каждый IP проверяется по IP_RANGES и snapshots; в ответе resolved_ips / resolved_ip, UI KPI и OpenAPI обновлены. Co-authored-by: Cursor <[email protected]>
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import { Globe, Layers, ListChecks, Radar } from 'lucide-react'
|
|
|
|
import { KpiStatGrid, type KpiStatItem } from '@/components/reui-kit'
|
|
import type { LookupResponse } from '@/types/api'
|
|
|
|
/**
|
|
* Lookup summary KPI — stats-12 via KpiStatGrid.
|
|
* @see https://reui.io/preview/base/stats-12
|
|
*/
|
|
export function LookupSummaryKpi({ data }: { data: LookupResponse }) {
|
|
const entryCount = data.matches.filter((m) => m.layer === 'entry').length
|
|
const snapshotCount = data.matches.filter((m) => m.layer === 'snapshot').length
|
|
const resolvedCount = data.resolved_ips?.length ?? 0
|
|
|
|
const items: KpiStatItem[] = [
|
|
{
|
|
id: 'matched',
|
|
label: 'Результат',
|
|
value: data.matched ? 'Найдено' : 'Не найдено',
|
|
hint: data.normalized,
|
|
icon: <Radar aria-hidden />,
|
|
iconClassName: data.matched
|
|
? 'bg-success text-success-foreground [&_svg]:text-success-foreground'
|
|
: 'bg-muted text-muted-foreground [&_svg]:text-muted-foreground',
|
|
variant: data.matched ? 'default' : 'warning',
|
|
},
|
|
{
|
|
id: 'entry',
|
|
label: 'Слой entry',
|
|
value: entryCount,
|
|
hint: 'сырые списки',
|
|
icon: <ListChecks aria-hidden />,
|
|
iconClassName: 'bg-info text-info-foreground [&_svg]:text-info-foreground',
|
|
},
|
|
{
|
|
id: 'snapshot',
|
|
label: 'Слой snapshot',
|
|
value: snapshotCount,
|
|
hint: 'материализация',
|
|
icon: <Layers aria-hidden />,
|
|
iconClassName: 'bg-focus text-focus-foreground [&_svg]:text-focus-foreground',
|
|
},
|
|
]
|
|
|
|
if (data.query_kind === 'domain') {
|
|
items.push({
|
|
id: 'resolved',
|
|
label: 'DNS IP',
|
|
value: resolvedCount,
|
|
hint: resolvedCount > 0 ? data.resolved_ips?.slice(0, 3).join(', ') : 'нет A/AAAA',
|
|
icon: <Globe aria-hidden />,
|
|
iconClassName: 'bg-primary text-primary-foreground [&_svg]:text-primary-foreground',
|
|
})
|
|
}
|
|
|
|
return (
|
|
<KpiStatGrid
|
|
items={items}
|
|
aria-label={`Запрос: ${data.query_kind} · ${data.query}`}
|
|
/>
|
|
)
|
|
}
|