You've already forked DataMate
refactor(menu): 调整菜单结构并更新数据管理标题
- 将数据管理菜单项标题从"数据管理"改为"数集管理" - 重新排列菜单项顺序,将数据标注和内容生成功能移至数据管理后 - 数据集统计页面标题从"数据管理"更新为"数据集统计" - 移除重复的数据标注和内容生成菜单配置项
This commit is contained in:
@@ -8,8 +8,8 @@ import {
|
||||
} from "@ant-design/icons";
|
||||
import TagManager from "@/components/business/TagManagement";
|
||||
import { Link, useNavigate } from "react-router";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { SearchControls } from "@/components/SearchControls";
|
||||
import CardView from "@/components/CardView";
|
||||
import type { Dataset } from "@/pages/DataManagement/dataset.model";
|
||||
@@ -36,19 +36,19 @@ export default function DatasetManagementPage() {
|
||||
const [editDatasetOpen, setEditDatasetOpen] = useState(false);
|
||||
const [currentDataset, setCurrentDataset] = useState<Dataset | null>(null);
|
||||
const [showUploadDialog, setShowUploadDialog] = useState(false);
|
||||
const [statisticsData, setStatisticsData] = useState<StatisticsData>({
|
||||
count: [],
|
||||
size: [],
|
||||
});
|
||||
const [statisticsData, setStatisticsData] = useState<StatisticsData>({
|
||||
count: [],
|
||||
size: [],
|
||||
});
|
||||
|
||||
async function fetchStatistics() {
|
||||
const { data } = await getDatasetStatisticsUsingGet();
|
||||
|
||||
const statistics: StatisticsData = {
|
||||
size: [
|
||||
{
|
||||
title: "数据集总数",
|
||||
value: data?.totalDatasets || 0,
|
||||
const statistics: StatisticsData = {
|
||||
size: [
|
||||
{
|
||||
title: "数据集总数",
|
||||
value: data?.totalDatasets || 0,
|
||||
},
|
||||
{
|
||||
title: "文件总数",
|
||||
@@ -76,10 +76,10 @@ export default function DatasetManagementPage() {
|
||||
title: "视频",
|
||||
value: data?.count?.video || 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
setStatisticsData(statistics);
|
||||
}
|
||||
],
|
||||
};
|
||||
setStatisticsData(statistics);
|
||||
}
|
||||
|
||||
const [tags, setTags] = useState<string[]>([]);
|
||||
|
||||
@@ -136,9 +136,9 @@ export default function DatasetManagementPage() {
|
||||
message.success("数据集下载成功");
|
||||
};
|
||||
|
||||
const handleDeleteDataset = async (id: string) => {
|
||||
if (!id) return;
|
||||
await deleteDatasetByIdUsingDelete(id);
|
||||
const handleDeleteDataset = async (id: string) => {
|
||||
if (!id) return;
|
||||
await deleteDatasetByIdUsingDelete(id);
|
||||
fetchData({ pageOffset: 0 });
|
||||
message.success("数据删除成功");
|
||||
};
|
||||
@@ -223,12 +223,12 @@ export default function DatasetManagementPage() {
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
render: (status: DatasetStatusMeta) => {
|
||||
return (
|
||||
<Tag icon={status?.icon} color={status?.color}>
|
||||
{status?.label}
|
||||
</Tag>
|
||||
);
|
||||
render: (status: DatasetStatusMeta) => {
|
||||
return (
|
||||
<Tag icon={status?.icon} color={status?.color}>
|
||||
{status?.label}
|
||||
</Tag>
|
||||
);
|
||||
},
|
||||
width: 120,
|
||||
},
|
||||
@@ -274,10 +274,10 @@ export default function DatasetManagementPage() {
|
||||
key: "actions",
|
||||
width: 200,
|
||||
fixed: "right",
|
||||
render: (_: unknown, record: Dataset) => (
|
||||
<div className="flex items-center gap-2">
|
||||
{operations.map((op) => (
|
||||
<Tooltip key={op.key} title={op.label}>
|
||||
render: (_: unknown, record: Dataset) => (
|
||||
<div className="flex items-center gap-2">
|
||||
{operations.map((op) => (
|
||||
<Tooltip key={op.key} title={op.label}>
|
||||
<Button
|
||||
type="text"
|
||||
icon={op.icon}
|
||||
@@ -329,7 +329,7 @@ export default function DatasetManagementPage() {
|
||||
<div className="gap-4 h-full flex flex-col">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-bold">数据管理</h1>
|
||||
<h1 className="text-xl font-bold">数据集统计</h1>
|
||||
<div className="flex gap-2 items-center">
|
||||
{/* tasks */}
|
||||
<TagManager
|
||||
@@ -353,13 +353,13 @@ export default function DatasetManagementPage() {
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
<Card>
|
||||
<div className="grid grid-cols-3">
|
||||
{statisticsData.size.map((item) => (
|
||||
<Statistic
|
||||
title={item.title}
|
||||
key={item.title}
|
||||
value={`${item.value}`}
|
||||
/>
|
||||
))}
|
||||
{statisticsData.size.map((item) => (
|
||||
<Statistic
|
||||
title={item.title}
|
||||
key={item.title}
|
||||
value={`${item.value}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
@@ -396,22 +396,22 @@ export default function DatasetManagementPage() {
|
||||
updateEvent="update:datasets"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type StatisticsItem = {
|
||||
title: string;
|
||||
value: number | string;
|
||||
};
|
||||
|
||||
type StatisticsData = {
|
||||
count: StatisticsItem[];
|
||||
size: StatisticsItem[];
|
||||
};
|
||||
|
||||
type DatasetStatusMeta = {
|
||||
label: string;
|
||||
value: string;
|
||||
color: string;
|
||||
icon: ReactNode;
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
type StatisticsItem = {
|
||||
title: string;
|
||||
value: number | string;
|
||||
};
|
||||
|
||||
type StatisticsData = {
|
||||
count: StatisticsItem[];
|
||||
size: StatisticsItem[];
|
||||
};
|
||||
|
||||
type DatasetStatusMeta = {
|
||||
label: string;
|
||||
value: string;
|
||||
color: string;
|
||||
icon: ReactNode;
|
||||
};
|
||||
|
||||
@@ -24,11 +24,25 @@ export const menuItems = [
|
||||
// },
|
||||
{
|
||||
id: "management",
|
||||
title: "数据管理",
|
||||
title: "数集管理",
|
||||
icon: FolderOpen,
|
||||
description: "创建、导入和管理数据集",
|
||||
color: "bg-blue-500",
|
||||
},
|
||||
{
|
||||
id: "annotation",
|
||||
title: "数据标注",
|
||||
icon: Tag,
|
||||
description: "对数据进行标注和标记",
|
||||
color: "bg-green-500",
|
||||
},
|
||||
{
|
||||
id: "content-generation",
|
||||
title: "内容生成",
|
||||
icon: Sparkles,
|
||||
description: "智能内容生成与创作",
|
||||
color: "bg-purple-500",
|
||||
},
|
||||
{
|
||||
id: "knowledge-management",
|
||||
title: "知识管理",
|
||||
@@ -43,20 +57,6 @@ export const menuItems = [
|
||||
// description: "数据清洗和预处理",
|
||||
// color: "bg-purple-500",
|
||||
// },
|
||||
{
|
||||
id: "annotation",
|
||||
title: "数据标注",
|
||||
icon: Tag,
|
||||
description: "对数据进行标注和标记",
|
||||
color: "bg-green-500",
|
||||
},
|
||||
{
|
||||
id: "content-generation",
|
||||
title: "内容生成",
|
||||
icon: Sparkles,
|
||||
description: "智能内容生成与创作",
|
||||
color: "bg-purple-500",
|
||||
},
|
||||
// {
|
||||
// id: "synthesis",
|
||||
// title: "数据合成",
|
||||
|
||||
Reference in New Issue
Block a user