Skip to content

Commit

Permalink
feat: remove tab when delete task at left tree (#2547)
Browse files Browse the repository at this point in the history
* feat: remove tab when delete task at left tree

Signed-off-by: licho <[email protected]>

* chore: remove todo

Signed-off-by: licho <[email protected]>

---------

Signed-off-by: licho <[email protected]>
  • Loading branch information
leechor authored Nov 19, 2023
1 parent 2e227d7 commit 568e627
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ const Project: React.FC = (props: connect) => {

/**
* 创建目录, 并刷新目录树
* @param {Catalogue} values
* @returns {Promise<void>}
*/
const handleSubmit = async (values: Catalogue) => {
const options = {
Expand Down Expand Up @@ -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, () => {
Expand All @@ -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 });
});
}
Expand All @@ -272,7 +265,6 @@ const Project: React.FC = (props: connect) => {

/**
* rename handle
* @returns {Promise<void>}
*/
const handleRename = async () => {
setProjectState((prevState) => ({ ...prevState, isRename: true }));
Expand All @@ -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(
Expand All @@ -311,7 +302,6 @@ const Project: React.FC = (props: connect) => {

/**
* cut task handle
* @returns {Promise<void>}
*/
const handleCut = async () => {
setProjectState((prevState) => ({
Expand All @@ -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(
Expand All @@ -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 }));
Expand Down

0 comments on commit 568e627

Please sign in to comment.