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