mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-02 16:37:53 +00:00
refactor: 重构存储与工作流模块,调整目录结构与初始化逻辑
1. 迁移存储模块功能到工作流模块,合并冗余代码 2. 调整环境配置加载路径与初始化脚本目录 3. 更新文档与前端组件代码适配重构 4. 新增工作流相关CRUD、模型与迁移文件 5. 移除过期模块与冗余代码,优化日志配置
This commit is contained in:
@@ -1,110 +1,110 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
/** 对应后端 `plugin.module_task.workflow.flow` */
|
||||
const API_PATH = "/task/workflow/flow";
|
||||
|
||||
const WorkflowDefinitionAPI = {
|
||||
getWorkflowList(query: WorkflowPageQuery) {
|
||||
return request<ApiResponse<PageResult<WorkflowTable>>>({
|
||||
const FlowAPI = {
|
||||
pageFlow(query?: FlowPageQuery) {
|
||||
return request<ApiResponse<PageResult<FlowTable>>>({
|
||||
url: `${API_PATH}/page`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
listFlow(query?: Omit<FlowPageQuery, "page_no" | "page_size">) {
|
||||
return request<ApiResponse<FlowTable[]>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getWorkflowDetail(query: number) {
|
||||
return request<ApiResponse<WorkflowTable>>({
|
||||
url: `${API_PATH}/detail/${query}`,
|
||||
detailFlow(id: number) {
|
||||
return request<ApiResponse<FlowTable>>({
|
||||
url: `${API_PATH}/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createWorkflow(body: WorkflowForm) {
|
||||
return request<ApiResponse<WorkflowTable>>({
|
||||
createFlow(body: FlowForm) {
|
||||
return request<ApiResponse<FlowTable>>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateWorkflow(id: number, body: WorkflowForm) {
|
||||
return request<ApiResponse<WorkflowTable>>({
|
||||
updateFlow(id: number, body: FlowForm) {
|
||||
return request<ApiResponse<FlowTable>>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteWorkflow(body: number[]) {
|
||||
deleteFlow(ids: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
data: ids,
|
||||
});
|
||||
},
|
||||
|
||||
publishWorkflow(id: number, body: WorkflowPublishForm) {
|
||||
return request<ApiResponse<WorkflowTable>>({
|
||||
url: `${API_PATH}/publish/${id}`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
executeWorkflow(body: WorkflowExecuteForm) {
|
||||
return request<ApiResponse<WorkflowExecuteResult>>({
|
||||
url: `${API_PATH}/execute`,
|
||||
/** 执行传输流程:遍历画布连线生成传输任务,返回任务ID列表;source_paths 为执行时选择的源文件/目录映射 {source_id: 路径} */
|
||||
executeFlow(id: number, body?: { source_paths?: Record<string, string> }) {
|
||||
return request<ApiResponse<number[]>>({
|
||||
url: `${API_PATH}/execute/${id}`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default WorkflowDefinitionAPI;
|
||||
export { WorkflowDefinitionAPI };
|
||||
export default FlowAPI;
|
||||
|
||||
export interface WorkflowPageQuery extends PageQuery, UserByQueryParams {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: number;
|
||||
/** 流程目标节点配置 */
|
||||
export interface FlowTarget {
|
||||
target_id: number;
|
||||
target_path: string;
|
||||
}
|
||||
|
||||
export interface WorkflowTable extends BaseType {
|
||||
/** 流程源节点配置(由画布启用连线实时派生) */
|
||||
export interface FlowSource {
|
||||
source_id: number;
|
||||
source_name?: string | null;
|
||||
}
|
||||
|
||||
/** 表单中的目标行(提交前会清理空项) */
|
||||
export interface FlowTargetInput {
|
||||
target_id?: number | null;
|
||||
target_path?: string;
|
||||
}
|
||||
|
||||
export interface FlowForm extends BaseFormType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
nodes?: any[];
|
||||
edges?: any[];
|
||||
task_type?: "parallel" | "chain";
|
||||
targets?: FlowTargetInput[];
|
||||
/** VueFlow 画布数据 {nodes, edges}(后端按 graph 派生 sources/targets) */
|
||||
graph?: { nodes?: Record<string, any>[]; edges?: Record<string, any>[] } | null;
|
||||
status?: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface WorkflowForm extends BaseFormType {
|
||||
export interface FlowTable extends BaseType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
nodes?: any[];
|
||||
edges?: any[];
|
||||
sources?: FlowSource[];
|
||||
task_type?: "parallel" | "chain";
|
||||
targets?: FlowTarget[];
|
||||
/** VueFlow 画布数据 {nodes, edges}(列表接口不返回,仅详情返回) */
|
||||
graph?: { nodes?: Record<string, any>[]; edges?: Record<string, any>[] } | null;
|
||||
/** 画布节点/连线统计(列表接口返回) */
|
||||
graph_stats?: { node_count?: number; edge_count?: number } | null;
|
||||
status?: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface WorkflowPublishForm {
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export interface WorkflowExecuteForm {
|
||||
workflow_id: number;
|
||||
variables?: Record<string, any>;
|
||||
business_key?: string;
|
||||
job_id?: number;
|
||||
}
|
||||
|
||||
export interface WorkflowExecuteResult {
|
||||
workflow_id: number;
|
||||
workflow_name: string;
|
||||
status: number;
|
||||
start_time?: string;
|
||||
end_time?: string;
|
||||
variables?: Record<string, any>;
|
||||
node_results?: Record<string, any>;
|
||||
error?: string;
|
||||
export interface FlowPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
task_type?: "parallel" | "chain";
|
||||
status?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user