feat(data-annotation): 移除标注任务同步功能

- 删除 SyncOutlined 图标导入
- 移除 syncAnnotationTaskUsingPost API 调用
- 简化删除确认对话框内容,移除同步提示信息
- 删除 handleSync 和 handleBatchSync 同步处理函数
- 从操作菜单中移除同步选项
- 从批量操作按钮中移除批量同步功能
- 更新批量删除确认对话框内容
This commit is contained in:
2026-01-18 17:53:31 +08:00
parent 3a3a28d5ea
commit 196cb0b037

View File

@@ -4,7 +4,6 @@ import {
PlusOutlined, PlusOutlined,
EditOutlined, EditOutlined,
DeleteOutlined, DeleteOutlined,
SyncOutlined,
DownloadOutlined, DownloadOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
@@ -15,7 +14,6 @@ import useFetchData from "@/hooks/useFetchData";
import { import {
deleteAnnotationTaskByIdUsingDelete, deleteAnnotationTaskByIdUsingDelete,
queryAnnotationTasksUsingGet, queryAnnotationTasksUsingGet,
syncAnnotationTaskUsingPost,
queryAutoAnnotationTasksUsingGet, queryAutoAnnotationTasksUsingGet,
deleteAutoAnnotationTaskByIdUsingDelete, deleteAutoAnnotationTaskByIdUsingDelete,
} from "../annotation.api"; } from "../annotation.api";
@@ -106,12 +104,7 @@ export default function DataAnnotation() {
const handleDelete = (task: AnnotationTask) => { const handleDelete = (task: AnnotationTask) => {
Modal.confirm({ Modal.confirm({
title: `确认删除标注任务「${task.name}」吗?`, title: `确认删除标注任务「${task.name}」吗?`,
content: ( content: "删除标注任务不会删除对应数据集,但会删除该任务的所有标注结果。",
<div>
<div></div>
<div></div>
</div>
),
okText: "删除", okText: "删除",
okType: "danger", okType: "danger",
cancelText: "取消", cancelText: "取消",
@@ -155,80 +148,13 @@ export default function DataAnnotation() {
}); });
}; };
const handleSync = (task: AnnotationTask, batchSize: number = 50) => {
Modal.confirm({
title: `确认同步标注任务「${task.name}」吗?`,
content: (
<div>
<div></div>
<div></div>
</div>
),
okText: "同步",
cancelText: "取消",
onOk: async () => {
try {
await syncAnnotationTaskUsingPost({ id: task.id, batchSize });
message.success("任务同步请求已发送");
// optional: refresh list/status
fetchData();
// clear selection for the task
setSelectedRowKeys((keys) => keys.filter((k) => k !== task.id));
setSelectedRows((rows) => rows.filter((r) => r.id !== task.id));
} catch (e) {
console.error(e);
message.error("同步失败,请稍后重试");
}
},
});
};
const handleBatchSync = (batchSize: number = 50) => {
if (!selectedRows || selectedRows.length === 0) return;
const manualRows = selectedRows.filter((r) => r._kind !== "auto");
if (manualRows.length === 0) {
message.warning("请选择手动标注任务进行同步");
return;
}
Modal.confirm({
title: `确认同步所选 ${manualRows.length} 个标注任务吗?`,
content: (
<div>
<div></div>
<div></div>
</div>
),
okText: "同步",
cancelText: "取消",
onOk: async () => {
try {
await Promise.all(
manualRows.map((r) => syncAnnotationTaskUsingPost({ id: r.id, batchSize }))
);
message.success("批量同步请求已发送");
fetchData();
setSelectedRowKeys([]);
setSelectedRows([]);
} catch (e) {
console.error(e);
message.error("批量同步失败,请稍后重试");
}
},
});
};
const handleBatchDelete = () => { const handleBatchDelete = () => {
if (!selectedRows || selectedRows.length === 0) return; if (!selectedRows || selectedRows.length === 0) return;
const manualRows = selectedRows.filter((r) => r._kind !== "auto"); const manualRows = selectedRows.filter((r) => r._kind !== "auto");
const autoRows = selectedRows.filter((r) => r._kind === "auto"); const autoRows = selectedRows.filter((r) => r._kind === "auto");
Modal.confirm({ Modal.confirm({
title: `确认删除所选 ${selectedRows.length} 个标注任务吗?`, title: `确认删除所选 ${selectedRows.length} 个标注任务吗?`,
content: ( content: "删除标注任务不会删除对应数据集,但会删除这些任务的所有标注结果。",
<div>
<div></div>
<div></div>
</div>
),
okText: "删除", okText: "删除",
okType: "danger", okType: "danger",
cancelText: "取消", cancelText: "取消",
@@ -270,12 +196,6 @@ export default function DataAnnotation() {
icon: <DownloadOutlined className="w-4 h-4" style={{ color: "#1890ff" }} />, icon: <DownloadOutlined className="w-4 h-4" style={{ color: "#1890ff" }} />,
onClick: handleExport, onClick: handleExport,
}, },
{
key: "sync",
label: "同步",
icon: <SyncOutlined className="w-4 h-4" style={{ color: "#722ed1" }} />,
onClick: handleSync,
},
{ {
key: "delete", key: "delete",
label: "删除", label: "删除",
@@ -501,12 +421,6 @@ export default function DataAnnotation() {
{/* Right side: All action buttons */} {/* Right side: All action buttons */}
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Button
onClick={() => handleBatchSync(50)}
disabled={selectedRowKeys.length === 0}
>
</Button>
<Button <Button
danger danger
onClick={handleBatchDelete} onClick={handleBatchDelete}