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
89c35c9e
Unverified
Commit
89c35c9e
authored
Dec 17, 2023
by
ZackYoung
Committed by
GitHub
Dec 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize_table_data (#2674)
parent
9b4bd242
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
718 additions
and
612 deletions
+718
-612
SystemInit.java
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
+1
-1
JobInstanceServiceImpl.java
...n/java/org/dinky/service/impl/JobInstanceServiceImpl.java
+8
-6
RunTimeUtil.java
dinky-common/src/main/java/org/dinky/utils/RunTimeUtil.java
+3
-2
ProjectClient.java
...c/main/java/org/dinky/scheduler/client/ProjectClient.java
+20
-8
CircleBtn.tsx
dinky-web/src/components/CallBackButton/CircleBtn.tsx
+33
-24
index.tsx
.../src/pages/DataStudio/BottomContainer/TableData/index.tsx
+56
-88
index.tsx
dinky-web/src/pages/DataStudio/BottomContainer/index.tsx
+282
-238
TabRoute.tsx
dinky-web/src/pages/DataStudio/TabRoute.tsx
+42
-0
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+273
-245
No files found.
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
View file @
89c35c9e
...
@@ -247,7 +247,7 @@ public class SystemInit implements ApplicationRunner {
...
@@ -247,7 +247,7 @@ public class SystemInit implements ApplicationRunner {
}
}
try
{
try
{
project
=
projectClient
.
getDinkyProject
();
project
=
projectClient
.
getDinkyProject
();
if
(
Asserts
.
isNull
(
project
)
)
{
if
(
project
==
null
)
{
project
=
projectClient
.
createDinkyProject
();
project
=
projectClient
.
createDinkyProject
();
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java
View file @
89c35c9e
...
@@ -160,12 +160,14 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
...
@@ -160,12 +160,14 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
jobInfoDetail
.
setClusterInstance
(
clusterInstance
);
jobInfoDetail
.
setClusterInstance
(
clusterInstance
);
History
history
=
historyService
.
getById
(
jobInstance
.
getHistoryId
());
History
history
=
historyService
.
getById
(
jobInstance
.
getHistoryId
());
history
.
setConfigJson
(
history
.
getConfigJson
());
if
(
history
!=
null
)
{
jobInfoDetail
.
setHistory
(
history
);
history
.
setConfigJson
(
history
.
getConfigJson
());
if
(
Asserts
.
isNotNull
(
history
.
getClusterConfigurationId
()))
{
jobInfoDetail
.
setHistory
(
history
);
ClusterConfiguration
clusterConfig
=
if
(
Asserts
.
isNotNull
(
history
.
getClusterConfigurationId
()))
{
clusterConfigurationService
.
getClusterConfigById
(
history
.
getClusterConfigurationId
());
ClusterConfiguration
clusterConfig
=
jobInfoDetail
.
setClusterConfiguration
(
ClusterConfigurationDTO
.
fromBean
(
clusterConfig
));
clusterConfigurationService
.
getClusterConfigById
(
history
.
getClusterConfigurationId
());
jobInfoDetail
.
setClusterConfiguration
(
ClusterConfigurationDTO
.
fromBean
(
clusterConfig
));
}
}
}
JobDataDto
jobDataDto
=
jobHistoryService
.
getJobHistoryDto
(
jobInstance
.
getId
());
JobDataDto
jobDataDto
=
jobHistoryService
.
getJobHistoryDto
(
jobInstance
.
getId
());
...
...
dinky-common/src/main/java/org/dinky/utils/RunTimeUtil.java
View file @
89c35c9e
...
@@ -39,6 +39,7 @@ public class RunTimeUtil {
...
@@ -39,6 +39,7 @@ public class RunTimeUtil {
obj
=
null
;
obj
=
null
;
System
.
gc
();
System
.
gc
();
}
}
/**
/**
* 处理命令,多行命令原样返回,单行命令拆分处理
* 处理命令,多行命令原样返回,单行命令拆分处理
*
*
...
@@ -47,14 +48,14 @@ public class RunTimeUtil {
...
@@ -47,14 +48,14 @@ public class RunTimeUtil {
*/
*/
public
static
String
[]
handleCmds
(
String
...
cmds
)
{
public
static
String
[]
handleCmds
(
String
...
cmds
)
{
if
(
ArrayUtil
.
isEmpty
(
cmds
))
{
if
(
ArrayUtil
.
isEmpty
(
cmds
))
{
throw
new
NullPointerException
(
"Command is empty !"
)
;
return
new
String
[]
{}
;
}
}
// 单条命令的情况
// 单条命令的情况
if
(
1
==
cmds
.
length
)
{
if
(
1
==
cmds
.
length
)
{
final
String
cmd
=
cmds
[
0
];
final
String
cmd
=
cmds
[
0
];
if
(
StrUtil
.
isBlank
(
cmd
))
{
if
(
StrUtil
.
isBlank
(
cmd
))
{
throw
new
NullPointerException
(
"Command is blank !"
)
;
return
new
String
[]
{}
;
}
}
cmds
=
cmdSplit
(
cmd
);
cmds
=
cmdSplit
(
cmd
);
}
}
...
...
dinky-scheduler/src/main/java/org/dinky/scheduler/client/ProjectClient.java
View file @
89c35c9e
...
@@ -35,8 +35,11 @@ import org.springframework.stereotype.Component;
...
@@ -35,8 +35,11 @@ import org.springframework.stereotype.Component;
import
cn.hutool.core.lang.TypeReference
;
import
cn.hutool.core.lang.TypeReference
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
/** 项目 */
/**
* 项目
*/
@Component
@Component
public
class
ProjectClient
{
public
class
ProjectClient
{
...
@@ -55,8 +58,7 @@ public class ProjectClient {
...
@@ -55,8 +58,7 @@ public class ProjectClient {
.
getDolphinschedulerProjectName
()
.
getDolphinschedulerProjectName
()
.
getValue
());
.
getValue
());
map
.
put
(
"description"
,
"自动创建"
);
map
.
put
(
"description"
,
"自动创建"
);
HttpResponse
httpResponse
=
HttpRequest
.
post
(
SystemConfiguration
.
getInstances
()
String
content
=
HttpRequest
.
post
(
SystemConfiguration
.
getInstances
()
.
getDolphinschedulerUrl
()
.
getDolphinschedulerUrl
()
.
getValue
()
.
getValue
()
+
"/projects"
)
+
"/projects"
)
...
@@ -67,8 +69,13 @@ public class ProjectClient {
...
@@ -67,8 +69,13 @@ public class ProjectClient {
.
getValue
())
.
getValue
())
.
form
(
map
)
.
form
(
map
)
.
timeout
(
5000
)
.
timeout
(
5000
)
.
execute
()
.
execute
();
.
body
();
if
(
httpResponse
.
getStatus
()
!=
200
)
{
SystemConfiguration
.
getInstances
().
getDolphinschedulerEnable
().
setValue
(
false
);
logger
.
error
(
"DolphInScheduler connection failed, Reason: {}"
,
httpResponse
.
getStatus
());
return
null
;
}
String
content
=
httpResponse
.
body
();
return
MyJSONUtil
.
verifyResult
(
MyJSONUtil
.
toBean
(
content
,
new
TypeReference
<
Result
<
Project
>>()
{}));
return
MyJSONUtil
.
verifyResult
(
MyJSONUtil
.
toBean
(
content
,
new
TypeReference
<
Result
<
Project
>>()
{}));
}
}
...
@@ -79,7 +86,7 @@ public class ProjectClient {
...
@@ -79,7 +86,7 @@ public class ProjectClient {
*/
*/
public
Project
getDinkyProject
()
{
public
Project
getDinkyProject
()
{
String
content
=
HttpRequest
.
get
(
SystemConfiguration
.
getInstances
()
HttpResponse
httpResponse
=
HttpRequest
.
get
(
SystemConfiguration
.
getInstances
()
.
getDolphinschedulerUrl
()
.
getDolphinschedulerUrl
()
.
getValue
()
.
getValue
()
+
"/projects"
)
+
"/projects"
)
...
@@ -92,9 +99,14 @@ public class ProjectClient {
...
@@ -92,9 +99,14 @@ public class ProjectClient {
.
getDolphinschedulerProjectName
()
.
getDolphinschedulerProjectName
()
.
getValue
()))
.
getValue
()))
.
timeout
(
5000
)
.
timeout
(
5000
)
.
execute
()
.
execute
();
.
body
();
if
(
httpResponse
.
getStatus
()
!=
200
)
{
SystemConfiguration
.
getInstances
().
getDolphinschedulerEnable
().
setValue
(
false
);
logger
.
error
(
"DolphInScheduler connection failed, Reason: {}"
,
httpResponse
.
getStatus
());
return
null
;
}
String
content
=
httpResponse
.
body
();
try
{
try
{
return
MyJSONUtil
.
toPageBeanAndFindByName
(
return
MyJSONUtil
.
toPageBeanAndFindByName
(
content
,
content
,
...
...
dinky-web/src/components/CallBackButton/CircleBtn.tsx
View file @
89c35c9e
...
@@ -17,37 +17,46 @@
...
@@ -17,37 +17,46 @@
*
*
*/
*/
import
{
TabsItemType
}
from
'@/pages/DataStudio/model'
;
import
{
TabsItemType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
Button
}
from
'antd'
;
import
{
Button
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Tab
}
from
'@/pages/DataStudio/route'
;
export
type
CircleButtonProps
=
{
export
type
CircleButtonProps
=
{
icon
:
React
.
ReactNode
;
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
loading
?:
boolean
;
onClick
?:
()
=>
void
;
onClick
?:
()
=>
void
;
title
?:
string
;
title
?:
string
;
key
?:
string
;
key
?:
string
;
};
export
type
CircleBottomButtonProps
=
{
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
onClick
?:
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
refresh
:
any
)
=>
Promise
<
void
>
;
title
?:
string
;
key
?:
string
;
};
};
export
type
CircleDataStudioButtonProps
=
{
export
type
CircleDataStudioButtonProps
=
{
icon
:
React
.
ReactNode
;
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
loading
?:
boolean
;
onClick
?:
(
panes
:
TabsItemType
[],
activeKey
:
string
)
=>
void
;
onClick
?:
(
panes
:
TabsItemType
[],
activeKey
:
string
)
=>
void
;
title
?:
string
;
title
?:
string
;
key
?:
string
;
key
?:
string
;
isShow
?:
boolean
;
};
};
export
const
CircleBtn
:
React
.
FC
<
CircleButtonProps
>
=
(
props
)
=>
{
export
const
CircleBtn
:
React
.
FC
<
CircleButtonProps
>
=
(
props
)
=>
{
const
{
onClick
,
title
,
icon
,
loading
}
=
props
;
const
{
onClick
,
title
,
icon
,
loading
}
=
props
;
return
(
return
(
<
Button
<
Button
title=
{
title
}
title=
{
title
}
loading=
{
loading
}
loading=
{
loading
}
icon=
{
icon
}
icon=
{
icon
}
block
block
type=
{
'text'
}
type=
{
'text'
}
shape=
{
'circle'
}
shape=
{
'circle'
}
onClick=
{
onClick
}
onClick=
{
onClick
}
/>
/>
);
);
};
};
dinky-web/src/pages/DataStudio/BottomContainer/TableData/index.tsx
View file @
89c35c9e
...
@@ -17,112 +17,79 @@
...
@@ -17,112 +17,79 @@
*
*
*/
*/
import
{
SseData
}
from
'@/models/Sse'
;
import
{
SseData
}
from
'@/models/Sse'
;
import
{
getCurrentData
}
from
'@/pages/DataStudio/function'
;
import
{
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
{
SSE_TOPIC
}
from
'@/pages/DevOps/constants'
;
import
{
SSE_TOPIC
}
from
'@/pages/DevOps/constants'
;
import
{
postAll
}
from
'@/services/api'
;
import
{
getData
,
postAll
}
from
'@/services/api'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
useModel
}
from
'@@/exports'
;
import
{
connect
,
useModel
}
from
'@@/exports'
;
import
{
Modal
,
Select
}
from
'antd'
;
import
{
Modal
,
Select
,
Tabs
}
from
'antd'
;
import
TextArea
from
'antd/es/input/TextArea'
;
import
TextArea
from
'antd/es/input/TextArea'
;
import
{
Tab
}
from
'rc-tabs/lib/interface.d'
;
import
{
Tab
}
from
'rc-tabs/lib/interface.d'
;
import
*
as
React
from
'react'
;
import
*
as
React
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
export
async
function
getPrintTables
(
statement
:
string
)
{
export
async
function
getPrintTables
(
statement
:
string
)
{
return
postAll
(
'api/printTable/getPrintTables'
,
{
statement
});
return
postAll
(
'api/printTable/getPrintTables'
,
{
statement
});
}
}
/*--- Clear Console ---*/
/*--- Clear Console ---*/
export
function
clearConsole
()
{
return
getData
(
'api/process/clearConsole'
,
{});
}
export
type
PrintTable
=
{
export
type
PrintTable
=
{
tableName
:
string
;
tableName
:
string
;
fullTableName
:
string
;
fullTableName
:
string
;
};
};
const
DataPage
=
(
props
:
any
)
=>
{
export
const
DataPage
=
(
props
:
any
)
=>
{
const
{
style
,
title
}
=
props
;
const
{
style
,
title
}
=
props
;
const
[
consoleInfo
,
setConsoleInfo
]
=
useState
<
string
>
(
''
);
const
[
consoleInfo
,
setConsoleInfo
]
=
useState
<
string
>
(
''
);
const
{
subscribeTopic
}
=
useModel
(
'Sse'
,
(
model
:
any
)
=>
({
const
{
subscribeTopic
}
=
useModel
(
'Sse'
,
(
model
:
any
)
=>
({
subscribeTopic
:
model
.
subscribeTopic
subscribeTopic
:
model
.
subscribeTopic
}));
}));
const
[
tableName
,
setTableName
]
=
useState
<
string
>
(
''
);
const
[
tableName
,
setTableName
]
=
useState
<
string
>
(
''
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
title
)
{
if
(
title
)
{
setTableName
(
title
.
tableName
);
setTableName
(
title
.
tableName
);
const
topic
=
`
${
SSE_TOPIC
.
PRINT_TABLE
}
/
${
title
.
fullTableName
}
`
;
const
topic
=
`
${
SSE_TOPIC
.
PRINT_TABLE
}
/
${
title
.
fullTableName
}
`
;
return
subscribeTopic
([
topic
],
(
data
:
SseData
)
=>
{
return
subscribeTopic
([
topic
],
(
data
:
SseData
)
=>
{
setConsoleInfo
((
preConsoleInfo
)
=>
preConsoleInfo
+
'
\
n'
+
data
.
data
);
setConsoleInfo
((
preConsoleInfo
)
=>
preConsoleInfo
+
'
\
n'
+
data
.
data
);
});
});
}
}
},
[]);
},
[]);
return
<
TextArea
value=
{
consoleInfo
}
style=
{
{
width
:
style
.
width
,
height
:
style
.
height
}
}
/>;
return
<
TextArea
value=
{
consoleInfo
}
style=
{
{
width
:
style
.
width
,
height
:
style
.
height
}
}
/>;
};
};
const
TableData
=
(
props
:
any
)
=>
{
export
const
onAdd
=
async
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
refresh
:
any
)
=>
{
const
{
statement
,
height
}
=
props
;
const
statement
=
data
?.
statement
;
const
[
panes
,
setPanes
]
=
useState
<
Tab
[]
>
([]);
function
onOk
(
title
:
PrintTable
)
{
const
activeKey
=
`
${
panes
.
length
+
1
}
`
;
const
newPanes
=
[...
panes
];
newPanes
.
push
({
label
:
title
.
tableName
,
children
:
<
DataPage
title=
{
title
}
style=
{
{
width
:
'100%'
,
height
:
height
-
63
}
}
/>,
key
:
activeKey
});
setPanes
(
newPanes
);
}
const
addTab
=
async
()
=>
{
if
(
!
statement
)
return
;
if
(
!
statement
)
return
;
const
tabNames
=
tabs
.
map
((
tab
)
=>
tab
.
label
);
const
result
=
await
getPrintTables
(
statement
);
const
result
=
await
getPrintTables
(
statement
);
const
tables
:
PrintTable
[]
=
result
.
data
;
const
tables
:
PrintTable
[]
=
result
.
data
.
filter
((
table
:
PrintTable
)
=>
!
tabNames
.
includes
(
table
.
tableName
))
;
let
selectTable
:
PrintTable
;
let
selectTable
:
PrintTable
;
Modal
.
confirm
({
Modal
.
confirm
({
title
:
l
(
'pages.datastudio.print.table.inputTableName'
),
title
:
l
(
'pages.datastudio.print.table.inputTableName'
),
content
:
(
content
:
(
<
Select
<
Select
defaultValue=
''
defaultValue=
''
style=
{
{
width
:
'90%'
}
}
style=
{
{
width
:
'90%'
}
}
onChange=
{
(
e
,
t
:
any
)
=>
{
onChange=
{
(
e
,
t
:
any
)
=>
{
selectTable
=
{
tableName
:
t
.
label
,
fullTableName
:
t
.
value
};
selectTable
=
{
tableName
:
t
.
label
,
fullTableName
:
t
.
value
};
}
}
}
}
options=
{
tables
.
map
((
table
)
=>
({
label
:
table
.
tableName
,
value
:
table
.
fullTableName
}))
}
options=
{
tables
.
map
((
table
)
=>
({
label
:
table
.
tableName
,
value
:
table
.
fullTableName
}))
}
/>
/>
),
),
onOk
()
{
onOk
()
{
onOk
(
selectTable
);
tabs
.
push
({
},
key
:
key
+
"/"
+
selectTable
.
tableName
,
zIndex
:
1000
label
:
selectTable
.
tableName
,
children
:
<
DataPage
title=
{
selectTable
}
style=
{
{
width
:
'100%'
,
height
:
'100%'
}
}
/>
});
refresh
()
// onOk(selectTable);
},
zIndex
:
1000
});
});
};
}
\ No newline at end of file
const
onEdit
=
(
targetKey
:
React
.
MouseEvent
|
React
.
KeyboardEvent
|
string
,
action
:
'add'
|
'remove'
)
=>
{
switch
(
action
)
{
case
'add'
:
addTab
();
break
;
case
'remove'
:
const
newPanes
=
panes
.
filter
((
pane
)
=>
pane
.
key
!==
targetKey
);
setPanes
(
newPanes
);
break
;
}
};
return
<
Tabs
type=
'editable-card'
onEdit=
{
onEdit
}
items=
{
panes
}
/>;
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
height
:
Studio
.
bottomContainer
.
height
,
statement
:
getCurrentData
(
Studio
.
tabs
.
panes
,
Studio
.
tabs
.
activeKey
)?.
statement
}))(
TableData
);
dinky-web/src/pages/DataStudio/BottomContainer/index.tsx
View file @
89c35c9e
...
@@ -17,266 +17,310 @@
...
@@ -17,266 +17,310 @@
*
*
*/
*/
import
{
CircleBtn
}
from
'@/components/CallBackButton/CircleBtn'
;
import
{
CircleBtn
}
from
'@/components/CallBackButton/CircleBtn'
;
import
Title
from
'@/components/Front/Title'
;
import
Title
from
'@/components/Front/Title'
;
import
ContentScroll
from
'@/components/Scroll/ContentScroll'
;
import
ContentScroll
from
'@/components/Scroll/ContentScroll'
;
import
MovableSidebar
from
'@/components/Sidebar/MovableSidebar'
;
import
MovableSidebar
from
'@/components/Sidebar/MovableSidebar'
;
import
{
import
{
StateType
,
StateType
,
STUDIO_MODEL
,
STUDIO_MODEL
,
TabsItemType
,
TabsItemType
,
TabsPageType
,
TabsPageType
,
VIEW
VIEW
}
from
'@/pages/DataStudio/model'
;
}
from
'@/pages/DataStudio/model'
;
import
{
LeftBottomMoreTabs
,
LeftBottomSide
}
from
'@/pages/DataStudio/route'
;
import
{
BottomBtnRoute
,
LeftBottomMoreTabs
,
LeftBottomSide
,
Tab
}
from
'@/pages/DataStudio/route'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
connect
}
from
'@@/exports'
;
import
{
connect
}
from
'@@/exports'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ConfigProvider
,
Space
,
Tabs
}
from
'antd'
;
import
{
ConfigProvider
,
Space
,
Tabs
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
from
'react'
;
import
{
getCurrentData
}
from
"@/pages/DataStudio/function"
;
import
{
BottomTabRoute
}
from
"@/pages/DataStudio/TabRoute"
;
export
type
BottomContainerProps
=
{
export
type
BottomContainerProps
=
{
size
:
number
;
size
:
number
;
height
:
number
|
string
;
height
:
number
|
string
;
};
};
const
BottomContainer
:
React
.
FC
<
BottomContainerProps
>
=
(
props
:
any
)
=>
{
const
BottomContainer
:
React
.
FC
<
BottomContainerProps
>
=
(
props
:
any
)
=>
{
const
{
const
{
dispatch
,
dispatch
,
size
,
size
,
bottomContainer
,
bottomContainer
,
height
,
height
,
tabs
:
{
activeKey
,
panes
}
tabs
:
{
activeKey
,
panes
}
}
=
props
;
}
=
props
;
const
width
=
document
.
documentElement
.
clientWidth
-
VIEW
.
sideWidth
*
2
;
const
currentData
=
getCurrentData
(
panes
,
activeKey
);
const
taskId
=
currentData
?.
id
??
0
;
const
[
tabState
,
setTabState
]
=
useState
<
Record
<
string
,
Tab
[]
>>
(
Object
.
keys
(
BottomTabRoute
).
map
(
x
=>
({[
x
]:
[]})).
reduce
((
a
,
b
)
=>
({...
a
,
...
b
}),
{}));
const
tabItems
=
(
LeftBottomMoreTabs
[
bottomContainer
.
selectKey
]
??
[]).
map
((
item
:
any
)
=>
{
return
{
key
:
bottomContainer
.
selectKey
+
'/'
+
item
.
key
,
label
:
(<
span
>
{
item
.
icon
}{
item
.
label
}
</
span
>)
};
})
useEffect
(()
=>
{
setTabState
({...
tabState
,
[
bottomContainer
.
selectKey
]:
[]});
},[
taskId
,
bottomContainer
.
selectKey
])
const
refresh
=
()
=>
{
const
tabs
=
tabState
?.[
bottomContainer
.
selectKey
]
??
[];
setTabState
({...
tabState
,
[
bottomContainer
.
selectKey
]:
[...
tabs
]})
}
/**
const
width
=
document
.
documentElement
.
clientWidth
-
VIEW
.
sideWidth
*
2
;
* 侧边栏最小化
*/
const
handleMinimize
=
()
=>
{
dispatch
({
type
:
STUDIO_MODEL
.
updateSelectBottomKey
,
payload
:
''
});
};
/**
/**
* 更新底部高度
* 侧边栏最小化
* @param {number} height
*/
*/
const
handleMinimize
=
()
=>
{
const
updateBottomHeight
=
(
height
:
number
)
=>
{
dispatch
({
dispatch
({
type
:
STUDIO_MODEL
.
updateSelectBottomKey
,
type
:
STUDIO_MODEL
.
updateBottomHeight
,
payload
:
''
payload
:
height
});
});
};
};
/**
/**
* 更新中间内容
高度
* 更新底部
高度
* @param {number} height
* @param {number} height
*/
*/
const
updateCenterContent
Height
=
(
height
:
number
)
=>
{
const
updateBottom
Height
=
(
height
:
number
)
=>
{
dispatch
({
dispatch
({
type
:
STUDIO_MODEL
.
updateCenterContent
Height
,
type
:
STUDIO_MODEL
.
updateBottom
Height
,
payload
:
height
payload
:
height
});
});
};
};
const
updateSelectBottomSubKey
=
(
key
:
string
)
=>
{
/**
dispatch
({
* 更新中间内容高度
type
:
STUDIO_MODEL
.
updateSelectBottomSubKey
,
* @param {number} height
payload
:
key
*/
});
const
updateCenterContentHeight
=
(
height
:
number
)
=>
{
};
dispatch
({
type
:
STUDIO_MODEL
.
updateCenterContentHeight
,
payload
:
height
});
};
const
updateSelectBottom
Key
=
(
key
:
string
)
=>
{
const
updateSelectBottomSub
Key
=
(
key
:
string
)
=>
{
dispatch
({
dispatch
({
type
:
STUDIO_MODEL
.
updateSelectBottom
Key
,
type
:
STUDIO_MODEL
.
updateSelectBottomSub
Key
,
payload
:
key
payload
:
key
});
});
};
};
/**
const
updateSelectBottomKey
=
(
key
:
string
)
=>
{
* 更新工具栏内容高度
dispatch
({
* @param {number} height
type
:
STUDIO_MODEL
.
updateSelectBottomKey
,
*/
payload
:
key
const
updateToolContentHeight
=
(
height
:
number
)
=>
{
});
dispatch
({
};
type
:
STUDIO_MODEL
.
updateToolContentHeight
,
payload
:
height
});
};
const
getSubTabs
=
()
=>
{
// @ts-ignore
return
Object
.
values
(
Object
.
keys
(
LeftBottomMoreTabs
).
map
((
x
)
=>
LeftBottomMoreTabs
[
x
].
map
((
y
)
=>
{
return
{
...
y
,
key
:
x
+
'/'
+
y
.
key
};
})
)
).
flatMap
((
x
)
=>
x
);
};
/**
/**
* 拖动回调
* 更新工具栏内容高度
* @param event
* @param {number} height
* @param direction
*/
* @param {{offsetHeight: any}} elementRef
const
updateToolContentHeight
=
(
height
:
number
)
=>
{
*/
dispatch
({
const
resizeCallback
=
(
type
:
STUDIO_MODEL
.
updateToolContentHeight
,
event
:
any
,
payload
:
height
direction
:
any
,
});
elementRef
:
{
};
offsetHeight
:
any
;
const
getSubTabs
=
()
=>
{
}
// @ts-ignore
)
=>
{
return
Object
.
values
(
const
centerContentHeight
=
Object
.
keys
(
LeftBottomMoreTabs
).
map
((
x
)
=>
document
.
documentElement
.
clientHeight
-
LeftBottomMoreTabs
[
x
].
map
((
y
)
=>
{
VIEW
.
headerHeight
-
return
{...
y
,
key
:
x
+
'/'
+
y
.
key
};
VIEW
.
headerNavHeight
-
})
VIEW
.
footerHeight
-
)
VIEW
.
otherHeight
-
).
flatMap
((
x
)
=>
x
);
elementRef
.
offsetHeight
;
};
updateBottomHeight
(
elementRef
.
offsetHeight
);
updateCenterContentHeight
(
centerContentHeight
);
updateToolContentHeight
(
centerContentHeight
-
VIEW
.
leftMargin
);
};
const
renderTabPane
=
()
=>
{
/**
// @ts-ignore
* 拖动回调
const
leftBottomMoreTab
=
LeftBottomMoreTabs
[
bottomContainer
.
selectKey
];
* @param event
if
(
leftBottomMoreTab
)
{
* @param direction
const
items
=
leftBottomMoreTab
.
map
((
item
:
any
)
=>
{
* @param {{offsetHeight: any}} elementRef
return
{
*/
key
:
bottomContainer
.
selectKey
+
'/'
+
item
.
key
,
const
resizeCallback
=
(
label
:
(
<
span
>
{
item
.
icon
}
{
item
.
label
}
</
span
>
)
};
});
return
(
<
Tabs
style=
{
{
height
:
'32px'
,
display
:
'-webkit-box'
}
}
items=
{
items
}
type=
'card'
onChange=
{
(
key
:
string
)
=>
{
updateSelectBottomSubKey
(
key
.
split
(
'/'
)[
1
]);
}
}
activeKey=
{
bottomContainer
.
selectKey
+
'/'
+
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
}
size=
'small'
tabPosition=
'top'
/>
);
}
return
<></>;
};
const
renderItems
=
()
=>
{
return
[
...
LeftBottomSide
.
filter
((
tab
)
=>
{
if
(
!
tab
.
isShow
)
{
return
true
;
}
if
(
parseInt
(
activeKey
)
<
0
)
{
return
TabsPageType
.
None
;
}
const
currentTab
=
(
panes
as
TabsItemType
[]).
find
((
item
)
=>
item
.
key
===
activeKey
);
const
show
=
tab
.
isShow
(
currentTab
?.
type
??
TabsPageType
.
None
,
currentTab
?.
subType
);
// 如果当前打开的菜单等于 状态存的菜单 且 菜单不显示状态下,先切换到项目key(因为项目key 不可能不显示) 在关闭这个
// if current open menu equal status menu and menu is not show status, first switch to project key(because project key is not show) and close this
// if (tab.key === bottomContainer.selectKey && !show) {
// updateSelectBottomKey(
// currentTab?.subType?.toLowerCase() === DIALECT.FLINKSQLENV
// || currentTab?.subType?.toLowerCase() === DIALECT.SCALA
// || currentTab?.subType?.toLowerCase() === DIALECT.JAVA
// || currentTab?.subType?.toLowerCase() === DIALECT.PYTHON_LONG
// ? LeftBottomKey.TOOLS_KEY // 如果当前打开的是flinksql环境,scala,java,python,切换到工具栏
// : currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL
// || currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR
// || isSql(currentTab?.subType ?? '')
// ? LeftBottomKey.CONSOLE_KEY : LeftBottomKey.TOOLS_KEY // 如果当前打开的是flinksql,flinkjar,切换到控制台
// );
// }
return
show
;
}).
map
((
x
)
=>
{
return
{
...
x
,
key
:
x
.
key
+
'/'
};
}),
...
getSubTabs
()
].
map
((
item
)
=>
{
return
{
...
item
,
children
:
(
<
ContentScroll
height=
{
props
.
height
-
VIEW
.
leftMargin
}
>
{
item
.
children
}
</
ContentScroll
>
)
};
});
};
return
(
<
MovableSidebar
title=
{
<
ConfigProvider
theme=
{
{
components
:
{
Tabs
:
{
horizontalMargin
:
'0'
,
cardPaddingSM
:
'6px'
,
horizontalItemPadding
:
'0'
}
}
}
}
>
<
Space
>
<
Title
>
{
l
(
bottomContainer
.
selectKey
)
}
</
Title
>
{
renderTabPane
()
}
</
Space
>
</
ConfigProvider
>
}
visible=
{
bottomContainer
.
selectKey
}
style=
{
{
zIndex
:
999
,
height
:
height
,
marginTop
:
0
,
backgroundColor
:
'#fff'
,
position
:
'fixed'
,
bottom
:
VIEW
.
footerHeight
}
}
defaultSize=
{
{
width
:
'100%'
,
height
:
height
}
}
minHeight=
{
VIEW
.
midMargin
}
maxHeight=
{
size
.
contentHeight
-
40
}
onResize=
{
(
event
:
any
,
event
:
any
,
direction
:
any
,
direction
:
any
,
elementRef
:
{
elementRef
:
{
offsetHeight
:
any
;
offsetHeight
:
any
;
}
}
)
=>
resizeCallback
(
event
,
direction
,
elementRef
)
}
)
=>
{
btnGroup=
{
[<
CircleBtn
key=
{
'max'
}
icon=
{
<
PlusOutlined
/>
}
/>]
}
const
centerContentHeight
=
enable=
{
{
top
:
true
}
}
document
.
documentElement
.
clientHeight
-
handlerMinimize=
{
handleMinimize
}
VIEW
.
headerHeight
-
maxWidth=
{
width
}
VIEW
.
headerNavHeight
-
>
VIEW
.
footerHeight
-
<
Tabs
VIEW
.
otherHeight
-
activeKey=
{
elementRef
.
offsetHeight
;
bottomContainer
.
selectKey
+
updateBottomHeight
(
elementRef
.
offsetHeight
);
'/'
+
updateCenterContentHeight
(
centerContentHeight
);
(
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
updateToolContentHeight
(
centerContentHeight
-
VIEW
.
leftMargin
);
?
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
};
:
''
)
const
renderTabPane
=
()
=>
{
const
onChange
=
(
activeKey
:
string
)
=>
{
updateSelectBottomSubKey
(
activeKey
.
split
(
'/'
)[
1
]);
}
}
items=
{
renderItems
()
}
const
onEdit
=
async
(
tabBarStyle=
{
{
display
:
'none'
}
}
targetKey
:
React
.
MouseEvent
|
React
.
KeyboardEvent
|
string
,
/>
action
:
'add'
|
'remove'
</
MovableSidebar
>
)
=>
{
);
switch
(
action
)
{
case
'add'
:
await
BottomTabRoute
[
bottomContainer
.
selectKey
].
onAdd
(
tabState
?.[
bottomContainer
.
selectKey
]
??
[],
bottomContainer
.
selectKey
,
currentData
,
refresh
);
break
;
case
'remove'
:
const
newPanes
=
tabState
?.[
bottomContainer
.
selectKey
].
filter
(
pane
=>
pane
.
key
!==
targetKey
);
setTabState
({...
tabState
,
[
bottomContainer
.
selectKey
]:
newPanes
});
break
;
}
};
return
(
<>
<
Tabs
style=
{
{
height
:
'32px'
,
display
:
'-webkit-box'
}
}
items=
{
tabItems
}
type=
'card'
onChange=
{
(
key
:
string
)
=>
{
updateSelectBottomSubKey
(
key
.
split
(
'/'
)[
1
]);
}
}
activeKey=
{
bottomContainer
.
selectKey
+
'/'
+
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
}
size=
'small'
tabPosition=
'top'
/>
{
BottomTabRoute
[
bottomContainer
.
selectKey
]
&&
<
Tabs
style=
{
{
height
:
'32px'
,
display
:
'-webkit-box'
}
}
items=
{
tabState
?.[
bottomContainer
.
selectKey
].
map
(
x
=>
({
key
:
x
.
key
,
label
:
x
.
label
}))
}
onEdit=
{
onEdit
}
activeKey=
{
bottomContainer
.
selectKey
+
'/'
+
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
}
onChange=
{
onChange
}
type=
'editable-card'
size=
'small'
tabPosition=
'top'
/>
}
</>
);
};
const
renderItems
=
()
=>
{
return
[
...
LeftBottomSide
.
filter
((
tab
)
=>
{
if
(
!
tab
.
isShow
)
{
return
true
;
}
if
(
parseInt
(
activeKey
)
<
0
)
{
return
TabsPageType
.
None
;
}
const
currentTab
=
(
panes
as
TabsItemType
[]).
find
((
item
)
=>
item
.
key
===
activeKey
);
const
show
=
tab
.
isShow
(
currentTab
?.
type
??
TabsPageType
.
None
,
currentTab
?.
subType
);
// 如果当前打开的菜单等于 状态存的菜单 且 菜单不显示状态下,先切换到项目key(因为项目key 不可能不显示) 在关闭这个
// if current open menu equal status menu and menu is not show status, first switch to project key(because project key is not show) and close this
// if (tab.key === bottomContainer.selectKey && !show) {
// updateSelectBottomKey(
// currentTab?.subType?.toLowerCase() === DIALECT.FLINKSQLENV
// || currentTab?.subType?.toLowerCase() === DIALECT.SCALA
// || currentTab?.subType?.toLowerCase() === DIALECT.JAVA
// || currentTab?.subType?.toLowerCase() === DIALECT.PYTHON_LONG
// ? LeftBottomKey.TOOLS_KEY // 如果当前打开的是flinksql环境,scala,java,python,切换到工具栏
// : currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL
// || currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR
// || isSql(currentTab?.subType ?? '')
// ? LeftBottomKey.CONSOLE_KEY : LeftBottomKey.TOOLS_KEY // 如果当前打开的是flinksql,flinkjar,切换到控制台
// );
// }
return
show
;
}).
map
((
x
)
=>
{
return
{...
x
,
key
:
x
.
key
+
'/'
};
}),
...
getSubTabs
(),
...
tabState
?.[
bottomContainer
.
selectKey
]
??
[]
].
map
((
item
)
=>
{
return
{
...
item
,
children
:
(
<
ContentScroll
height=
{
props
.
height
-
VIEW
.
leftMargin
}
>
{
item
.
children
}
</
ContentScroll
>
)
};
});
};
return
(
<
MovableSidebar
title=
{
<
ConfigProvider
theme=
{
{
components
:
{
Tabs
:
{
horizontalMargin
:
'0'
,
cardPaddingSM
:
'6px'
,
horizontalItemPadding
:
'0'
}
}
}
}
>
<
Space
>
<
Title
>
{
l
(
bottomContainer
.
selectKey
)
}
</
Title
>
{
renderTabPane
()
}
</
Space
>
</
ConfigProvider
>
}
visible=
{
bottomContainer
.
selectKey
}
style=
{
{
zIndex
:
999
,
height
:
height
,
marginTop
:
0
,
backgroundColor
:
'#fff'
,
position
:
'fixed'
,
bottom
:
VIEW
.
footerHeight
}
}
defaultSize=
{
{
width
:
'100%'
,
height
:
height
}
}
minHeight=
{
VIEW
.
midMargin
}
maxHeight=
{
size
.
contentHeight
-
40
}
onResize=
{
(
event
:
any
,
direction
:
any
,
elementRef
:
{
offsetHeight
:
any
;
}
)
=>
resizeCallback
(
event
,
direction
,
elementRef
)
}
btnGroup=
{
BottomBtnRoute
[
bottomContainer
.
selectKey
]?.
map
(
x
=>
<
CircleBtn
key=
{
x
.
key
}
icon=
{
x
.
icon
}
onClick=
{
async
()
=>
{
const
tabs
=
tabState
?.[
bottomContainer
.
selectKey
]
??
[];
await
x
.
onClick
?.(
tabs
,
bottomContainer
.
selectKey
,
currentData
,
refresh
);
refresh
()
}
}
/>)
}
enable=
{
{
top
:
true
}
}
handlerMinimize=
{
handleMinimize
}
maxWidth=
{
width
}
>
<
Tabs
activeKey=
{
bottomContainer
.
selectKey
+
'/'
+
(
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
?
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
:
''
)
}
items=
{
renderItems
()
}
tabBarStyle=
{
{
display
:
'none'
}
}
/>
</
MovableSidebar
>
);
};
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
bottomContainer
:
Studio
.
bottomContainer
,
bottomContainer
:
Studio
.
bottomContainer
,
tabs
:
Studio
.
tabs
tabs
:
Studio
.
tabs
}))(
BottomContainer
);
}))(
BottomContainer
);
dinky-web/src/pages/DataStudio/TabRoute.tsx
0 → 100644
View file @
89c35c9e
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
from
"react"
;
import
{
Tab
}
from
"@/pages/DataStudio/route"
;
import
{
TaskDataType
}
from
"@/pages/DataStudio/model"
;
import
{
LeftBottomKey
}
from
"@/pages/DataStudio/data.d"
;
import
{
onAdd
}
from
"@/pages/DataStudio/BottomContainer/TableData"
;
export
type
BottomTabProps
=
{
icon
?:
React
.
ReactNode
;
onAdd
:
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
operator
:
any
)
=>
Promise
<
void
>
;
onRemove
?:
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
tabKey
:
string
,
refresh
:
any
)
=>
Promise
<
void
>
;
key
:
string
;
};
export
const
BottomTabRoute
:
{
[
c
:
string
]:
BottomTabProps
}
=
{
[
LeftBottomKey
.
TABLE_DATA_KEY
]:
{
key
:
'add table data'
,
onAdd
:
async
(
tabs
,
key
,
data
,
operator
)
=>
{
await
onAdd
(
tabs
,
key
,
data
,
operator
);
}
}
}
\ No newline at end of file
dinky-web/src/pages/DataStudio/route.tsx
View file @
89c35c9e
...
@@ -17,290 +17,317 @@
...
@@ -17,290 +17,317 @@
*
*
*/
*/
import
{
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
import
{
CircleBottomButtonProps
,
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
JobExecHistory
from
'@/pages/DataStudio/BottomContainer/JobExecHistory'
;
import
JobExecHistory
from
'@/pages/DataStudio/BottomContainer/JobExecHistory'
;
import
Lineage
from
'@/pages/DataStudio/BottomContainer/Lineage'
;
import
Lineage
from
'@/pages/DataStudio/BottomContainer/Lineage'
;
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
import
TableData
from
'@/pages/DataStudio/BottomContainer/TableData'
;
import
JsonToSql
from
'@/pages/DataStudio/BottomContainer/Tools/JsonToSql'
;
import
JsonToSql
from
'@/pages/DataStudio/BottomContainer/Tools/JsonToSql'
;
import
TextComparison
from
'@/pages/DataStudio/BottomContainer/Tools/TextComparison'
;
import
TextComparison
from
'@/pages/DataStudio/BottomContainer/Tools/TextComparison'
;
import
{
LeftBottomKey
,
LeftMenuKey
,
RightMenuKey
}
from
'@/pages/DataStudio/data.d'
;
import
{
LeftBottomKey
,
LeftMenuKey
,
RightMenuKey
}
from
'@/pages/DataStudio/data.d'
;
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
Catalog
from
'@/pages/DataStudio/LeftContainer/Catalog'
;
import
Catalog
from
'@/pages/DataStudio/LeftContainer/Catalog'
;
import
DataSource
from
'@/pages/DataStudio/LeftContainer/DataSource'
;
import
DataSource
from
'@/pages/DataStudio/LeftContainer/DataSource'
;
import
GlobalVariable
from
'@/pages/DataStudio/LeftContainer/GlobaleVar'
;
import
GlobalVariable
from
'@/pages/DataStudio/LeftContainer/GlobaleVar'
;
import
Project
from
'@/pages/DataStudio/LeftContainer/Project'
;
import
Project
from
'@/pages/DataStudio/LeftContainer/Project'
;
import
{
TabsPageSubType
,
TabsPageType
}
from
'@/pages/DataStudio/model'
;
import
{
TabsPageSubType
,
TabsPageType
}
from
'@/pages/DataStudio/model'
;
import
HistoryVersion
from
'@/pages/DataStudio/RightContainer/HistoryVersion'
;
import
HistoryVersion
from
'@/pages/DataStudio/RightContainer/HistoryVersion'
;
import
JobConfig
from
'@/pages/DataStudio/RightContainer/JobConfig'
;
import
JobConfig
from
'@/pages/DataStudio/RightContainer/JobConfig'
;
import
JobInfo
from
'@/pages/DataStudio/RightContainer/JobInfo'
;
import
JobInfo
from
'@/pages/DataStudio/RightContainer/JobInfo'
;
import
PreViewConfig
from
'@/pages/DataStudio/RightContainer/PreViewConfig'
;
import
PreViewConfig
from
'@/pages/DataStudio/RightContainer/PreViewConfig'
;
import
SavePoints
from
'@/pages/DataStudio/RightContainer/SavePoints'
;
import
SavePoints
from
'@/pages/DataStudio/RightContainer/SavePoints'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
import
{
ApartmentOutlined
,
ApartmentOutlined
,
ArrowsAltOutlined
,
ArrowsAltOutlined
,
ConsoleSqlOutlined
,
ConsoleSqlOutlined
,
DatabaseOutlined
,
DatabaseOutlined
,
EnvironmentOutlined
,
EnvironmentOutlined
,
FolderOutlined
,
FolderOutlined
,
FunctionOutlined
,
FunctionOutlined
,
HistoryOutlined
,
HistoryOutlined
,
InfoCircleOutlined
,
InfoCircleOutlined
,
InsertRowRightOutlined
,
InsertRowRightOutlined
,
MonitorOutlined
,
MonitorOutlined
,
PlusCircleOutlined
,
PlusCircleOutlined
,
PlusOutlined
,
PlusOutlined
,
ReloadOutlined
,
ReloadOutlined
,
RightSquareOutlined
,
RightSquareOutlined
,
RotateRightOutlined
,
RotateRightOutlined
,
SettingOutlined
,
SettingOutlined
,
ShrinkOutlined
,
ShrinkOutlined
,
TableOutlined
,
TableOutlined
,
ToolOutlined
ToolOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
ReactNode
}
from
'react'
;
import
React
,
{
ReactNode
}
from
'react'
;
import
{
TabPaneProps
}
from
"antd"
;
export
const
LeftSide
:
TabProp
[]
=
[
export
const
LeftSide
:
TabProp
[]
=
[
{
{
auth
:
'/datastudio/left/project'
,
auth
:
'/datastudio/left/project'
,
key
:
LeftMenuKey
.
PROJECT_KEY
,
key
:
LeftMenuKey
.
PROJECT_KEY
,
icon
:
<
ConsoleSqlOutlined
/>,
icon
:
<
ConsoleSqlOutlined
/>,
label
:
l
(
LeftMenuKey
.
PROJECT_KEY
),
label
:
l
(
LeftMenuKey
.
PROJECT_KEY
),
children
:
<
Project
/>
children
:
<
Project
/>
},
},
{
{
auth
:
'/datastudio/left/catalog'
,
auth
:
'/datastudio/left/catalog'
,
key
:
LeftMenuKey
.
CATALOG_KEY
,
key
:
LeftMenuKey
.
CATALOG_KEY
,
icon
:
<
TableOutlined
/>,
icon
:
<
TableOutlined
/>,
label
:
l
(
LeftMenuKey
.
CATALOG_KEY
),
label
:
l
(
LeftMenuKey
.
CATALOG_KEY
),
children
:
<
Catalog
/>,
children
:
<
Catalog
/>,
isShow
:
(
type
,
subType
)
=>
isShow
:
(
type
,
subType
)
=>
(
type
===
TabsPageType
.
project
||
type
===
TabsPageType
.
metadata
)
&&
(
type
===
TabsPageType
.
project
||
type
===
TabsPageType
.
metadata
)
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
},
},
{
{
auth
:
'/datastudio/left/datasource'
,
auth
:
'/datastudio/left/datasource'
,
key
:
LeftMenuKey
.
DATASOURCE_KEY
,
key
:
LeftMenuKey
.
DATASOURCE_KEY
,
icon
:
<
DatabaseOutlined
/>,
icon
:
<
DatabaseOutlined
/>,
label
:
l
(
LeftMenuKey
.
DATASOURCE_KEY
),
label
:
l
(
LeftMenuKey
.
DATASOURCE_KEY
),
children
:
<
DataSource
/>
children
:
<
DataSource
/>
},
},
{
{
auth
:
'/datastudio/left/globalVariable'
,
auth
:
'/datastudio/left/globalVariable'
,
key
:
LeftMenuKey
.
FRAGMENT_KEY
,
key
:
LeftMenuKey
.
FRAGMENT_KEY
,
icon
:
<
FunctionOutlined
/>,
icon
:
<
FunctionOutlined
/>,
label
:
l
(
LeftMenuKey
.
FRAGMENT_KEY
),
label
:
l
(
LeftMenuKey
.
FRAGMENT_KEY
),
children
:
<
GlobalVariable
/>,
children
:
<
GlobalVariable
/>,
isShow
:
(
type
,
subType
)
=>
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
type
===
TabsPageType
.
project
&&
!
isSql
(
subType
??
''
)
&&
!
isSql
(
subType
??
''
)
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
}
}
];
];
export
const
RightSide
:
TabProp
[]
=
[
export
const
RightSide
:
TabProp
[]
=
[
{
auth
:
'/datastudio/right/jobConfig'
,
key
:
RightMenuKey
.
JOB_CONFIG_KEY
,
icon
:
<
SettingOutlined
/>,
label
:
l
(
RightMenuKey
.
JOB_CONFIG_KEY
),
children
:
<
JobConfig
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
(
TabsPageSubType
.
flinkSql
===
subType
||
TabsPageSubType
.
flinkJar
===
subType
)
},
{
auth
:
'/datastudio/right/previewConfig'
,
key
:
RightMenuKey
.
PREVIEW_CONFIG_KEY
,
icon
:
<
InsertRowRightOutlined
/>,
label
:
l
(
RightMenuKey
.
PREVIEW_CONFIG_KEY
),
children
:
<
PreViewConfig
/>,
isShow
:
(
type
,
subType
)
=>
(
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
)
||
isSql
(
subType
??
''
)
},
{
auth
:
'/datastudio/right/savePoint'
,
key
:
RightMenuKey
.
SAVEPOINT_KEY
,
icon
:
<
FolderOutlined
/>,
label
:
l
(
RightMenuKey
.
SAVEPOINT_KEY
),
children
:
<
SavePoints
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
auth
:
'/datastudio/right/historyVision'
,
key
:
RightMenuKey
.
HISTORY_VISION_KEY
,
icon
:
<
HistoryOutlined
/>,
label
:
l
(
RightMenuKey
.
HISTORY_VISION_KEY
),
children
:
<
HistoryVersion
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
auth
:
'/datastudio/right/jobInfo'
,
key
:
RightMenuKey
.
JOB_INFO_KEY
,
icon
:
<
InfoCircleOutlined
/>,
label
:
l
(
RightMenuKey
.
JOB_INFO_KEY
),
children
:
<
JobInfo
/>,
isShow
:
(
type
)
=>
type
===
TabsPageType
.
project
}
];
export
const
LeftBottomSide
:
TabProp
[]
=
[
{
auth
:
'/datastudio/bottom/console'
,
key
:
LeftBottomKey
.
CONSOLE_KEY
,
icon
:
<
RightSquareOutlined
/>,
label
:
l
(
LeftBottomKey
.
CONSOLE_KEY
),
children
:
<
Console
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
{
auth
:
'/datastudio/bottom/result'
,
key
:
LeftBottomKey
.
RESULT_KEY
,
icon
:
<
MonitorOutlined
/>,
label
:
l
(
LeftBottomKey
.
RESULT_KEY
),
children
:
<
Result
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
{
auth
:
'/datastudio/bottom/lineage'
,
key
:
LeftBottomKey
.
LINEAGE_KEY
,
icon
:
<
ApartmentOutlined
/>,
label
:
l
(
LeftBottomKey
.
LINEAGE_KEY
),
children
:
<
Lineage
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
{
auth
:
'/datastudio/bottom/history'
,
key
:
LeftBottomKey
.
HISTORY_KEY
,
icon
:
<
HistoryOutlined
/>,
label
:
l
(
LeftBottomKey
.
HISTORY_KEY
),
children
:
<
JobExecHistory
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
!
isSql
(
subType
??
''
)
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
{
auth
:
'/datastudio/bottom/table-data'
,
key
:
LeftBottomKey
.
TABLE_DATA_KEY
,
icon
:
<
TableOutlined
/>,
label
:
l
(
LeftBottomKey
.
TABLE_DATA_KEY
),
children
:
<
TableData
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
},
{
auth
:
'/datastudio/bottom/tool'
,
key
:
LeftBottomKey
.
TOOLS_KEY
,
icon
:
<
ToolOutlined
/>,
label
:
l
(
LeftBottomKey
.
TOOLS_KEY
),
children
:
<></>
}
];
export
const
LeftBottomMoreTabs
:
{
[
c
:
string
]:
TabProp
[]
}
=
{
'menu.datastudio.tool'
:
[
{
{
key
:
'menu.datastudio.tool.text-comparison'
,
auth
:
'/datastudio/right/jobConfig'
,
icon
:
<
ToolOutlined
/>,
key
:
RightMenuKey
.
JOB_CONFIG_KEY
,
label
:
l
(
'menu.datastudio.tool.text-comparison'
),
icon
:
<
SettingOutlined
/>,
children
:
<
TextComparison
/>
label
:
l
(
RightMenuKey
.
JOB_CONFIG_KEY
),
children
:
<
JobConfig
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
(
TabsPageSubType
.
flinkSql
===
subType
||
TabsPageSubType
.
flinkJar
===
subType
)
},
},
{
{
key
:
'menu.datastudio.tool.jsonToSql'
,
auth
:
'/datastudio/right/previewConfig'
,
icon
:
<
RotateRightOutlined
/>,
key
:
RightMenuKey
.
PREVIEW_CONFIG_KEY
,
label
:
l
(
'menu.datastudio.tool.jsonToSql'
),
icon
:
<
InsertRowRightOutlined
/>,
children
:
<
JsonToSql
/>
label
:
l
(
RightMenuKey
.
PREVIEW_CONFIG_KEY
),
}
children
:
<
PreViewConfig
/>,
]
isShow
:
(
type
,
subType
)
=>
};
(
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
)
||
isSql
(
subType
??
''
)
// btn route
},
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
'menu.datastudio.datasource'
:
[
{
{
icon
:
<
PlusOutlined
/>,
auth
:
'/datastudio/right/savePoint'
,
title
:
l
(
'button.create'
),
key
:
RightMenuKey
.
SAVEPOINT_KEY
,
onClick
:
()
=>
{}
icon
:
<
FolderOutlined
/>,
label
:
l
(
RightMenuKey
.
SAVEPOINT_KEY
),
children
:
<
SavePoints
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
},
{
{
icon
:
<
ReloadOutlined
/>,
auth
:
'/datastudio/right/historyVision'
,
title
:
l
(
'button.refresh'
),
key
:
RightMenuKey
.
HISTORY_VISION_KEY
,
onClick
:
()
=>
{}
icon
:
<
HistoryOutlined
/>,
}
label
:
l
(
RightMenuKey
.
HISTORY_VISION_KEY
),
],
children
:
<
HistoryVersion
/>,
'menu.datastudio.catalog'
:
[
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
{
icon
:
<
ReloadOutlined
/>,
auth
:
'/datastudio/right/jobInfo'
,
title
:
l
(
'button.refresh'
),
key
:
RightMenuKey
.
JOB_INFO_KEY
,
onClick
:
()
=>
{}
icon
:
<
InfoCircleOutlined
/>,
label
:
l
(
RightMenuKey
.
JOB_INFO_KEY
),
children
:
<
JobInfo
/>,
isShow
:
(
type
)
=>
type
===
TabsPageType
.
project
}
}
],
];
'menu.datastudio.project'
:
[
export
const
LeftBottomSide
:
TabProp
[]
=
[
{
{
icon
:
<
PlusCircleOutlined
/>,
auth
:
'/datastudio/bottom/console'
,
title
:
l
(
'right.menu.createRoot'
),
key
:
LeftBottomKey
.
CONSOLE_KEY
,
key
:
'right.menu.createRoot'
,
icon
:
<
RightSquareOutlined
/>,
onClick
:
()
=>
{}
label
:
l
(
LeftBottomKey
.
CONSOLE_KEY
),
children
:
<
Console
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
},
{
{
icon
:
<
ArrowsAltOutlined
/>,
auth
:
'/datastudio/bottom/result'
,
title
:
l
(
'button.expand-all'
),
key
:
LeftBottomKey
.
RESULT_KEY
,
key
:
'button.expand-all'
,
icon
:
<
MonitorOutlined
/>,
onClick
:
()
=>
{}
label
:
l
(
LeftBottomKey
.
RESULT_KEY
),
children
:
<
Result
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
},
{
{
icon
:
<
ShrinkOutlined
/>,
auth
:
'/datastudio/bottom/lineage'
,
title
:
l
(
'button.collapse-all'
),
key
:
LeftBottomKey
.
LINEAGE_KEY
,
key
:
'button.collapse-all'
,
icon
:
<
ApartmentOutlined
/>,
onClick
:
()
=>
{}
label
:
l
(
LeftBottomKey
.
LINEAGE_KEY
),
children
:
<
Lineage
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
},
{
{
icon
:
<
EnvironmentOutlined
/>,
auth
:
'/datastudio/bottom/history'
,
title
:
l
(
'button.position'
),
key
:
LeftBottomKey
.
HISTORY_KEY
,
key
:
'button.position'
,
icon
:
<
HistoryOutlined
/>,
onClick
:
()
=>
{}
label
:
l
(
LeftBottomKey
.
HISTORY_KEY
),
children
:
<
JobExecHistory
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
!
isSql
(
subType
??
''
)
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
FLINKJAR
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
&&
subType
?.
toLowerCase
()
!==
DIALECT
.
JAVA
},
{
auth
:
'/datastudio/bottom/table-data'
,
key
:
LeftBottomKey
.
TABLE_DATA_KEY
,
icon
:
<
TableOutlined
/>,
label
:
l
(
LeftBottomKey
.
TABLE_DATA_KEY
),
children
:
<></>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
subType
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
},
{
auth
:
'/datastudio/bottom/tool'
,
key
:
LeftBottomKey
.
TOOLS_KEY
,
icon
:
<
ToolOutlined
/>,
label
:
l
(
LeftBottomKey
.
TOOLS_KEY
),
children
:
<></>
}
}
]
];
export
const
LeftBottomMoreTabs
:
{
[
c
:
string
]:
TabProp
[]
}
=
{
'menu.datastudio.tool'
:
[
{
key
:
'menu.datastudio.tool.text-comparison'
,
icon
:
<
ToolOutlined
/>,
label
:
l
(
'menu.datastudio.tool.text-comparison'
),
children
:
<
TextComparison
/>
},
{
key
:
'menu.datastudio.tool.jsonToSql'
,
icon
:
<
RotateRightOutlined
/>,
label
:
l
(
'menu.datastudio.tool.jsonToSql'
),
children
:
<
JsonToSql
/>
}
]
};
};
// btn route
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
'menu.datastudio.datasource'
:
[
{
icon
:
<
PlusOutlined
/>,
title
:
l
(
'button.create'
),
onClick
:
()
=>
{
}
},
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{
}
}
],
'menu.datastudio.catalog'
:
[
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{
}
}
],
'menu.datastudio.project'
:
[
{
icon
:
<
PlusCircleOutlined
/>,
title
:
l
(
'right.menu.createRoot'
),
key
:
'right.menu.createRoot'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
ArrowsAltOutlined
/>,
title
:
l
(
'button.expand-all'
),
key
:
'button.expand-all'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
ShrinkOutlined
/>,
title
:
l
(
'button.collapse-all'
),
key
:
'button.collapse-all'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
EnvironmentOutlined
/>,
title
:
l
(
'button.position'
),
key
:
'button.position'
,
onClick
:
()
=>
{
}
}
]
};
export
const
BottomBtnRoute
:
{
[
c
:
string
]:
CircleBottomButtonProps
[]
}
=
{
// todo 右边按钮功能有待完善
// [LeftBottomKey.TABLE_DATA_KEY]: [
// {
// icon: <PlusOutlined/>,
// title: l('test'),
// key: 'test',
// onClick: async (tabs, key, data, refresh) => {
// }
// }
// ]
}
export
type
TabProp
=
{
export
type
TabProp
=
{
key
:
string
;
key
:
string
;
icon
:
ReactNode
;
icon
:
ReactNode
;
label
:
string
;
label
:
string
;
children
:
ReactNode
;
children
:
ReactNode
;
isShow
?:
(
type
:
TabsPageType
,
subType
?:
TabsPageSubType
)
=>
boolean
;
isShow
?:
(
type
:
TabsPageType
,
subType
?:
TabsPageSubType
)
=>
boolean
;
auth
?:
string
;
auth
?:
string
;
};
};
export
interface
Tab
extends
Omit
<
TabPaneProps
,
'tab'
>
{
key
:
string
;
label
:
React
.
ReactNode
;
}
\ No newline at end of file
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