feat(worker-monitor): update task/worker pages and add celery task display
This commit is contained in:
@@ -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: "状态",
|
||||
|
||||
@@ -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: "状态",
|
||||
|
||||
@@ -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})`;
|
||||
}
|
||||
Reference in New Issue
Block a user