diff --git a/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx b/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx index 3dbb3c40..18fbc3ee 100644 --- a/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx @@ -1,3 +1,9 @@ +/* + * @Author: 赵伟 + * @Date: 2025-03-24 15:41:42 + * @Description: 版本文件列表 + */ + import KFIcon from '@/components/KFIcon'; import { ResourceData, diff --git a/react-ui/src/pages/Pipeline/index.jsx b/react-ui/src/pages/Pipeline/index.jsx index 205daca6..e78be54e 100644 --- a/react-ui/src/pages/Pipeline/index.jsx +++ b/react-ui/src/pages/Pipeline/index.jsx @@ -11,6 +11,7 @@ import { removeWorkflow, } from '@/services/pipeline/index.js'; import themes from '@/styles/theme.less'; +import { to } from '@/utils/promise'; import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { App, Button, ConfigProvider, Form, Input, Space, Table } from 'antd'; @@ -132,23 +133,38 @@ const Pipeline = () => { modalConfirm({ title: '删除后,该流水线将不可恢复', content: '是否确认删除?', - onOk: () => { - removeWorkflow(record.id).then((ret) => { - if (ret.code === 200) { - message.success('删除成功'); - // 如果是一页的唯一数据,删除后,请求第一页的数据 - // 否则直接刷新这一页的数据 - setPagination((prev) => { - return { - ...prev, - current: pipeList.length === 1 ? Math.max(1, prev.current - 1) : prev.current, - }; - }); - getList(); - } else { - message.error(ret.msg); - } - }); + onOk: async () => { + const { id } = record; + const [res] = await to(removeWorkflow(id)); + if (res) { + message.success('删除成功'); + // 如果是一页的唯一数据,删除后,请求第一页的数据 + // 否则直接刷新这一页的数据 + setPagination((prev) => { + return { + ...prev, + current: pipeList.length === 1 ? Math.max(1, prev.current - 1) : prev.current, + }; + }); + } + }, + }); + }; + + // 处理复制 + const handlePipelineCopy = (record) => { + modalConfirm({ + title: '确定复制该条流水线吗?', + okText: '确认', + cancelText: '取消', + isDelete: false, + onOk: async () => { + const { id } = record; + const [res] = await to(cloneWorkflow(id)); + if (res) { + message.success('复制成功'); + getList(); + } }, }); }; @@ -225,30 +241,7 @@ const Pipeline = () => { size="small" key="clone" icon={} - onClick={async () => { - modalConfirm({ - title: '确定复制该条流水线吗?', - okText: '确认', - cancelText: '取消', - isDelete: false, - onOk: () => { - cloneWorkflow(record.id).then((ret) => { - if (ret.code === 200) { - message.success('复制成功'); - getList(); - } else { - message.error('复制失败'); - } - }); - - // if (success) { - // if (actionRef.current) { - // actionRef.current.reload(); - // } - // } - }, - }); - }} + onClick={() => handlePipelineCopy(record)} > 复制 diff --git a/react-ui/src/utils/loading.tsx b/react-ui/src/utils/loading.tsx index 8486a6b9..0180a243 100644 --- a/react-ui/src/utils/loading.tsx +++ b/react-ui/src/utils/loading.tsx @@ -28,7 +28,7 @@ export class Loading { } const container = document.createElement('div'); container.id = 'loading'; - const rootContainer = document.body; //document.getElementsByTagName('main')[0]; + const rootContainer = document.body; // document.getElementsByTagName('main')[0]; rootContainer?.appendChild(container); const root = createRoot(container); const global = globalConfig(); @@ -69,10 +69,9 @@ export class Loading { static removeLoading() { this.clearRemoveTimeout(); - const rootContainer = document.body; //document.getElementsByTagName('main')[0]; const container = document.getElementById('loading'); if (container) { - rootContainer?.removeChild(container); + container.parentNode?.removeChild(container); } this.isShowing = false; }