Skip to content

Commit 485f25f

Browse files
committed
frontend: update data-cleansing
1 parent 7836955 commit 485f25f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3109
-1972
lines changed

frontend/src/components/RadioCard.tsx

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ interface RadioCardOption {
55
value: string;
66
label: string;
77
description?: string;
8-
icon?: React.ReactNode;
8+
icon?: SVGAElement | React.FC<React.SVGProps<SVGElement>>;
99
color?: string;
1010
}
1111

@@ -30,24 +30,38 @@ const RadioCard: React.FC<RadioCardProps> = ({
3030
style={{ gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))" }}
3131
>
3232
{options.map((option) => (
33-
<Card
33+
<div
3434
key={option.value}
35-
hoverable
35+
className="border border-gray-200 rounded-lg hover:shadow-lg p-4 text-center"
3636
style={{
3737
borderColor: value === option.value ? "#1677ff" : undefined,
3838
background: value === option.value ? "#e6f7ff" : undefined,
3939
cursor: "pointer",
4040
}}
4141
onClick={() => onChange(option.value)}
4242
>
43-
<div className="flex items-center gap-2 mb-2">
44-
{option.icon && <span className="text-xl">{option.icon}</span>}
45-
<span className="font-bold">{option.label}</span>
46-
</div>
43+
<option.icon
44+
className={`w-8 h-8 mx-auto mb-2 ${
45+
value === option.value ? "text-blue-500" : "text-gray-400"
46+
}`}
47+
/>
48+
<h3
49+
className={`font-medium text-sm mb-1 ${
50+
value === option.value ? "text-blue-500" : "text-gray-900"
51+
}`}
52+
>
53+
{option.label}
54+
</h3>
4755
{option.description && (
48-
<div className="color-gray-500 text-sm">{option.description}</div>
56+
<div
57+
className={`text-xs ${
58+
value === option.value ? "text-blue-500" : "text-gray-500"
59+
}`}
60+
>
61+
{option.description}
62+
</div>
4963
)}
50-
</Card>
64+
</div>
5165
))}
5266
</div>
5367
);

frontend/src/components/TagManagement.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const TagManager: React.FC = ({
115115
// 获取标签列表
116116
const fetchTags = async () => {
117117
try {
118-
const data = await onFetch?.();
118+
const { data } = await onFetch?.();
119119
setTags(data || []);
120120
} catch (e) {
121121
message.error("获取标签失败");

frontend/src/hooks/useFetchData.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function useFetchData<T>(
5757
const { keywords, filter, current, pageSize } = searchParams;
5858
Loading.show();
5959
setLoading(true);
60-
const data = await fetchFunc({
60+
const { data } = await fetchFunc({
6161
...filter,
6262
keywords,
6363
type: getFirstOfArray(filter?.type) || undefined,
@@ -77,6 +77,8 @@ export default function useFetchData<T>(
7777
setTableData(result);
7878
Loading.hide();
7979
setLoading(false);
80+
console.log(data);
81+
8082
console.log(data, result.map(mapDataFunc));
8183
}
8284

frontend/src/mock/cleansing.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { OperatorI } from "@/pages/DataCleansing/cleansing.interface";
1+
import type { OperatorI } from "@/pages/DataCleansing/cleansing.model";
22
import {
33
DatabaseOutlined,
44
FilterOutlined,
@@ -11,6 +11,7 @@ import {
1111
AimOutlined,
1212
SwapOutlined,
1313
} from "@ant-design/icons";
14+
import { FileImage, FileText, Music, Repeat, Video } from "lucide-react";
1415

1516
export const MOCK_TASKS = [
1617
{
@@ -131,31 +132,31 @@ export const templateTypes = [
131132
{
132133
value: "text",
133134
label: "文本",
134-
icon: "📝",
135+
icon: FileText,
135136
description: "处理文本数据的清洗模板",
136137
},
137138
{
138139
value: "image",
139140
label: "图片",
140-
icon: "🖼️",
141+
icon: FileImage,
141142
description: "处理图像数据的清洗模板",
142143
},
143144
{
144145
value: "video",
145146
label: "视频",
146-
icon: "🎥",
147+
icon: Video,
147148
description: "处理视频数据的清洗模板",
148149
},
149150
{
150151
value: "audio",
151152
label: "音频",
152-
icon: "🎵",
153+
icon: Music,
153154
description: "处理音频数据的清洗模板",
154155
},
155156
{
156157
value: "image-to-text",
157158
label: "图片转文本",
158-
icon: "🔄",
159+
icon: Repeat,
159160
description: "图像识别转文本的处理模板",
160161
},
161162
];
@@ -183,8 +184,8 @@ const generateOperatorTemplates = (): OperatorI[] => {
183184
icon: <DatabaseOutlined />,
184185
description: "从MySQL数据库读取数据",
185186
tags: ["数据库", "读取", "MySQL"],
186-
isPopular: true,
187-
params: {
187+
isStar: true,
188+
settings: {
188189
host: { type: "input", label: "主机地址", value: "localhost" },
189190
port: { type: "input", label: "端口", value: "3306" },
190191
database: { type: "input", label: "数据库名", value: "" },
@@ -207,8 +208,8 @@ const generateOperatorTemplates = (): OperatorI[] => {
207208
icon: <FileTextOutlined />,
208209
description: "读取CSV文件数据",
209210
tags: ["文件", "读取", "CSV"],
210-
isPopular: true,
211-
params: {
211+
isStar: true,
212+
settings: {
212213
filepath: { type: "input", label: "文件路径", value: "" },
213214
encoding: {
214215
type: "select",
@@ -227,7 +228,7 @@ const generateOperatorTemplates = (): OperatorI[] => {
227228
icon: <FilterOutlined />,
228229
description: "根据条件过滤数据行",
229230
tags: ["过滤", "条件", "筛选"],
230-
isPopular: true,
231+
isStar: true,
231232
params: {
232233
column: { type: "input", label: "过滤字段", value: "" },
233234
operator: {
@@ -253,8 +254,8 @@ const generateOperatorTemplates = (): OperatorI[] => {
253254
icon: <ThunderboltOutlined />,
254255
description: "训练线性回归模型",
255256
tags: ["回归", "监督学习", "预测"],
256-
isPopular: true,
257-
params: {
257+
isStar: true,
258+
settings: {
258259
features: {
259260
type: "checkbox",
260261
label: "特征列",
@@ -280,7 +281,7 @@ const generateOperatorTemplates = (): OperatorI[] => {
280281
icon: <ClusterOutlined />,
281282
description: "训练随机森林模型",
282283
tags: ["分类", "回归", "集成学习"],
283-
params: {
284+
settings: {
284285
n_estimators: {
285286
type: "range",
286287
label: "树的数量",

0 commit comments

Comments
 (0)