mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-27 06:41:12 +00:00
refactor(task): 重构定时任务与存储路由
- 移除各路由文件顶部冗余注释 - 将 JobRouter/NodeRouter 重命名为 CornJobRouter/CornJobNodeRouter - 新增存储浏览、节点、传输、工作流路由注册 - 调整路由导入来源与任务表名 - 优化 main.py 启动方式及环境配置加载
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/workflow/storage";
|
||||
const API_PATH = "/task/storage/browse";
|
||||
|
||||
const StorageAPI = {
|
||||
/** 查询文件/目录列表。传 page_no/page_size 时分页返回(PageResult),否则返回全量数组。 */
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/workflow/source";
|
||||
const API_PATH = "/task/storage/node";
|
||||
|
||||
const NodeAPI = {
|
||||
pageNode(query?: TablePageQuery) {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { request } from "@utils";
|
||||
import { createSSEClient, httpEndpoint, type SSEClient } from "@utils/sse";
|
||||
|
||||
const API_PATH = "/workflow/transfer";
|
||||
const API_PATH = "/task/storage/transfer";
|
||||
|
||||
const TransferAPI = {
|
||||
/** 创建传输任务(远端源,JSON) */
|
||||
@@ -152,7 +152,7 @@ export class TransferStream {
|
||||
connect() {
|
||||
if (this.client) return;
|
||||
const url = new URL(
|
||||
"/api/v1/task/workflow/transfer/stream",
|
||||
"/api/v1/task/storage/transfer/stream",
|
||||
httpEndpoint(import.meta.env.VITE_APP_WS_ENDPOINT)
|
||||
);
|
||||
this.client = createSSEClient({
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/workflow/flow";
|
||||
const API_PATH = "/task/storage/workflow";
|
||||
|
||||
const FlowAPI = {
|
||||
pageFlow(query?: FlowPageQuery) {
|
||||
@@ -182,30 +182,30 @@ export const MANUAL_MODULES_AFTER_SYSTEM: ManualModuleSection[] = [
|
||||
},
|
||||
{
|
||||
anchor: "page-workflow",
|
||||
title: "传输流程",
|
||||
path: "module_task/workflow/flow/index.vue",
|
||||
title: "流程管理",
|
||||
path: "module_storage/workflow/index.vue",
|
||||
notes: [
|
||||
"检索:FaSearchBar(可展开)。",
|
||||
"工具栏:新增、批量删除、刷新、列配置。",
|
||||
"流程定义:源节点 + 目标节点列表(parallel 多目标 / chain 链式),目标路径随行配置。",
|
||||
"权限:`module_task:workflow:flow:create|delete|update` + 行级操作。",
|
||||
"权限:`module_storage:workflow:flow:create|delete|update` + 行级操作。",
|
||||
],
|
||||
},
|
||||
{
|
||||
anchor: "page-workflow-node",
|
||||
title: "节点管理",
|
||||
path: "module_task/workflow/node/index.vue",
|
||||
path: "module_storage/node/index.vue",
|
||||
notes: [
|
||||
"检索:FaSearchBar(可展开)。",
|
||||
"节点即传输地址(存储源):FTP/FTPS/SFTP/S3/OBS/OSS/COS/本地目录。",
|
||||
"行操作:打开(进入存储管理)、测试连接、详情、编辑、删除。",
|
||||
"权限:`module_task:workflow:node:create|delete|update` + 行级操作。",
|
||||
"权限:`module_storage:workflow:node:create|delete|update` + 行级操作。",
|
||||
],
|
||||
},
|
||||
{
|
||||
anchor: "page-workflow-storage",
|
||||
title: "存储管理",
|
||||
path: "module_task/workflow/storage/index.vue",
|
||||
title: "文件浏览",
|
||||
path: "module_storage/browse/index.vue",
|
||||
notes: [
|
||||
"多节点标签浏览各节点内部文件(类似 IDE 标签栏)。",
|
||||
"文件操作:上传、新建目录、下载、复制/移动、重命名、分享、删除。",
|
||||
@@ -215,7 +215,7 @@ export const MANUAL_MODULES_AFTER_SYSTEM: ManualModuleSection[] = [
|
||||
{
|
||||
anchor: "page-workflow-transfer",
|
||||
title: "传输任务",
|
||||
path: "module_task/workflow/transfer/index.vue",
|
||||
path: "module_storage/transfer/index.vue",
|
||||
notes: [
|
||||
"创建传输任务:可选「从流程自动填充」源节点与多目标,或手动指定。",
|
||||
"实时进度:WebSocket 推送任务/步骤状态与速度。",
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
<!-- 文件浏览:多节点标签 + 上传/下载/新建目录/复制/移动/重命名/分享/删除(源项目风格,对接 /task/workflow/storage) -->
|
||||
<!-- 文件浏览:多节点标签 + 上传/下载/新建目录/复制/移动/重命名/分享/删除(源项目风格,对接 /storage/browse) -->
|
||||
<template>
|
||||
<div class="flex h-full">
|
||||
<el-card shadow="never" class="browse-card flex min-h-0 flex-1 flex-col">
|
||||
@@ -605,14 +605,14 @@ import {
|
||||
Share,
|
||||
Upload,
|
||||
} from "@element-plus/icons-vue";
|
||||
import StorageAPI, { type StorageObject } from "@/api/module_task/workflow/storage";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_task/workflow/node";
|
||||
import TransferAPI from "@/api/module_task/workflow/transfer";
|
||||
import StorageAPI, { type StorageObject } from "@/api/module_storage/browse";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_storage/node";
|
||||
import TransferAPI from "@/api/module_storage/transfer";
|
||||
import type { ColumnOption } from "@/types/component";
|
||||
import type { FormItem } from "@/components/forms/fa-form/index.vue";
|
||||
|
||||
defineOptions({
|
||||
name: "WorkflowStorage",
|
||||
name: "WorkflowBrowse",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
+8
-8
@@ -27,8 +27,8 @@
|
||||
<template #left>
|
||||
<FaTableHeaderLeft
|
||||
:remove-ids="selectedIds"
|
||||
:perm-create="['module_task:workflow:node:create']"
|
||||
:perm-delete="['module_task:workflow:node:delete']"
|
||||
:perm-create="['module_storage:workflow:node:create']"
|
||||
:perm-delete="['module_storage:workflow:node:delete']"
|
||||
:delete-loading="batchDeleting"
|
||||
:create-loading="createLoading"
|
||||
@add="handleAdd"
|
||||
@@ -194,7 +194,7 @@ import NodeAPI, {
|
||||
type AdvancedFieldDef,
|
||||
type SourceForm,
|
||||
type SourceTable,
|
||||
} from "@/api/module_task/workflow/node";
|
||||
} from "@/api/module_storage/node";
|
||||
import type { SearchFormItem } from "@/components/forms/fa-search-bar/index.vue";
|
||||
import type FaSearchBar from "@/components/forms/fa-search-bar/index.vue";
|
||||
import type { FormItem } from "@/components/forms/fa-form/index.vue";
|
||||
@@ -347,14 +347,14 @@ function buildSourceRowActions(
|
||||
artType: "view",
|
||||
icon: "ri:link",
|
||||
iconColor: "var(--el-color-primary)",
|
||||
perm: "module_task:workflow:node:query",
|
||||
perm: "module_storage:workflow:node:query",
|
||||
run: () => ctx.onTest(row.id!),
|
||||
},
|
||||
{
|
||||
key: "detail",
|
||||
label: "详情",
|
||||
artType: "view",
|
||||
perm: "module_task:workflow:node:query",
|
||||
perm: "module_storage:workflow:node:query",
|
||||
run: () => ctx.onDetail(row.id!),
|
||||
},
|
||||
{
|
||||
@@ -362,7 +362,7 @@ function buildSourceRowActions(
|
||||
label: "编辑",
|
||||
artType: "edit",
|
||||
icon: "ri:edit-2-line",
|
||||
perm: "module_task:workflow:node:update",
|
||||
perm: "module_storage:workflow:node:update",
|
||||
run: () => ctx.onEdit(row.id!),
|
||||
},
|
||||
{
|
||||
@@ -370,7 +370,7 @@ function buildSourceRowActions(
|
||||
label: "删除",
|
||||
artType: "delete",
|
||||
icon: "ri:delete-bin-4-line",
|
||||
perm: "module_task:workflow:node:delete",
|
||||
perm: "module_storage:workflow:node:delete",
|
||||
run: () => ctx.onDelete(row.id!, row.name ?? ""),
|
||||
},
|
||||
];
|
||||
@@ -458,7 +458,7 @@ async function handleTest(id: number) {
|
||||
// 打开浏览:跳转到文件管理并携带存储源信息
|
||||
function handleOpen(row: SourceTable) {
|
||||
router.push({
|
||||
path: "/task/workflow/storage",
|
||||
path: "/task/storage/workflow/browse",
|
||||
query: { source_id: row.id, name: row.name, protocol: row.protocol },
|
||||
});
|
||||
}
|
||||
+3
-3
@@ -367,9 +367,9 @@ import TransferAPI, {
|
||||
type TransferStatus,
|
||||
type TransferTaskItem,
|
||||
type TransferTaskType,
|
||||
} from "@/api/module_task/workflow/transfer";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_task/workflow/node";
|
||||
import FlowAPI, { type FlowTable } from "@/api/module_task/workflow/flow";
|
||||
} from "@/api/module_storage/transfer";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_storage/node";
|
||||
import FlowAPI, { type FlowTable } from "@/api/module_storage/workflow";
|
||||
import FaDescriptions, {
|
||||
type DescriptionsItem,
|
||||
} from "@/components/display/fa-descriptions/index.vue";
|
||||
+1
-1
@@ -83,7 +83,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Document, Folder, Refresh } from "@element-plus/icons-vue";
|
||||
import StorageAPI, { type StorageObject } from "@/api/module_task/workflow/storage";
|
||||
import StorageAPI, { type StorageObject } from "@/api/module_storage/browse";
|
||||
|
||||
interface Props {
|
||||
visible?: boolean;
|
||||
+2
-2
@@ -84,12 +84,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ElMessage } from "element-plus";
|
||||
import { Close, Folder, FolderOpened } from "@element-plus/icons-vue";
|
||||
import NodeAPI from "@/api/module_task/workflow/node";
|
||||
import NodeAPI from "@/api/module_storage/node.ts";
|
||||
import {
|
||||
protocolColor,
|
||||
protocolLabel as getProtocolLabel,
|
||||
protocolText as getProtocolText,
|
||||
} from "./protocol";
|
||||
} from "./protocol.ts";
|
||||
import FaFileBrowserDialog from "./FaFileBrowserDialog.vue";
|
||||
|
||||
interface Props {
|
||||
+3
-3
@@ -256,11 +256,11 @@ import FaDynamicEdge from "./FaDynamicEdge.vue";
|
||||
import FaStorageNodePanel from "./FaStorageNodePanel.vue";
|
||||
import FaEdgeConfigPanel from "./FaEdgeConfigPanel.vue";
|
||||
import FaFileBrowserDialog from "./FaFileBrowserDialog.vue";
|
||||
import { protocolColor, protocolText } from "./protocol";
|
||||
import { protocolColor, protocolText } from "./protocol.ts";
|
||||
import type { FormItem } from "@/components/forms/fa-form/index.vue";
|
||||
import type FaForm from "@/components/forms/fa-form/index.vue";
|
||||
import FlowAPI, { type FlowForm, type FlowTable } from "@/api/module_task/workflow/flow";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_task/workflow/node";
|
||||
import FlowAPI, { type FlowForm, type FlowTable } from "@/api/module_storage/workflow.ts";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_storage/node.ts";
|
||||
|
||||
defineOptions({
|
||||
name: "WorkflowFlowDesignDrawer",
|
||||
+11
-11
@@ -27,8 +27,8 @@
|
||||
<template #left>
|
||||
<FaTableHeaderLeft
|
||||
:remove-ids="selectedIds"
|
||||
:perm-create="['module_task:workflow:flow:create']"
|
||||
:perm-delete="['module_task:workflow:flow:delete']"
|
||||
:perm-create="['module_storage:workflow:flow:create']"
|
||||
:perm-delete="['module_storage:workflow:flow:delete']"
|
||||
:delete-loading="batchDeleting"
|
||||
:create-loading="createLoading"
|
||||
@add="handleAdd"
|
||||
@@ -174,17 +174,17 @@
|
||||
import { ElButton, ElTag, ElTooltip } from "element-plus";
|
||||
import { useRouter } from "vue-router";
|
||||
import { resolveStatusColumns, renderTableOperationCell, type TableOperationAction } from "@utils";
|
||||
import FlowAPI, { type FlowTable } from "@/api/module_task/workflow/flow";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_task/workflow/node";
|
||||
import FlowAPI, { type FlowTable } from "@/api/module_storage/workflow.ts";
|
||||
import NodeAPI, { type SourceTable } from "@/api/module_storage/node.ts";
|
||||
import type { SearchFormItem } from "@/components/forms/fa-search-bar/index.vue";
|
||||
import type FaSearchBar from "@/components/forms/fa-search-bar/index.vue";
|
||||
import FaTableHeader from "@/components/tables/fa-table-header/index.vue";
|
||||
import FaWorkflowDesignDrawer from "./components/FaWorkflowDesignDrawer.vue";
|
||||
import FaFileBrowserDialog from "./components/FaFileBrowserDialog.vue";
|
||||
import { protocolColor, protocolLabel } from "./components/protocol";
|
||||
import { protocolColor, protocolLabel } from "./components/protocol.ts";
|
||||
|
||||
defineOptions({
|
||||
name: "WorkflowFlow",
|
||||
name: "Workflow",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
@@ -358,7 +358,7 @@ function buildFlowRowActions(
|
||||
key: "detail",
|
||||
label: "查看",
|
||||
artType: "view",
|
||||
perm: "module_task:workflow:flow:query",
|
||||
perm: "module_storage:workflow:flow:query",
|
||||
run: () => ctx.onDetail(row.id!),
|
||||
},
|
||||
{
|
||||
@@ -366,7 +366,7 @@ function buildFlowRowActions(
|
||||
label: "设计",
|
||||
artType: "edit",
|
||||
icon: "ri:pen-nib-line",
|
||||
perm: "module_task:workflow:flow:update",
|
||||
perm: "module_storage:workflow:flow:update",
|
||||
run: () => ctx.onEdit(row.id!),
|
||||
},
|
||||
{
|
||||
@@ -375,7 +375,7 @@ function buildFlowRowActions(
|
||||
artType: "view",
|
||||
icon: "ri:play-line",
|
||||
iconColor: "var(--el-color-success)",
|
||||
perm: "module_task:workflow:transfer:create",
|
||||
perm: "module_storage:workflow:transfer:create",
|
||||
run: () => ctx.onExecute(row),
|
||||
},
|
||||
{
|
||||
@@ -383,7 +383,7 @@ function buildFlowRowActions(
|
||||
label: "删除",
|
||||
artType: "delete",
|
||||
icon: "ri:delete-bin-4-line",
|
||||
perm: "module_task:workflow:flow:delete",
|
||||
perm: "module_storage:workflow:flow:delete",
|
||||
run: () => ctx.onDelete(row.id!, row.name ?? ""),
|
||||
},
|
||||
];
|
||||
@@ -490,7 +490,7 @@ async function handleExecuteConfirm() {
|
||||
type: "primary",
|
||||
size: "small",
|
||||
text: true,
|
||||
onClick: () => void router.push("/task/workflow/transfer"),
|
||||
onClick: () => void router.push("/task/storage/workflow/transfer"),
|
||||
},
|
||||
() => "查看任务"
|
||||
),
|
||||
Reference in New Issue
Block a user