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
@@ -17,6 +17,7 @@ import { Settings, Trash2 } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { alertApi } from '@/api';
|
||||
import { renderRuleChannels } from './alertShared';
|
||||
import type { AlertChannel, AlertRuleRecord } from '@/types';
|
||||
|
||||
const COL_SPAN = 9; // 复选框 + 7 数据列 + 操作列 // Logan.Li
|
||||
|
||||
@@ -26,10 +27,10 @@ export function AlertRulesTab({
|
||||
onReload,
|
||||
onEditRule,
|
||||
}: {
|
||||
rules: any[];
|
||||
notifyChannels: any[];
|
||||
rules: AlertRuleRecord[];
|
||||
notifyChannels: AlertChannel[];
|
||||
onReload: () => void;
|
||||
onEditRule: ( rule: any) => void;
|
||||
onEditRule: ( rule: AlertRuleRecord) => void;
|
||||
}) {
|
||||
const confirm = useConfirm();
|
||||
const [selectedIds, setSelectedIds] = useState<number[]>([]);
|
||||
@@ -50,7 +51,7 @@ export function AlertRulesTab({
|
||||
);
|
||||
};
|
||||
|
||||
const handleDeleteRule = async ( id: any) => {
|
||||
const handleDeleteRule = async ( id: number) => {
|
||||
const ok = await confirm({
|
||||
title: '删除告警规则',
|
||||
description: '确定删除此告警规则?',
|
||||
@@ -89,7 +90,7 @@ export function AlertRulesTab({
|
||||
}
|
||||
};
|
||||
|
||||
const handleToggleRule = async ( id: any) => {
|
||||
const handleToggleRule = async ( id: number) => {
|
||||
try {
|
||||
await alertApi.toggleRule(id);
|
||||
onReload();
|
||||
|
||||
Reference in new issue
Block a user