Unverified Commit 568e6279 authored by Licho's avatar Licho Committed by GitHub

feat: remove tab when delete task at left tree (#2547)

* feat: remove tab when delete task at left tree Signed-off-by: 's avatarlicho <lecho.sun@gmail.com> * chore: remove todo Signed-off-by: 's avatarlicho <lecho.sun@gmail.com> --------- Signed-off-by: 's avatarlicho <lecho.sun@gmail.com>
parent 2e227d76
...@@ -164,8 +164,6 @@ const Project: React.FC = (props: connect) => { ...@@ -164,8 +164,6 @@ const Project: React.FC = (props: connect) => {
/** /**
* 创建目录, 并刷新目录树 * 创建目录, 并刷新目录树
* @param {Catalogue} values
* @returns {Promise<void>}
*/ */
const handleSubmit = async (values: Catalogue) => { const handleSubmit = async (values: Catalogue) => {
const options = { const options = {
...@@ -232,11 +230,12 @@ const Project: React.FC = (props: connect) => { ...@@ -232,11 +230,12 @@ const Project: React.FC = (props: connect) => {
/** /**
* 删除目录, 并刷新目录树 * 删除目录, 并刷新目录树
* @param {MenuInfo} node
* @returns {Promise<void>}
*/ */
const handleDeleteSubmit = async () => { const handleDeleteSubmit = async () => {
debugger
const { key, isLeaf, name, type } = projectState.rightClickedNode; const { key, isLeaf, name, type } = projectState.rightClickedNode;
const {taskId, task} = projectState.value
handleContextCancel(); handleContextCancel();
if (!isLeaf) { if (!isLeaf) {
await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => { await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => {
...@@ -246,24 +245,18 @@ const Project: React.FC = (props: connect) => { ...@@ -246,24 +245,18 @@ const Project: React.FC = (props: connect) => {
return; return;
} }
const renderContent = () => {
return (
<Text className={'needWrap'} type='danger'>
{l('datastudio.project.delete.job.confirm')}
</Text>
);
};
Modal.confirm({ Modal.confirm({
title: l('datastudio.project.delete.job', '', { type, name }), title: l('datastudio.project.delete.job', '', { type, name }),
width: '30%', width: '30%',
content: renderContent(), content:
<Text className={'needWrap'} type='danger'>
{l('datastudio.project.delete.job.confirm')}
</Text>,
okText: l('button.confirm'), okText: l('button.confirm'),
cancelText: l('button.cancel'), cancelText: l('button.cancel'),
onOk: async () => { onOk: async () => {
await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => { await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => {
// TODO: 如果打开的 tag 中包含了这个 key 则更新 dav 的 tag 数据 删除此项 dispatch({ type: STUDIO_MODEL.removeTag, payload: taskId });
// dispatch({ type: STUDIO_MODEL.removeTag, payload: taskId });
dispatch({ type: STUDIO_MODEL_ASYNC.queryProject }); dispatch({ type: STUDIO_MODEL_ASYNC.queryProject });
}); });
} }
...@@ -272,7 +265,6 @@ const Project: React.FC = (props: connect) => { ...@@ -272,7 +265,6 @@ const Project: React.FC = (props: connect) => {
/** /**
* rename handle * rename handle
* @returns {Promise<void>}
*/ */
const handleRename = async () => { const handleRename = async () => {
setProjectState((prevState) => ({ ...prevState, isRename: true })); setProjectState((prevState) => ({ ...prevState, isRename: true }));
...@@ -297,7 +289,6 @@ const Project: React.FC = (props: connect) => { ...@@ -297,7 +289,6 @@ const Project: React.FC = (props: connect) => {
/** /**
* copy task handle and submit to server and refresh the tree * copy task handle and submit to server and refresh the tree
* @returns {Promise<void>}
*/ */
const handleCopy = async () => { const handleCopy = async () => {
await handleOption( await handleOption(
...@@ -311,7 +302,6 @@ const Project: React.FC = (props: connect) => { ...@@ -311,7 +302,6 @@ const Project: React.FC = (props: connect) => {
/** /**
* cut task handle * cut task handle
* @returns {Promise<void>}
*/ */
const handleCut = async () => { const handleCut = async () => {
setProjectState((prevState) => ({ setProjectState((prevState) => ({
...@@ -324,7 +314,6 @@ const Project: React.FC = (props: connect) => { ...@@ -324,7 +314,6 @@ const Project: React.FC = (props: connect) => {
/** /**
* paste task handle and submit to server and refresh the tree * paste task handle and submit to server and refresh the tree
* @returns {Promise<void>}
*/ */
const handlePaste = async () => { const handlePaste = async () => {
await handlePutDataByParams( await handlePutDataByParams(
...@@ -349,8 +338,6 @@ const Project: React.FC = (props: connect) => { ...@@ -349,8 +338,6 @@ const Project: React.FC = (props: connect) => {
/** /**
* all context menu click handle * all context menu click handle
* @param {MenuInfo} node
* @returns {Promise<void>}
*/ */
const handleMenuClick = async (node: MenuInfo) => { const handleMenuClick = async (node: MenuInfo) => {
setProjectState((prevState) => ({ ...prevState, rightActiveKey: node.key })); setProjectState((prevState) => ({ ...prevState, rightActiveKey: node.key }));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment