Browse Source

fix: 修复流水线删除之后请求了两次的问题

pull/191/head
cp3hnu 10 months ago
parent
commit
0a35cc79f4
3 changed files with 42 additions and 44 deletions
  1. +6
    -0
      react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx
  2. +34
    -41
      react-ui/src/pages/Pipeline/index.jsx
  3. +2
    -3
      react-ui/src/utils/loading.tsx

+ 6
- 0
react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx View File

@@ -1,3 +1,9 @@
/*
* @Author: 赵伟
* @Date: 2025-03-24 15:41:42
* @Description: 版本文件列表
*/

import KFIcon from '@/components/KFIcon';
import {
ResourceData,


+ 34
- 41
react-ui/src/pages/Pipeline/index.jsx View File

@@ -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={<KFIcon type="icon-fuzhi" />}
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)}
>
复制
</Button>


+ 2
- 3
react-ui/src/utils/loading.tsx View File

@@ -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;
}


Loading…
Cancel
Save