Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
5c696e96
Commit
5c696e96
authored
May 27, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-542][web] Fix the name of tab can't be modified when modify task name
parent
a44b08df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
6 deletions
+42
-6
index.tsx
dlink-web/src/components/Studio/StudioTree/index.tsx
+11
-6
model.ts
dlink-web/src/pages/DataStudio/model.ts
+31
-0
No files found.
dlink-web/src/components/Studio/StudioTree/index.tsx
View file @
5c696e96
...
@@ -75,6 +75,7 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -75,6 +75,7 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
const
[
isCreate
,
setIsCreate
]
=
useState
<
boolean
>
(
true
);
const
[
isCreate
,
setIsCreate
]
=
useState
<
boolean
>
(
true
);
const
[
catalogueFormValues
,
setCatalogueFormValues
]
=
useState
({});
const
[
catalogueFormValues
,
setCatalogueFormValues
]
=
useState
({});
const
[
taskFormValues
,
setTaskFormValues
]
=
useState
({});
const
[
taskFormValues
,
setTaskFormValues
]
=
useState
({});
const
[
activeNode
,
setActiveNode
]
=
useState
({});
const
[
rightClickNode
,
setRightClickNode
]
=
useState
<
TreeDataNode
>
();
const
[
rightClickNode
,
setRightClickNode
]
=
useState
<
TreeDataNode
>
();
const
[
available
,
setAvailable
]
=
useState
<
boolean
>
(
true
);
const
[
available
,
setAvailable
]
=
useState
<
boolean
>
(
true
);
const
[
isUploadModalVisible
,
setIsUploadModalVisible
]
=
useState
(
false
);
const
[
isUploadModalVisible
,
setIsUploadModalVisible
]
=
useState
(
false
);
...
@@ -245,7 +246,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -245,7 +246,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
isLeaf
:
false
,
isLeaf
:
false
,
parentId
:
node
?.
id
,
parentId
:
node
?.
id
,
});
});
getTreeData
();
}
else
{
}
else
{
message
.
error
(
'只能在目录上创建目录'
);
message
.
error
(
'只能在目录上创建目录'
);
}
}
...
@@ -258,7 +258,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -258,7 +258,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
isLeaf
:
false
,
isLeaf
:
false
,
parentId
:
0
,
parentId
:
0
,
});
});
getTreeData
();
};
};
const
toSubmit
=
(
node
:
TreeDataNode
|
undefined
)
=>
{
const
toSubmit
=
(
node
:
TreeDataNode
|
undefined
)
=>
{
...
@@ -279,14 +278,14 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -279,14 +278,14 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
});
});
};
};
const
toRename
=
(
node
:
TreeDataNode
|
undefined
)
=>
{
const
toRename
=
(
node
:
TreeDataNode
)
=>
{
handleUpdateCatalogueModalVisible
(
true
);
handleUpdateCatalogueModalVisible
(
true
);
setIsCreate
(
false
);
setIsCreate
(
false
);
setActiveNode
(
node
);
setCatalogueFormValues
({
setCatalogueFormValues
({
id
:
node
?.
id
,
id
:
node
?.
id
,
name
:
node
?.
name
,
name
:
node
?.
name
,
});
});
getTreeData
();
};
};
const
toCut
=
(
node
:
TreeDataNode
|
undefined
)
=>
{
const
toCut
=
(
node
:
TreeDataNode
|
undefined
)
=>
{
...
@@ -312,7 +311,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -312,7 +311,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
setTaskFormValues
({
setTaskFormValues
({
parentId
:
node
?.
id
,
parentId
:
node
?.
id
,
});
});
//getTreeData();
}
else
{
}
else
{
message
.
error
(
'只能在目录上创建作业'
);
message
.
error
(
'只能在目录上创建作业'
);
}
}
...
@@ -523,7 +521,14 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -523,7 +521,14 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
if (success) {
if (success) {
handleUpdateCatalogueModalVisible(false);
handleUpdateCatalogueModalVisible(false);
setCatalogueFormValues({});
setCatalogueFormValues({});
getTreeData()
getTreeData();
dispatch({
type: "Studio/renameTab",
payload: {
key: value.id,
name: <>{activeNode.icon} {value.name}</>
},
});
}
}
}}
}}
onCancel={() => {
onCancel={() => {
...
...
dlink-web/src/pages/DataStudio/model.ts
View file @
5c696e96
...
@@ -191,6 +191,7 @@ export type ModelType = {
...
@@ -191,6 +191,7 @@ export type ModelType = {
saveChart
:
Reducer
<
StateType
>
;
saveChart
:
Reducer
<
StateType
>
;
changeTaskStep
:
Reducer
<
StateType
>
;
changeTaskStep
:
Reducer
<
StateType
>
;
changeTaskJobInstance
:
Reducer
<
StateType
>
;
changeTaskJobInstance
:
Reducer
<
StateType
>
;
renameTab
:
Reducer
<
StateType
>
;
};
};
};
};
...
@@ -534,6 +535,36 @@ const Model: ModelType = {
...
@@ -534,6 +535,36 @@ const Model: ModelType = {
tabs
:
{...
newTabs
},
tabs
:
{...
newTabs
},
};
};
},
},
renameTab
(
state
,
{
payload
})
{
const
newTabs
=
state
.
tabs
;
let
newCurrent
=
state
.
current
;
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
)
{
if
(
newTabs
.
panes
[
i
].
key
==
payload
.
key
)
{
newTabs
.
panes
[
i
].
title
=
payload
.
name
;
newTabs
.
panes
[
i
].
task
.
alias
=
payload
.
name
;
}
if
(
newTabs
.
panes
[
i
].
key
==
newCurrent
.
key
)
{
newCurrent
.
title
=
payload
.
name
;
newCurrent
.
task
.
alias
=
payload
.
name
;
}
}
if
(
newTabs
.
panes
.
length
==
0
){
return
{
...
state
,
current
:
undefined
,
tabs
:
newTabs
,
currentPath
:
[
'引导页'
],
};
}
return
{
...
state
,
current
:
{
...
newCurrent
,
},
tabs
:
{...
newTabs
},
currentPath
:
newCurrent
.
path
,
};
},
},
},
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment