feat(worker-monitor): update task/worker pages and add celery task display

This commit is contained in:
chengkai3
2026-05-03 16:40:47 +08:00
parent 31f747785a
commit 7545b56e26
3 changed files with 21 additions and 2 deletions
+2 -1
View File
@@ -27,6 +27,7 @@ import {
import { useAuth } from "@/components/auth-provider";
import { readApiError } from "@/lib/api";
import { getTaskDisplayName } from "@/lib/celery-task-display";
const { Text } = Typography;
const AntCard = Card as unknown as ComponentType<CardProps>;
@@ -278,7 +279,7 @@ export default function AdminTaskMonitorPage() {
dataIndex: "name",
key: "name",
width: 220,
render: (value: string) => value || "-",
render: (value: string) => getTaskDisplayName(value),
},
{
title: "状态",
+2 -1
View File
@@ -28,6 +28,7 @@ import {
import { useAuth } from "@/components/auth-provider";
import { readApiError } from "@/lib/api";
import { getTaskDisplayName } from "@/lib/celery-task-display";
const { Text } = Typography;
const AntCard = Card as unknown as ComponentType<CardProps>;
@@ -280,7 +281,7 @@ export default function AdminWorkersPage() {
dataIndex: "name",
key: "name",
width: 220,
render: (value: string) => value || "-",
render: (value: string) => getTaskDisplayName(value),
},
{
title: "状态",
+17
View File
@@ -0,0 +1,17 @@
const TASK_NAME_LABELS: Record<string, string> = {
"app.tasks.schedule_tasks.expire_overdue_schedule_items": "日程过期自动归档",
"app.tasks.worker_registry_tasks.sweep_worker_registry_offline": "Worker 离线巡检",
"app.tasks.elevation_tasks.apply_elevation_for_line_job": "线路高程回填",
};
export function getTaskDisplayName(taskName: string | null | undefined): string {
const normalized = (taskName || "").trim();
if (!normalized) {
return "-";
}
const label = TASK_NAME_LABELS[normalized];
if (!label) {
return normalized;
}
return `${label} (${normalized})`;
}