- AbnormalTracks: 유형별 통계, 일별 추이 차트, 검출 목록 테이블 - abnormalApi 클라이언트 (recent, summary, types) - ApiMetrics: 시스템 메트릭, 캐시 상세(L1/L2/L3/AIS), 처리 지연, 히트율 - 10초 폴링으로 실시간 갱신 - i18n: abnormal.* 17키 + metrics.* 21키 한/영 추가 - 전체 7개 페이지 라우팅 완성 (Navbar 메뉴 전부 활성) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { fetchJson } from './httpClient.ts'
|
|
|
|
export interface AbnormalTrack {
|
|
id: number
|
|
mmsi: string
|
|
timeBucket: string
|
|
abnormalType: string
|
|
typeDescription: string
|
|
abnormalDescription: string
|
|
distanceNm: number
|
|
avgSpeed: number
|
|
maxSpeed: number
|
|
pointCount: number
|
|
sourceTable: string
|
|
detectedAt: string
|
|
details: Record<string, unknown>
|
|
trackGeoJson: { type: string; coordinates: number[][] } | null
|
|
}
|
|
|
|
export interface AbnormalStats {
|
|
statDate: string
|
|
abnormalType: string
|
|
vesselCount: number
|
|
trackCount: number
|
|
totalPoints: number
|
|
avgDeviation: number
|
|
maxDeviation: number
|
|
}
|
|
|
|
export interface AbnormalSummary {
|
|
type_count: number
|
|
total_tracks: number
|
|
vessel_count: number
|
|
avg_distance: number
|
|
max_speed_detected: number
|
|
typeStatistics: { abnormal_type: string; count: number; vessel_count: number }[]
|
|
dailyTrend: { date: string; count: number }[]
|
|
}
|
|
|
|
export const abnormalApi = {
|
|
getRecent(hours = 24): Promise<AbnormalTrack[]> {
|
|
return fetchJson(`/api/v1/abnormal-tracks/recent?hours=${hours}`)
|
|
},
|
|
|
|
getStatisticsSummary(days = 7): Promise<AbnormalSummary> {
|
|
return fetchJson(`/api/v1/abnormal-tracks/statistics/summary?days=${days}`)
|
|
},
|
|
|
|
getTypes(): Promise<Record<string, string>> {
|
|
return fetchJson('/api/v1/abnormal-tracks/types')
|
|
},
|
|
}
|