Q3: api.ts 拆分 [done] - services/api.ts (1323L) → services/api/ 目录 12 个域文件 + index.ts - 域划分: auth/dashboard/server/kubernetes/deploy/automation/monitor/agent/cloud/system/ai - 每文件 < 300 行 (kubernetes.ts 409L 为例外: 78方法单一模块) - index.ts 统一 re-export, 97个import文件零改动 - 31个API对象 + 3个类型定义 + 264个async方法全部保留 - tsc -b 零错误, npm run build ✓ built in 13.85s Q1: 构建修复 [in_progress] - 修复781处tsc -b错误(unknown属性访问/隐式any/类型不匹配) - 移除已删除Ansible组件的导入和路由 - 修复DeploymentView/Header/Sidebar的_前缀解构bug - 回退不安全unknown→any (skill规定的安全矩阵) - 放宽noImplicitAny(临时), ESLint: unused=0, console=0 - any=1041 → 后续Q1工作逐步用interface替代
23 lines
746 B
TypeScript
23 lines
746 B
TypeScript
// Dashboard 统计数据
|
|
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
|
|
|
import { http } from '../http';
|
|
import { isOnline, timeAgo, asList } from '../../components/agent/agentUtils';
|
|
|
|
export const dashboardStatsApi = {
|
|
getStats: async () => {
|
|
return http.get('/dashboard/stats');
|
|
},
|
|
getAlerts: async (limit?: number) => {
|
|
return http.get('/dashboard/recent-alerts', limit ? { limit } : undefined);
|
|
},
|
|
getReleases: async (limit?: number) => {
|
|
return http.get('/dashboard/recent-releases', limit ? { limit } : undefined);
|
|
},
|
|
getMetrics: async (hours?: number) => {
|
|
return http.get('/dashboard/metrics', hours ? { hours } : undefined);
|
|
},
|
|
};
|
|
|
|
// ==================== 服务器管理 API ====================
|