Files
xingrin/frontend/types/search.types.ts
yyhuni db8ecb1644 feat(search): add mock data infrastructure and vulnerability detail integration
- Add comprehensive mock data configuration for all major entities (dashboard, endpoints, organizations, scans, subdomains, targets, vulnerabilities, websites)
- Implement mock service layer with centralized config for development and testing
- Add vulnerability detail dialog integration to search results with lazy loading
- Enhance search result card with vulnerability viewing capability
- Update search materialized view migration to include vulnerability name field
- Implement default host fuzzy search fallback for bare text queries without operators
- Add vulnerability data formatting in search view for consistent API response structure
- Configure Vercel deployment settings and update Next.js configuration
- Update all service layers to support mock data injection for development environment
- Extend search types with improved vulnerability data structure
- Add internationalization strings for vulnerability loading errors
- Enable rapid frontend development and testing without backend API dependency
2026-01-02 19:06:09 +08:00

55 lines
1.2 KiB
TypeScript

// 搜索结果类型
export interface SearchResult {
url: string
host: string
title: string
technologies: string[]
statusCode: number | null
responseHeaders: Record<string, string>
responseBody: string
vulnerabilities: Vulnerability[]
}
export interface Vulnerability {
id?: number
name: string
severity: 'critical' | 'high' | 'medium' | 'low' | 'info' | 'unknown'
vulnType: string
url?: string
}
// 搜索状态
export type SearchState = 'initial' | 'searching' | 'results'
// 搜索响应类型
export interface SearchResponse {
results: SearchResult[]
total: number
page: number
pageSize: number
totalPages: number
}
// 搜索操作符类型
export type SearchOperator = '=' | '==' | '!='
// 单个搜索条件
export interface SearchCondition {
field: string
operator: SearchOperator
value: string
}
// 搜索表达式(支持 AND/OR 组合)
export interface SearchExpression {
conditions: SearchCondition[] // 同一组内的条件用 AND 连接
orGroups?: SearchExpression[] // 多组之间用 OR 连接
}
// 发送给后端的搜索参数
export interface SearchParams {
q?: string // 完整的搜索表达式字符串
page?: number
pageSize?: number
}