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