From 568e6279414df41d74e6279408ebe7bda104ddbb Mon Sep 17 00:00:00 2001
From: Licho <lecho.sun@gmail.com>
Date: Sun, 19 Nov 2023 09:24:56 +0800
Subject: [PATCH] feat: remove tab when delete task at left tree (#2547)

* feat: remove tab when delete task at left tree

Signed-off-by: licho <lecho.sun@gmail.com>

* chore: remove todo

Signed-off-by: licho <lecho.sun@gmail.com>

---------

Signed-off-by: licho <lecho.sun@gmail.com>
---
 .../LeftContainer/Project/index.tsx           | 29 +++++--------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
index 9d88db2913..635f46d765 100644
--- a/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
+++ b/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
@@ -164,8 +164,6 @@ const Project: React.FC = (props: connect) => {
 
   /**
    * 创建目录, 并刷新目录树
-   * @param {Catalogue} values
-   * @returns {Promise<void>}
    */
   const handleSubmit = async (values: Catalogue) => {
     const options = {
@@ -232,11 +230,12 @@ const Project: React.FC = (props: connect) => {
 
   /**
    * 删除目录, 并刷新目录树
-   * @param {MenuInfo} node
-   * @returns {Promise<void>}
    */
   const handleDeleteSubmit = async () => {
+    debugger
     const { key, isLeaf, name, type } = projectState.rightClickedNode;
+    const {taskId, task} = projectState.value
+
     handleContextCancel();
     if (!isLeaf) {
       await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => {
@@ -246,24 +245,18 @@ const Project: React.FC = (props: connect) => {
       return;
     }
 
-    const renderContent = () => {
-      return (
-        <Text className={'needWrap'} type='danger'>
-          {l('datastudio.project.delete.job.confirm')}
-        </Text>
-      );
-    };
-
     Modal.confirm({
       title: l('datastudio.project.delete.job', '', { type, name }),
       width: '30%',
-      content: renderContent(),
+      content:
+          <Text className={'needWrap'} type='danger'>
+            {l('datastudio.project.delete.job.confirm')}
+          </Text>,
       okText: l('button.confirm'),
       cancelText: l('button.cancel'),
       onOk: async () => {
         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 });
         });
       }
@@ -272,7 +265,6 @@ const Project: React.FC = (props: connect) => {
 
   /**
    * rename handle
-   * @returns {Promise<void>}
    */
   const handleRename = async () => {
     setProjectState((prevState) => ({ ...prevState, isRename: true }));
@@ -297,7 +289,6 @@ const Project: React.FC = (props: connect) => {
 
   /**
    * copy task handle and submit to server and refresh the tree
-   * @returns {Promise<void>}
    */
   const handleCopy = async () => {
     await handleOption(
@@ -311,7 +302,6 @@ const Project: React.FC = (props: connect) => {
 
   /**
    * cut task handle
-   * @returns {Promise<void>}
    */
   const handleCut = async () => {
     setProjectState((prevState) => ({
@@ -324,7 +314,6 @@ const Project: React.FC = (props: connect) => {
 
   /**
    * paste task handle and submit to server and refresh the tree
-   * @returns {Promise<void>}
    */
   const handlePaste = async () => {
     await handlePutDataByParams(
@@ -349,8 +338,6 @@ const Project: React.FC = (props: connect) => {
 
   /**
    *  all context menu click handle
-   * @param {MenuInfo} node
-   * @returns {Promise<void>}
    */
   const handleMenuClick = async (node: MenuInfo) => {
     setProjectState((prevState) => ({ ...prevState, rightActiveKey: node.key }));