Skip to content

Commit fad76e7

Browse files
authored
data collection page (#31)
* feat: Update site name to DataMate and refine text for AI data processing * feat: Refactor settings page and implement model access functionality - Created a new ModelAccess component for managing model configurations. - Removed the old Settings component and replaced it with a new SettingsPage component that integrates ModelAccess, SystemConfig, and WebhookConfig. - Added SystemConfig component for managing system settings. - Implemented WebhookConfig component for managing webhook configurations. - Updated API functions for model management in settings.apis.ts. - Adjusted routing to point to the new SettingsPage component. * feat: Implement Data Collection Page with Task Management and Execution Log - Created DataCollectionPage component to manage data collection tasks. - Added TaskManagement and ExecutionLog components for task handling and logging. - Integrated task operations including start, stop, edit, and delete functionalities. - Implemented filtering and searching capabilities in task management. - Introduced SimpleCronScheduler for scheduling tasks with cron expressions. - Updated CreateTask component to utilize new scheduling and template features. - Enhanced BasicInformation component to conditionally render fields based on visibility settings. - Refactored ImportConfiguration component to remove NAS import section.
1 parent 1a6e257 commit fad76e7

File tree

11 files changed

+1178
-416
lines changed

11 files changed

+1178
-416
lines changed

frontend/src/components/AdvancedCronScheduler.tsx

Lines changed: 556 additions & 0 deletions
Large diffs are not rendered by default.

frontend/src/components/CardView.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import React, { useState, useEffect, useRef } from "react";
2-
import {
3-
Tag,
4-
Pagination,
5-
Tooltip,
6-
Empty,
7-
Popover,
8-
} from "antd";
2+
import { Tag, Pagination, Tooltip, Empty, Popover, Spin } from "antd";
93
import { ClockCircleOutlined, StarFilled } from "@ant-design/icons";
104
import type { ItemType } from "antd/es/menu/interface";
115
import { formatDateTime } from "@/utils/unit";

frontend/src/mock/mock-seed/data-collection.cjs

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,24 @@ const API = require("../mock-apis.cjs");
33
const { Random } = Mock;
44

55
// 生成模拟数据归集统计信息
6-
const collectionStatistics = {
7-
period: Random.pick(["HOUR", "DAY", "WEEK", "MONTH"]),
8-
totalTasks: Random.integer(50, 200),
9-
activeTasks: Random.integer(10, 50),
10-
successfulExecutions: Random.integer(30, 150),
11-
failedExecutions: Random.integer(0, 50),
12-
totalExecutions: Random.integer(20, 100),
13-
avgExecutionTime: Random.integer(1000, 10000), // in milliseconds
14-
avgThroughput: Random.integer(100, 1000), // records per second
15-
topDataSources: new Array(5).fill(null).map(() => ({
16-
dataSourceId: Mock.Random.guid().replace(/[^a-zA-Z0-9]/g, ""),
17-
dataSourceName: Mock.Random.word(5, 15),
18-
type: Mock.Random.pick([
19-
"MySQL",
20-
"PostgreSQL",
21-
"ORACLE",
22-
"SQLSERVER",
23-
"MONGODB",
24-
"REDIS",
25-
"ELASTICSEARCH",
26-
"HIVE",
27-
"HDFS",
28-
"KAFKA",
29-
"HTTP",
30-
"FILE",
31-
]),
32-
taskCount: Mock.Random.integer(1, 20),
33-
executionCount: Mock.Random.integer(1, 50),
34-
recordsProcessed: Mock.Random.integer(70, 100), // percentage
35-
})),
36-
};
6+
function dataXTemplate() {
7+
return {
8+
id: Mock.Random.guid().replace(/[^a-zA-Z0-9]/g, ""),
9+
name: Mock.Random.ctitle(5, 15),
10+
sourceType: Mock.Random.csentence(3, 10),
11+
targetType: Mock.Random.csentence(3, 10),
12+
description: Mock.Random.csentence(5, 20),
13+
version: `v${Mock.Random.integer(1, 5)}.${Mock.Random.integer(
14+
0,
15+
9
16+
)}.${Mock.Random.integer(0, 9)}`,
17+
isSystem: Mock.Random.boolean(),
18+
createdAt: Mock.Random.datetime("yyyy-MM-dd HH:mm:ss"),
19+
updatedAt: Mock.Random.datetime("yyyy-MM-dd HH:mm:ss"),
20+
};
21+
}
22+
23+
const templateList = new Array(20).fill(null).map(dataXTemplate);
3724

3825
// 生成模拟任务数据
3926
function taskItem() {
@@ -89,30 +76,21 @@ function executionLogItem() {
8976
const executionLogList = new Array(100).fill(null).map(executionLogItem);
9077

9178
module.exports = function (router) {
92-
// 获取数据统计信息
93-
router.get(API.queryCollectionStatisticsUsingGet, (req, res) => {
94-
res.send({
95-
code: "0",
96-
msg: "Success",
97-
data: collectionStatistics,
98-
});
99-
});
100-
10179
// 获取任务列表
102-
router.post(API.queryTasksUsingPost, (req, res) => {
103-
const { searchTerm, filters, page = 1, size = 10 } = req.body;
80+
router.get(API.queryTasksUsingGet, (req, res) => {
81+
const { keyword, status, page = 0, size = 10 } = req.query;
10482
let filteredTasks = taskList;
105-
if (searchTerm) {
83+
if (keyword) {
10684
filteredTasks = filteredTasks.filter((task) =>
107-
task.name.includes(searchTerm)
85+
task.name.includes(keyword)
10886
);
10987
}
110-
if (filters && filters.status && filters.status.length > 0) {
88+
if (status && status.length > 0) {
11189
filteredTasks = filteredTasks.filter((task) =>
112-
filters.status.includes(task.status)
90+
status.includes(task.status)
11391
);
11492
}
115-
const startIndex = (page - 1) * size;
93+
const startIndex = page * size;
11694
const endIndex = startIndex + size;
11795
const paginatedTasks = filteredTasks.slice(startIndex, endIndex);
11896

@@ -123,7 +101,30 @@ module.exports = function (router) {
123101
totalElements: filteredTasks.length,
124102
page,
125103
size,
126-
results: paginatedTasks,
104+
content: paginatedTasks,
105+
},
106+
});
107+
});
108+
109+
router.get(API.queryDataXTemplatesUsingGet, (req, res) => {
110+
const { keyword, page = 0, size = 10 } = req.query;
111+
let filteredTemplates = templateList;
112+
if (keyword) {
113+
filteredTemplates = filteredTemplates.filter((template) =>
114+
template.name.includes(keyword)
115+
);
116+
}
117+
const startIndex = page * size;
118+
const endIndex = startIndex + size;
119+
const paginatedTemplates = filteredTemplates.slice(startIndex, endIndex);
120+
res.send({
121+
code: "0",
122+
msg: "Success",
123+
data: {
124+
content: paginatedTemplates,
125+
totalElements: filteredTemplates.length,
126+
page,
127+
size,
127128
},
128129
});
129130
});

0 commit comments

Comments
 (0)