Files
DataMate/frontend/src/pages/DataManagement/Create/components/BasicInformation.tsx
hefanli ccfb84c034 feature: add mysql collection and starrocks collection (#222)
* fix: fix the path for backend-python imaage building

* feature: add mysql collection and starrocks collection

* feature: add mysql collection and starrocks collection

* fix: change the permission of those files which collected from nfs to 754

* fix: delete collected files, config files and log files while deleting collection task

* fix: add the collection task detail api

* fix: change the log of collecting for dataset

* fix: add collection task selecting while creating and updating dataset

* fix: set the umask value to 0022 for java process
2026-01-04 19:05:08 +08:00

106 lines
2.9 KiB
TypeScript

import RadioCard from "@/components/RadioCard";
import { Input, Select, Form } from "antd";
import { datasetTypes } from "../../dataset.const";
import { useEffect, useState } from "react";
import { queryDatasetTagsUsingGet } from "../../dataset.api";
import {queryTasksUsingGet} from "@/pages/DataCollection/collection.apis.ts";
export default function BasicInformation({
data,
setData,
hidden = [],
}: {
data: any;
setData: any;
hidden?: string[];
}) {
const [tagOptions, setTagOptions] = useState<
{
label: JSX.Element;
title: string;
options: { label: JSX.Element; value: string }[];
}[]
>([]);
const [collectionOptions, setCollectionOptions] = useState([]);
// 获取标签
const fetchTags = async () => {
if (hidden.includes("tags")) return;
try {
const { data } = await queryDatasetTagsUsingGet();
const customTags = data.map((tag) => ({
label: tag.name,
value: tag.name,
}));
setTagOptions(customTags);
} catch (error) {
console.error("Error fetching tags: ", error);
}
};
// 获取归集任务
const fetchCollectionTasks = async () => {
try {
const res = await queryTasksUsingGet({ page: 0, size: 100 });
const options = res.data.content.map((task: any) => ({
label: task.name,
value: task.id,
}));
setCollectionOptions(options);
} catch (error) {
console.error("Error fetching collection tasks:", error);
}
};
useEffect(() => {
fetchTags();
fetchCollectionTasks();
}, []);
return (
<>
<Form.Item
label="名称"
name="name"
rules={[{ required: true, message: "请输入数据集名称" }]}
>
<Input placeholder="输入数据集名称" />
</Form.Item>
{!hidden.includes("description") && (
<Form.Item name="description" label="描述">
<Input.TextArea placeholder="描述数据集的用途和内容" rows={3} />
</Form.Item>
)}
{/* 数据集类型选择 - 使用卡片形式 */}
{!hidden.includes("datasetType") && (
<Form.Item
label="类型"
name="datasetType"
rules={[{ required: true, message: "请选择数据集类型" }]}
>
<RadioCard
options={datasetTypes}
value={data.type}
onChange={(datasetType) => setData({ ...data, datasetType })}
/>
</Form.Item>
)}
{!hidden.includes("tags") && (
<Form.Item label="标签" name="tags">
<Select
className="w-full"
mode="tags"
options={tagOptions}
placeholder="请选择标签"
/>
</Form.Item>
)}
{!hidden.includes("dataSource") && (
<Form.Item name="dataSource" label="关联归集任务">
<Select placeholder="请选择归集任务" options={collectionOptions} />
</Form.Item>
)}
</>
);
}