You've already forked DataMate
feat(annotation): 添加标注任务进行中数据显示功能
- 新增 AnnotationTaskListItem 和相关类型定义 - 在前端页面中添加标注中列显示进行中的标注数据量 - 更新数据获取逻辑以支持进行中标注数量统计 - 修改后端服务层添加 in_progress_count 字段映射 - 优化类型安全和代码结构设计
This commit is contained in:
@@ -6,6 +6,64 @@ import {
|
||||
CloseCircleOutlined,
|
||||
} from "@ant-design/icons";
|
||||
|
||||
type AnnotationTaskStatistics = {
|
||||
accuracy?: number | string;
|
||||
averageTime?: number | string;
|
||||
reviewCount?: number | string;
|
||||
};
|
||||
|
||||
type AnnotationTaskPayload = {
|
||||
id?: string;
|
||||
labelingProjId?: string;
|
||||
labelingProjectId?: string;
|
||||
projId?: string;
|
||||
labeling_project_id?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
datasetId?: string;
|
||||
datasetName?: string;
|
||||
dataset_name?: string;
|
||||
totalCount?: number;
|
||||
total_count?: number;
|
||||
annotatedCount?: number;
|
||||
annotated_count?: number;
|
||||
inProgressCount?: number;
|
||||
in_progress_count?: number;
|
||||
segmentationEnabled?: boolean;
|
||||
segmentation_enabled?: boolean;
|
||||
createdAt?: string;
|
||||
created_at?: string;
|
||||
updatedAt?: string;
|
||||
updated_at?: string;
|
||||
status?: string;
|
||||
statistics?: AnnotationTaskStatistics;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
export type AnnotationTaskListItem = {
|
||||
id?: string;
|
||||
labelingProjId?: string;
|
||||
projId?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
datasetId?: string;
|
||||
datasetName?: string;
|
||||
totalCount?: number;
|
||||
annotatedCount?: number;
|
||||
inProgressCount?: number;
|
||||
segmentationEnabled?: boolean;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
icon?: JSX.Element;
|
||||
iconColor?: string;
|
||||
status?: {
|
||||
label: string;
|
||||
color: string;
|
||||
};
|
||||
statistics?: { label: string; value: string | number }[];
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
export const AnnotationTaskStatusMap = {
|
||||
[AnnotationTaskStatus.ACTIVE]: {
|
||||
label: "活跃",
|
||||
@@ -27,9 +85,11 @@ export const AnnotationTaskStatusMap = {
|
||||
},
|
||||
};
|
||||
|
||||
export function mapAnnotationTask(task: any) {
|
||||
export function mapAnnotationTask(task: AnnotationTaskPayload): AnnotationTaskListItem {
|
||||
// Normalize labeling project id from possible backend field names
|
||||
const labelingProjId = task?.labelingProjId || task?.labelingProjectId || task?.projId || task?.labeling_project_id || "";
|
||||
const segmentationEnabled = task?.segmentationEnabled ?? task?.segmentation_enabled ?? false;
|
||||
const inProgressCount = task?.inProgressCount ?? task?.in_progress_count ?? 0;
|
||||
|
||||
const statsArray = task?.statistics
|
||||
? [
|
||||
@@ -45,6 +105,8 @@ export function mapAnnotationTask(task: any) {
|
||||
// provide consistent field for components
|
||||
labelingProjId,
|
||||
projId: labelingProjId,
|
||||
segmentationEnabled,
|
||||
inProgressCount,
|
||||
name: task.name,
|
||||
description: task.description || "",
|
||||
datasetName: task.datasetName || task.dataset_name || "-",
|
||||
@@ -478,4 +540,4 @@ export const TemplateTypeMap = {
|
||||
label: "自定义",
|
||||
value: TemplateType.CUSTOM
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user