Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
86473a33
Unverified
Commit
86473a33
authored
Oct 30, 2023
by
aiwenmo
Committed by
GitHub
Oct 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-2462] [studio] Fix refresh related content after renaming the task (#2463)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
d89485df
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
15 deletions
+53
-15
index.tsx
...pages/DataStudio/LeftContainer/Project/JobModal/index.tsx
+3
-2
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
+30
-7
index.tsx
...web/src/pages/DataStudio/RightContainer/JobInfo/index.tsx
+4
-5
function.ts
dinky-web/src/pages/DataStudio/function.ts
+15
-0
model.ts
dinky-web/src/pages/DataStudio/model.ts
+1
-1
No files found.
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobModal/index.tsx
View file @
86473a33
...
@@ -100,12 +100,13 @@ const JobModal: React.FC<JobModalProps> = (props) => {
...
@@ -100,12 +100,13 @@ const JobModal: React.FC<JobModalProps> = (props) => {
formData
.
configJson
.
udfConfig
.
templateId
=
selectKeys
[
selectKeys
.
length
-
1
];
formData
.
configJson
.
udfConfig
.
templateId
=
selectKeys
[
selectKeys
.
length
-
1
];
}
}
onSubmit
({
...
values
,
...
formData
}
as
Catalogue
);
onSubmit
({
...
values
,
...
formData
}
as
Catalogue
);
};
};
const
renderForm
=
()
=>
{
const
renderForm
=
()
=>
{
return
(
return
(
<>
<>
<
ProFormSelect
{
!
values
.
id
&&
<
ProFormSelect
name=
{
'type'
}
name=
{
'type'
}
label=
{
l
(
'catalog.type'
)
}
label=
{
l
(
'catalog.type'
)
}
tooltip=
{
l
(
'catalog.type.tip'
)
}
tooltip=
{
l
(
'catalog.type.tip'
)
}
...
@@ -114,7 +115,7 @@ const JobModal: React.FC<JobModalProps> = (props) => {
...
@@ -114,7 +115,7 @@ const JobModal: React.FC<JobModalProps> = (props) => {
disabled=
{
!!
values
.
id
}
disabled=
{
!!
values
.
id
}
placeholder=
{
l
(
'catalog.type.placeholder'
)
}
placeholder=
{
l
(
'catalog.type.placeholder'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'catalog.type.placeholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'catalog.type.placeholder'
)
}]
}
/>
/>
}
<
ProFormText
<
ProFormText
name=
'name'
name=
'name'
label=
{
l
(
'catalog.name'
)
}
label=
{
l
(
'catalog.name'
)
}
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
View file @
86473a33
...
@@ -25,7 +25,7 @@ import {
...
@@ -25,7 +25,7 @@ import {
import
FolderModal
from
'@/pages/DataStudio/LeftContainer/Project/FolderModal'
;
import
FolderModal
from
'@/pages/DataStudio/LeftContainer/Project/FolderModal'
;
import
JobModal
from
'@/pages/DataStudio/LeftContainer/Project/JobModal'
;
import
JobModal
from
'@/pages/DataStudio/LeftContainer/Project/JobModal'
;
import
JobTree
from
'@/pages/DataStudio/LeftContainer/Project/JobTree'
;
import
JobTree
from
'@/pages/DataStudio/LeftContainer/Project/JobTree'
;
import
{
StateType
,
STUDIO_MODEL
,
STUDIO_MODEL_ASYNC
}
from
'@/pages/DataStudio/model'
;
import
{
DataStudioParams
,
StateType
,
STUDIO_MODEL
,
STUDIO_MODEL_ASYNC
}
from
'@/pages/DataStudio/model'
;
import
{
import
{
handleAddOrUpdate
,
handleAddOrUpdate
,
handleOption
,
handleOption
,
...
@@ -41,11 +41,15 @@ import { Modal, Typography } from 'antd';
...
@@ -41,11 +41,15 @@ import { Modal, Typography } from 'antd';
import
{
MenuInfo
}
from
'rc-menu/es/interface'
;
import
{
MenuInfo
}
from
'rc-menu/es/interface'
;
import
React
,
{
Key
,
useEffect
,
useState
}
from
'react'
;
import
React
,
{
Key
,
useEffect
,
useState
}
from
'react'
;
import
{
connect
}
from
'umi'
;
import
{
connect
}
from
'umi'
;
import
{
getCurrentTab
,
getTabByTaskId
,
mapDispatchToProps
}
from
"@/pages/DataStudio/function"
;
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
const
Project
:
React
.
FC
=
(
props
:
connect
)
=>
{
const
Project
:
React
.
FC
=
(
props
:
connect
)
=>
{
const
{
dispatch
}
=
props
;
const
{
dispatch
,
tabs
:
{
panes
,
activeKey
}
}
=
props
;
const
[
projectState
,
setProjectState
]
=
useState
<
ProjectState
>
(
InitProjectState
);
const
[
projectState
,
setProjectState
]
=
useState
<
ProjectState
>
(
InitProjectState
);
...
@@ -167,7 +171,7 @@ const Project: React.FC = (props: connect) => {
...
@@ -167,7 +171,7 @@ const Project: React.FC = (props: connect) => {
options
.
url
=
API_CONSTANTS
.
SAVE_OR_UPDATE_CATALOGUE_URL
;
options
.
url
=
API_CONSTANTS
.
SAVE_OR_UPDATE_CATALOGUE_URL
;
}
}
const
result
=
await
handleAddOrUpdate
(
handleAddOrUpdate
(
options
.
url
,
options
.
url
,
{
{
...
values
,
...
values
,
...
@@ -176,6 +180,29 @@ const Project: React.FC = (props: connect) => {
...
@@ -176,6 +180,29 @@ const Project: React.FC = (props: connect) => {
},
},
()
=>
{},
()
=>
{},
()
=>
{
()
=>
{
setProjectState
((
prevState
)
=>
({
...
prevState
}));
dispatch
({
type
:
STUDIO_MODEL_ASYNC
.
queryProject
});
if
(
projectState
.
isEdit
)
{
const
{
id
}
=
values
;
const
currentTabs
=
getTabByTaskId
(
panes
,
id
)
if
(
currentTabs
){
currentTabs
.
label
=
values
.
name
;
// currentTabs.params.taskData.name = values.name;
const
{
params
}
=
currentTabs
;
const
{
taskData
}
=
params
;
if
(
taskData
){
taskData
.
name
=
values
.
name
;
}
}
dispatch
({
type
:
STUDIO_MODEL
.
saveTabs
,
payload
:
{
...
props
.
tabs
}});
// update active breadcrumb title
if
(
activeKey
===
currentTabs
?.
key
){
dispatch
({
type
:
STUDIO_MODEL
.
updateTabsActiveKey
,
payload
:
activeKey
});
}
}
// close job modal by project state
setProjectState
((
prevState
)
=>
({
setProjectState
((
prevState
)
=>
({
...
prevState
,
...
prevState
,
isCreateSub
:
false
,
isCreateSub
:
false
,
...
@@ -184,10 +211,6 @@ const Project: React.FC = (props: connect) => {
...
@@ -184,10 +211,6 @@ const Project: React.FC = (props: connect) => {
isCreateTask
:
false
,
isCreateTask
:
false
,
isCut
:
false
isCut
:
false
}));
}));
dispatch
({
type
:
STUDIO_MODEL_ASYNC
.
queryProject
});
if
(
projectState
.
isRename
)
{
// todo: 如果是重命名/修改(修改了名字), 则需要 更新 tab 的 label
}
}
}
);
);
};
};
...
...
dinky-web/src/pages/DataStudio/RightContainer/JobInfo/index.tsx
View file @
86473a33
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
*
*
*/
*/
import
{
getCurrentData
}
from
'@/pages/DataStudio/function'
;
import
{
getCurrentData
,
getCurrentTab
}
from
'@/pages/DataStudio/function'
;
import
{
StateType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
Descriptions
}
from
'antd'
;
import
{
Descriptions
}
from
'antd'
;
...
@@ -27,16 +27,15 @@ import { connect } from 'umi';
...
@@ -27,16 +27,15 @@ import { connect } from 'umi';
const
JobInfo
=
(
props
:
any
)
=>
{
const
JobInfo
=
(
props
:
any
)
=>
{
const
{
const
{
tabs
:
{
panes
,
activeKey
}
tabs
:
{
panes
,
activeKey
,
activeBreadcrumbTitle
}
}
=
props
;
}
=
props
;
const
[
currentInfo
,
setCurrentInfo
]
=
useState
<
Partial
<
TaskDataType
>>
(
const
[
currentInfo
,
setCurrentInfo
]
=
useState
<
Partial
<
TaskDataType
>>
(
getCurrentData
(
panes
,
activeKey
)
??
{}
getCurrentData
(
panes
,
activeKey
)
??
{}
);
);
useEffect
(()
=>
{
useEffect
(()
=>
{
setCurrentInfo
({
...
currentInfo
,
...
getCurrentData
(
panes
,
activeKey
)
});
setCurrentInfo
({
...
getCurrentData
(
panes
,
activeKey
)
});
},
[
activeKey
,
panes
]);
},
[
activeKey
,
activeBreadcrumbTitle
]);
return
(
return
(
<
div
style=
{
{
paddingInline
:
8
}
}
>
<
div
style=
{
{
paddingInline
:
8
}
}
>
...
...
dinky-web/src/pages/DataStudio/function.ts
View file @
86473a33
...
@@ -152,6 +152,21 @@ export function getCurrentTab(
...
@@ -152,6 +152,21 @@ export function getCurrentTab(
}
}
}
}
export
function
getTabByTaskId
(
panes
:
TabsItemType
[],
id
:
number
):
DataStudioTabsItemType
|
MetadataTabsItemType
|
undefined
{
const
item
=
panes
.
find
((
item
)
=>
item
.
treeKey
===
id
);
switch
(
item
?.
type
)
{
case
'project'
:
return
item
as
DataStudioTabsItemType
;
case
'metadata'
:
return
item
as
MetadataTabsItemType
;
default
:
return
undefined
;
}
}
export
const
getCurrentData
=
(
export
const
getCurrentData
=
(
panes
:
TabsItemType
[],
panes
:
TabsItemType
[],
activeKey
:
string
activeKey
:
string
...
...
dinky-web/src/pages/DataStudio/model.ts
View file @
86473a33
...
@@ -152,7 +152,7 @@ export interface TabsItemType {
...
@@ -152,7 +152,7 @@ export interface TabsItemType {
type
:
TabsPageType
;
type
:
TabsPageType
;
subType
?:
TabsPageSubType
;
subType
?:
TabsPageSubType
;
key
:
string
;
key
:
string
;
treeKey
:
string
;
treeKey
:
number
;
value
:
string
;
value
:
string
;
icon
:
any
;
icon
:
any
;
closable
:
boolean
;
closable
:
boolean
;
...
...
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