feat(q1): 前端类型安全治理完成 — any 83→40, P0 全部 done
- types/monitor.ts: 新增 6 个运行时记录类型(AlertEventRecord/AlertRuleRecord/ AgentHostRecord/CronJobRecord/CertExpiryRecord/ApprovalWorkflowStepRecord) - types/common.ts: 新增 OptionItem 通用下拉类型 - 组件级 any 清理 43 处: - AlertEventsTab/AlertRulesTab/AlertChannelDialog/alertShared (19处) - AuditOperationsTab normalizeLog + 筛选器 (8处) - CronJobManager 任务列表/编辑/操作 (6处) - AgentMonitor 主机列表/命令执行 (5处) - DashboardRecent 5 张卡片组件 (5处) - AlertManager 状态类型对齐 (联动修复) - Dashboard.tsx 调用端类型对齐 (联动修复) - AlertChannel 接口新增 test_status 字段 - ESLint any: 83→40 (<50 目标达成) - tsc -b / tsc --noEmit: 零错误 - npm run build: ✓ built in 17.11s - 9/9 核心 API 回归通过
This commit is contained in:
1 parent
0535f30c87
commit
bb2b91ebe0
15 files changed
+259
-93
No files matched your search
@@ -14,13 +14,14 @@ import {
|
||||
} from '@/components/ui/table';
|
||||
import { Search, AlertTriangle, Bell, CheckCircle, Loader2 } from 'lucide-react';
|
||||
import { alertApi } from '@/api';
|
||||
import type { AlertEventRecord } from '@/types';
|
||||
|
||||
export function AlertEventsTab({
|
||||
alerts,
|
||||
loading,
|
||||
onReload,
|
||||
}: {
|
||||
alerts: any[];
|
||||
alerts: AlertEventRecord[];
|
||||
loading: boolean;
|
||||
onReload: () => void;
|
||||
}) {
|
||||
@@ -38,7 +39,7 @@ export function AlertEventsTab({
|
||||
return matchesSearch && matchesSeverity && matchesStatus;
|
||||
});
|
||||
|
||||
const getSeverityBadge = ( severity: any) => {
|
||||
const getSeverityBadge = ( severity: string) => {
|
||||
switch (severity) {
|
||||
case 'critical':
|
||||
return (
|
||||
@@ -66,7 +67,7 @@ export function AlertEventsTab({
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusBadge = ( status: any) => {
|
||||
const getStatusBadge = ( status: string) => {
|
||||
switch (status) {
|
||||
case 'firing':
|
||||
return (
|
||||
@@ -85,7 +86,7 @@ export function AlertEventsTab({
|
||||
}
|
||||
};
|
||||
|
||||
const handleAcknowledge = async ( id: any) => {
|
||||
const handleAcknowledge = async ( id: number) => {
|
||||
try {
|
||||
await alertApi.acknowledge(id);
|
||||
onReload();
|
||||
|
||||
Reference in new issue
Block a user