1
0

refactor: 全面重构前端 Dashboard 为 TDesign + TanStack Query 分组表格布局

- 卡片式布局改为分组 PrimaryTable,Modal 改为 Drawer
- 手写 hooks 替换为 TanStack Query(轮询/缓存/条件查询)
- CSS 607行精简至73行,颜色迁移至 TDesign tokens
- 可用率进度条颜色按 10% 一档红→绿渐变
- 新增纯函数测试 34 项全通过(排序/筛选/色阶阈值)
- 同步更新主 specs 并归档变更文档
This commit is contained in:
2026-05-12 01:06:53 +08:00
parent 48b40238b8
commit f48e39a615
41 changed files with 1314 additions and 1302 deletions

View File

@@ -0,0 +1,24 @@
const AVAILABILITY_COLORS = [
"#d54941", // 0-10%
"#d96241", // 10-20%
"#e37318", // 20-30%
"#e89318", // 30-40%
"#d9a818", // 40-50%
"#b8b020", // 50-60%
"#8dba30", // 60-70%
"#6dba3f", // 70-80%
"#4dba50", // 80-90%
"#3dba60", // 90-100%
];
export function getAvailabilityProgressColor(availability: number): string {
const index = Math.min(Math.floor(availability / 10), 9);
return AVAILABILITY_COLORS[index]!;
}
export function getLatencyColor(ms: number): string {
if (ms <= 100) return "var(--td-success-color)";
if (ms <= 500) return "var(--td-warning-color)";
return "var(--td-error-color)";
}