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
18f1c9be
Commit
18f1c9be
authored
Jul 10, 2021
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会话创建与管理
parent
9542a3f6
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
123 deletions
+120
-123
StudioServiceImpl.java
...c/main/java/com/dlink/service/impl/StudioServiceImpl.java
+6
-2
JobConfig.java
dlink-core/src/main/java/com/dlink/job/JobConfig.java
+9
-0
JobManager.java
dlink-core/src/main/java/com/dlink/job/JobManager.java
+7
-2
DDL.ts
dlink-web/src/components/Studio/StudioEvent/DDL.ts
+31
-17
SessionForm.tsx
...StudioLeftTool/StudioConnector/components/SessionForm.tsx
+1
-2
index.tsx
...omponents/Studio/StudioLeftTool/StudioConnector/index.tsx
+30
-26
index.tsx
dlink-web/src/components/Studio/StudioMenu/index.tsx
+14
-6
index.tsx
.../components/Studio/StudioRightTool/StudioConfig/index.tsx
+2
-60
index.tsx
...components/Studio/StudioRightTool/StudioSetting/index.tsx
+3
-2
model.ts
dlink-web/src/pages/FlinkSqlStudio/model.ts
+17
-6
No files found.
dlink-admin/src/main/java/com/dlink/service/impl/StudioServiceImpl.java
View file @
18f1c9be
...
@@ -36,7 +36,9 @@ public class StudioServiceImpl implements StudioService {
...
@@ -36,7 +36,9 @@ public class StudioServiceImpl implements StudioService {
@Override
@Override
public
JobResult
executeSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
public
JobResult
executeSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
JobConfig
config
=
studioExecuteDTO
.
getJobConfig
();
JobConfig
config
=
studioExecuteDTO
.
getJobConfig
();
config
.
setAddress
(
clusterService
.
buildEnvironmentAddress
(
config
.
isUseRemote
(),
studioExecuteDTO
.
getClusterId
()));
if
(!
config
.
isUseSession
())
{
config
.
setAddress
(
clusterService
.
buildEnvironmentAddress
(
config
.
isUseRemote
(),
studioExecuteDTO
.
getClusterId
()));
}
JobManager
jobManager
=
JobManager
.
build
(
config
);
JobManager
jobManager
=
JobManager
.
build
(
config
);
return
jobManager
.
executeSql
(
studioExecuteDTO
.
getStatement
());
return
jobManager
.
executeSql
(
studioExecuteDTO
.
getStatement
());
}
}
...
@@ -44,7 +46,9 @@ public class StudioServiceImpl implements StudioService {
...
@@ -44,7 +46,9 @@ public class StudioServiceImpl implements StudioService {
@Override
@Override
public
IResult
executeDDL
(
StudioDDLDTO
studioDDLDTO
)
{
public
IResult
executeDDL
(
StudioDDLDTO
studioDDLDTO
)
{
JobConfig
config
=
studioDDLDTO
.
getJobConfig
();
JobConfig
config
=
studioDDLDTO
.
getJobConfig
();
config
.
setAddress
(
clusterService
.
buildEnvironmentAddress
(
config
.
isUseRemote
(),
studioDDLDTO
.
getClusterId
()));
if
(!
config
.
isUseSession
())
{
config
.
setAddress
(
clusterService
.
buildEnvironmentAddress
(
config
.
isUseRemote
(),
studioDDLDTO
.
getClusterId
()));
}
JobManager
jobManager
=
JobManager
.
build
(
config
);
JobManager
jobManager
=
JobManager
.
build
(
config
);
return
jobManager
.
executeDDL
(
studioDDLDTO
.
getStatement
());
return
jobManager
.
executeDDL
(
studioDDLDTO
.
getStatement
());
}
}
...
...
dlink-core/src/main/java/com/dlink/job/JobConfig.java
View file @
18f1c9be
...
@@ -2,6 +2,7 @@ package com.dlink.job;
...
@@ -2,6 +2,7 @@ package com.dlink.job;
import
com.dlink.executor.Executor
;
import
com.dlink.executor.Executor
;
import
com.dlink.executor.ExecutorSetting
;
import
com.dlink.executor.ExecutorSetting
;
import
com.dlink.session.SessionConfig
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -77,4 +78,12 @@ public class JobConfig {
...
@@ -77,4 +78,12 @@ public class JobConfig {
Integer
parallelism
,
String
savePointPath
){
Integer
parallelism
,
String
savePointPath
){
return
new
JobConfig
(
false
,
false
,
false
,
clusterId
,
taskId
,
jobName
,
useSqlFragment
,
checkpoint
,
parallelism
,
savePointPath
);
return
new
JobConfig
(
false
,
false
,
false
,
clusterId
,
taskId
,
jobName
,
useSqlFragment
,
checkpoint
,
parallelism
,
savePointPath
);
}
}
public
void
setSessionConfig
(
SessionConfig
sessionConfig
){
if
(
sessionConfig
!=
null
)
{
address
=
sessionConfig
.
getAddress
();
clusterId
=
sessionConfig
.
getClusterId
();
useRemote
=
sessionConfig
.
isUseRemote
();
}
}
}
}
dlink-core/src/main/java/com/dlink/job/JobManager.java
View file @
18f1c9be
...
@@ -72,6 +72,7 @@ public class JobManager extends RunTime {
...
@@ -72,6 +72,7 @@ public class JobManager extends RunTime {
}
}
private
Executor
createExecutor
()
{
private
Executor
createExecutor
()
{
initEnvironmentSetting
();
if
(
config
.
isUseRemote
())
{
if
(
config
.
isUseRemote
())
{
executor
=
Executor
.
buildRemoteExecutor
(
environmentSetting
,
config
.
getExecutorSetting
());
executor
=
Executor
.
buildRemoteExecutor
(
environmentSetting
,
config
.
getExecutorSetting
());
return
executor
;
return
executor
;
...
@@ -86,6 +87,8 @@ public class JobManager extends RunTime {
...
@@ -86,6 +87,8 @@ public class JobManager extends RunTime {
ExecutorEntity
executorEntity
=
SessionPool
.
get
(
config
.
getSession
());
ExecutorEntity
executorEntity
=
SessionPool
.
get
(
config
.
getSession
());
if
(
executorEntity
!=
null
)
{
if
(
executorEntity
!=
null
)
{
executor
=
executorEntity
.
getExecutor
();
executor
=
executorEntity
.
getExecutor
();
config
.
setSessionConfig
(
executorEntity
.
getSessionConfig
());
initEnvironmentSetting
();
}
else
{
}
else
{
createExecutor
();
createExecutor
();
SessionPool
.
push
(
new
ExecutorEntity
(
config
.
getSession
(),
executor
));
SessionPool
.
push
(
new
ExecutorEntity
(
config
.
getSession
(),
executor
));
...
@@ -96,11 +99,13 @@ public class JobManager extends RunTime {
...
@@ -96,11 +99,13 @@ public class JobManager extends RunTime {
return
executor
;
return
executor
;
}
}
private
void
initEnvironmentSetting
(){
environmentSetting
=
EnvironmentSetting
.
build
(
config
.
getAddress
());
}
@Override
@Override
public
boolean
init
()
{
public
boolean
init
()
{
handler
=
JobHandler
.
build
();
handler
=
JobHandler
.
build
();
String
address
=
config
.
getAddress
();
environmentSetting
=
EnvironmentSetting
.
build
(
address
);
createExecutorWithSession
();
createExecutorWithSession
();
return
false
;
return
false
;
}
}
...
...
dlink-web/src/components/Studio/StudioEvent/DDL.ts
View file @
18f1c9be
import
{
executeDDL
}
from
"@/pages/FlinkSqlStudio/service"
;
import
{
executeDDL
}
from
"@/pages/FlinkSqlStudio/service"
;
import
FlinkSQL
from
"./FlinkSQL"
;
import
FlinkSQL
from
"./FlinkSQL"
;
import
{
TaskType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
SessionType
,
TaskType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
Modal
}
from
"antd"
;
import
{
Modal
}
from
"antd"
;
import
{
getData
,
handleRemove
}
from
"@/components/Common/crud"
;
import
{
getData
,
handleRemove
}
from
"@/components/Common/crud"
;
export
function
showTables
(
task
:
TaskType
,
dispatch
:
any
)
{
export
function
changeSession
(
session
:
SessionType
,
dispatch
:
any
)
{
dispatch
&&
dispatch
({
type
:
"Studio/refreshCurrentSession"
,
payload
:
session
,
});
setTimeout
(
function
()
{
showTables
(
session
.
session
,
dispatch
);
},
200
);
}
export
function
quitSession
(
dispatch
:
any
)
{
dispatch
&&
dispatch
({
type
:
"Studio/quitCurrentSession"
,
});
}
export
function
showTables
(
session
:
string
,
dispatch
:
any
)
{
if
(
session
==
null
||
session
==
''
){
return
;
}
const
res
=
executeDDL
({
const
res
=
executeDDL
({
statement
:
FlinkSQL
.
SHOW_TABLES
,
statement
:
FlinkSQL
.
SHOW_TABLES
,
clusterId
:
task
.
clusterId
,
session
:
session
,
session
:
task
.
session
,
useSession
:
true
,
useSession
:
task
.
useSession
,
useResult
:
true
,
useResult
:
true
,
});
});
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
...
@@ -18,18 +36,15 @@ export function showTables(task: TaskType, dispatch: any) {
...
@@ -18,18 +36,15 @@ export function showTables(task: TaskType, dispatch: any) {
tableData
=
result
.
datas
.
rowData
;
tableData
=
result
.
datas
.
rowData
;
}
}
dispatch
&&
dispatch
({
dispatch
&&
dispatch
({
type
:
"Studio/refreshCurrentSession
Cluster
"
,
type
:
"Studio/refreshCurrentSession"
,
payload
:
{
payload
:
{
session
:
task
.
session
,
connectors
:
tableData
clusterId
:
task
.
clusterId
,
clusterName
:
task
.
clusterName
,
connectors
:
tableData
,
},
},
});
});
});
});
}
}
export
function
removeTable
(
tablename
:
string
,
task
:
TaskType
,
dispatch
:
any
)
{
export
function
removeTable
(
tablename
:
string
,
session
:
string
,
dispatch
:
any
)
{
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'确定删除表【'
+
tablename
+
'】吗?'
,
title
:
'确定删除表【'
+
tablename
+
'】吗?'
,
okText
:
'确认'
,
okText
:
'确认'
,
...
@@ -37,19 +52,18 @@ export function removeTable(tablename: string, task: TaskType, dispatch: any) {
...
@@ -37,19 +52,18 @@ export function removeTable(tablename: string, task: TaskType, dispatch: any) {
onOk
:
async
()
=>
{
onOk
:
async
()
=>
{
const
res
=
executeDDL
({
const
res
=
executeDDL
({
statement
:
"drop table "
+
tablename
,
statement
:
"drop table "
+
tablename
,
clusterId
:
task
.
clusterId
,
session
:
session
,
session
:
task
.
session
,
useSession
:
true
,
useSession
:
task
.
useSession
,
useResult
:
true
,
useResult
:
true
,
});
});
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
showTables
(
task
,
dispatch
);
showTables
(
session
,
dispatch
);
});
});
}
}
});
});
}
}
export
function
clearSession
(
session
:
string
,
task
:
TaskType
,
dispatch
:
any
)
{
export
function
clearSession
(
session
:
string
,
dispatch
:
any
)
{
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'确认清空会话【'
+
session
+
'】?'
,
title
:
'确认清空会话【'
+
session
+
'】?'
,
okText
:
'确认'
,
okText
:
'确认'
,
...
@@ -60,7 +74,7 @@ export function clearSession(session: string, task: TaskType, dispatch: any) {
...
@@ -60,7 +74,7 @@ export function clearSession(session: string, task: TaskType, dispatch: any) {
};
};
const
res
=
handleRemove
(
'/api/studio/clearSession'
,
[
para
]);
const
res
=
handleRemove
(
'/api/studio/clearSession'
,
[
para
]);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
showTables
(
task
,
dispatch
);
showTables
(
session
,
dispatch
);
});
});
}
}
});
});
...
...
dlink-web/src/components/Studio/StudioLeftTool/StudioConnector/components/SessionForm.tsx
View file @
18f1c9be
...
@@ -91,11 +91,10 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
...
@@ -91,11 +91,10 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
<
Item
<
Item
name=
"clusterId"
name=
"clusterId"
label=
"集群"
label=
"集群"
rules=
{
[{
required
:
true
,
message
:
'请输入别名!'
}]
}
>
>
<
Select
<
Select
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
placeholder=
"选择Flink集群"
placeholder=
"选择Flink集群"
defaultValue=
{
0
}
optionLabelProp=
"label"
optionLabelProp=
"label"
>
>
{
getClusterOptions
()
}
{
getClusterOptions
()
}
...
...
dlink-web/src/components/Studio/StudioLeftTool/StudioConnector/index.tsx
View file @
18f1c9be
import
{
message
,
Input
,
Button
,
Space
,
Table
,
Dropdown
,
Menu
,
Empty
,
Divider
,
import
{
message
,
Input
,
Button
,
Space
,
Table
,
Dropdown
,
Menu
,
Empty
,
Divider
,
Tooltip
,
Breadcrumb
}
from
"antd"
;
Tooltip
}
from
"antd"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
styles
from
"./index.less"
;
import
styles
from
"./index.less"
;
import
{
SearchOutlined
,
DownOutlined
,
DeleteOutlined
,
CommentOutlined
,
Message
Outlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
SearchOutlined
,
DownOutlined
,
DeleteOutlined
,
CommentOutlined
,
Poweroff
Outlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
React
from
"react"
;
import
React
from
"react"
;
import
{
removeTable
,
showTables
,
clear
Session
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
removeTable
,
showTables
,
clearSession
,
changeSession
,
quit
Session
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
import
{
ModalForm
,
ModalForm
,
}
from
'@ant-design/pro-form'
;
}
from
'@ant-design/pro-form'
;
import
ProDescriptions
from
'@ant-design/pro-descriptions'
;
import
ProDescriptions
from
'@ant-design/pro-descriptions'
;
import
ProTable
from
'@ant-design/pro-table'
;
import
{
getData
,
handleAddOrUpdate
}
from
"@/components/Common/crud"
;
import
{
getData
,
handleAddOrUpdate
}
from
"@/components/Common/crud"
;
import
SessionForm
from
"@/components/Studio/StudioLeftTool/StudioConnector/components/SessionForm"
;
import
SessionForm
from
"@/components/Studio/StudioLeftTool/StudioConnector/components/SessionForm"
;
const
StudioConnector
=
(
props
:
any
)
=>
{
const
StudioConnector
=
(
props
:
any
)
=>
{
const
{
current
,
dispatch
,
currentSession
Cluster
}
=
props
;
const
{
current
,
dispatch
,
currentSession
}
=
props
;
const
[
tableData
,
setTableData
]
=
useState
<
[]
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
[]
>
([]);
const
[
loadings
,
setLoadings
]
=
useState
<
boolean
[]
>
([]);
const
[
loadings
,
setLoadings
]
=
useState
<
boolean
[]
>
([]);
const
[
searchText
,
setSearchText
]
=
useState
<
string
>
(
''
);
const
[
searchText
,
setSearchText
]
=
useState
<
string
>
(
''
);
...
@@ -112,7 +111,7 @@ const StudioConnector = (props:any) => {
...
@@ -112,7 +111,7 @@ const StudioConnector = (props:any) => {
const
keyEvent
=
(
key
,
item
)
=>
{
const
keyEvent
=
(
key
,
item
)
=>
{
if
(
key
==
'delete'
){
if
(
key
==
'delete'
){
removeTable
(
item
.
tablename
,
current
.
task
,
dispatch
);
removeTable
(
item
.
tablename
,
current
Session
.
session
,
dispatch
);
}
else
{
}
else
{
message
.
warn
(
"敬请期待"
);
message
.
warn
(
"敬请期待"
);
}
}
...
@@ -122,14 +121,16 @@ const StudioConnector = (props:any) => {
...
@@ -122,14 +121,16 @@ const StudioConnector = (props:any) => {
if
(
key
==
'delete'
){
if
(
key
==
'delete'
){
clearSession
(
item
.
session
,
current
.
task
,
dispatch
);
clearSession
(
item
.
session
,
current
.
task
,
dispatch
);
}
else
if
(
key
==
'connect'
){
}
else
if
(
key
==
'connect'
){
changeSession
(
item
,
dispatch
);
message
.
success
(
'连接共享会话【'
+
item
.
session
+
'】成功!'
);
setModalVisit
(
false
);
}
else
{
}
else
{
message
.
warn
(
"敬请期待"
);
message
.
warn
(
"敬请期待"
);
}
}
};
};
const
getTables
=
()
=>
{
const
getTables
=
()
=>
{
showTables
(
current
.
task
,
dispatch
);
showTables
(
current
Session
.
session
,
dispatch
);
};
};
const
onClearSession
=
()
=>
{
const
onClearSession
=
()
=>
{
...
@@ -189,14 +190,6 @@ const StudioConnector = (props:any) => {
...
@@ -189,14 +190,6 @@ const StudioConnector = (props:any) => {
render
:
function
(
text
,
record
,
index
)
{
render
:
function
(
text
,
record
,
index
)
{
return
record
.
sessionConfig
.
clusterName
;
return
record
.
sessionConfig
.
clusterName
;
}
}
},{
title
:
"JobManager地址"
,
key
:
"address"
,
sorter
:
true
,
...
getColumnSearchProps
(
"address"
),
render
:
function
(
text
,
record
,
index
)
{
return
record
.
sessionConfig
.
address
;
}
},{
},{
title
:
"创建人"
,
title
:
"创建人"
,
dataIndex
:
"createUser"
,
dataIndex
:
"createUser"
,
...
@@ -215,7 +208,7 @@ const StudioConnector = (props:any) => {
...
@@ -215,7 +208,7 @@ const StudioConnector = (props:any) => {
render
:
(
_
,
record
)
=>
[
render
:
(
_
,
record
)
=>
[
<
a
<
a
onClick=
{
()
=>
{
onClick=
{
()
=>
{
message
.
warn
(
'敬请期待'
);
keySessionsEvent
(
'connect'
,
record
);
}
}
}
}
>
>
连接
连接
...
@@ -244,6 +237,11 @@ const StudioConnector = (props:any) => {
...
@@ -244,6 +237,11 @@ const StudioConnector = (props:any) => {
});
});
};
};
const
quitSessions
=
()
=>
{
quitSession
(
dispatch
);
message
.
success
(
'退出共享会话成功!'
);
};
return
(
return
(
<>
<>
<
div
style=
{
{
float
:
"right"
}
}
>
<
div
style=
{
{
float
:
"right"
}
}
>
...
@@ -254,6 +252,13 @@ const StudioConnector = (props:any) => {
...
@@ -254,6 +252,13 @@ const StudioConnector = (props:any) => {
onClick=
{
showSessions
}
onClick=
{
showSessions
}
/>
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
title=
"退出会话"
>
<
Button
type=
"text"
icon=
{
<
PoweroffOutlined
/>
}
onClick=
{
quitSessions
}
/>
</
Tooltip
>
<
Tooltip
title=
"新建会话"
>
<
Tooltip
title=
"新建会话"
>
<
Button
<
Button
type=
"text"
type=
"text"
...
@@ -268,7 +273,7 @@ const StudioConnector = (props:any) => {
...
@@ -268,7 +273,7 @@ const StudioConnector = (props:any) => {
onClick=
{
getTables
}
onClick=
{
getTables
}
/>
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
title=
"
清空连接器
"
>
<
Tooltip
title=
"
注销会话
"
>
<
Button
<
Button
type=
"text"
type=
"text"
icon=
{
<
DeleteOutlined
/>
}
icon=
{
<
DeleteOutlined
/>
}
...
@@ -276,12 +281,7 @@ const StudioConnector = (props:any) => {
...
@@ -276,12 +281,7 @@ const StudioConnector = (props:any) => {
/>
/>
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
<
Breadcrumb
className=
{
styles
[
"session-path"
]
}
>
{
currentSession
.
connectors
&&
currentSession
.
connectors
.
length
>
0
?(<
Table
dataSource=
{
currentSession
.
connectors
}
columns=
{
getColumns
()
}
size=
"small"
/>):(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
<
MessageOutlined
/>
<
Divider
type=
"vertical"
/>
<
Breadcrumb
.
Item
>
{
currentSessionCluster
.
session
}
</
Breadcrumb
.
Item
>
</
Breadcrumb
>
{
currentSessionCluster
.
connectors
&&
currentSessionCluster
.
connectors
.
length
>
0
?(<
Table
dataSource=
{
currentSessionCluster
.
connectors
}
columns=
{
getColumns
()
}
size=
"small"
/>):(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
<
ModalForm
<
ModalForm
// title="新建表单"
// title="新建表单"
visible=
{
modalVisit
}
visible=
{
modalVisit
}
...
@@ -323,7 +323,11 @@ const StudioConnector = (props:any) => {
...
@@ -323,7 +323,11 @@ const StudioConnector = (props:any) => {
handleCreateSessionModalVisible
(
false
);
handleCreateSessionModalVisible
(
false
);
}
}
}
}
updateModalVisible=
{
createSessionModalVisible
}
updateModalVisible=
{
createSessionModalVisible
}
values=
{
{}
}
values=
{
{
session
:
''
,
type
:
'PUBLIC'
,
useRemote
:
false
,
}
}
/>
/>
</>
</>
);
);
...
@@ -331,5 +335,5 @@ const StudioConnector = (props:any) => {
...
@@ -331,5 +335,5 @@ const StudioConnector = (props:any) => {
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
current
:
Studio
.
current
,
current
:
Studio
.
current
,
currentSession
Cluster
:
Studio
.
currentSessionCluster
,
currentSession
:
Studio
.
currentSession
,
}))(
StudioConnector
);
}))(
StudioConnector
);
dlink-web/src/components/Studio/StudioMenu/index.tsx
View file @
18f1c9be
...
@@ -2,7 +2,7 @@ import styles from "./index.less";
...
@@ -2,7 +2,7 @@ import styles from "./index.less";
import
{
Menu
,
Dropdown
,
Tooltip
,
Row
,
Col
,
Popconfirm
,
notification
,
Modal
,
message
}
from
"antd"
;
import
{
Menu
,
Dropdown
,
Tooltip
,
Row
,
Col
,
Popconfirm
,
notification
,
Modal
,
message
}
from
"antd"
;
import
{
PauseCircleTwoTone
,
CopyTwoTone
,
DeleteTwoTone
,
PlayCircleTwoTone
,
DiffTwoTone
,
import
{
PauseCircleTwoTone
,
CopyTwoTone
,
DeleteTwoTone
,
PlayCircleTwoTone
,
DiffTwoTone
,
FileAddTwoTone
,
FolderOpenTwoTone
,
SafetyCertificateTwoTone
,
SaveTwoTone
,
FlagTwoTone
,
FileAddTwoTone
,
FolderOpenTwoTone
,
SafetyCertificateTwoTone
,
SaveTwoTone
,
FlagTwoTone
,
EnvironmentOutlined
,
SmileOutlined
,
RocketTwoTone
,
QuestionCircleTwoTone
}
from
"@ant-design/icons"
;
EnvironmentOutlined
,
SmileOutlined
,
RocketTwoTone
,
QuestionCircleTwoTone
,
MessageOutlined
}
from
"@ant-design/icons"
;
import
Space
from
"antd/es/space"
;
import
Space
from
"antd/es/space"
;
import
Divider
from
"antd/es/divider"
;
import
Divider
from
"antd/es/divider"
;
import
Button
from
"antd/es/button/button"
;
import
Button
from
"antd/es/button/button"
;
...
@@ -23,7 +23,7 @@ const menu = (
...
@@ -23,7 +23,7 @@ const menu = (
const
StudioMenu
=
(
props
:
any
)
=>
{
const
StudioMenu
=
(
props
:
any
)
=>
{
const
{
tabs
,
current
,
currentPath
,
form
,
refs
,
dispatch
}
=
props
;
const
{
tabs
,
current
,
currentPath
,
form
,
refs
,
dispatch
,
currentSession
}
=
props
;
const
execute
=
()
=>
{
const
execute
=
()
=>
{
let
selectsql
=
null
;
let
selectsql
=
null
;
...
@@ -34,10 +34,10 @@ const StudioMenu = (props: any) => {
...
@@ -34,10 +34,10 @@ const StudioMenu = (props: any) => {
if
(
selectsql
==
null
||
selectsql
==
''
){
if
(
selectsql
==
null
||
selectsql
==
''
){
selectsql
=
current
.
value
;
selectsql
=
current
.
value
;
}
}
let
useSession
=
current
.
task
.
useS
ession
;
let
useSession
=
!!
currentSession
.
s
ession
;
let
param
=
{
let
param
=
{
useSession
:
useSession
,
useSession
:
useSession
,
session
:
current
.
task
.
session
,
session
:
current
Session
.
session
,
useRemote
:
current
.
task
.
useRemote
,
useRemote
:
current
.
task
.
useRemote
,
clusterId
:
current
.
task
.
clusterId
,
clusterId
:
current
.
task
.
clusterId
,
useResult
:
current
.
task
.
useResult
,
useResult
:
current
.
task
.
useResult
,
...
@@ -85,7 +85,7 @@ const StudioMenu = (props: any) => {
...
@@ -85,7 +85,7 @@ const StudioMenu = (props: any) => {
type
:
"Studio/saveTabs"
,
type
:
"Studio/saveTabs"
,
payload
:
newTabs
,
payload
:
newTabs
,
});
});
useSession
&&
showTables
(
current
.
task
,
dispatch
);
useSession
&&
showTables
(
current
Session
.
session
,
dispatch
);
})
})
};
};
...
@@ -203,6 +203,14 @@ const StudioMenu = (props: any) => {
...
@@ -203,6 +203,14 @@ const StudioMenu = (props: any) => {
<
EnvironmentOutlined
/>
<
EnvironmentOutlined
/>
<
Divider
type=
"vertical"
/>
<
Divider
type=
"vertical"
/>
{
getPathItem
(
currentPath
)
}
{
getPathItem
(
currentPath
)
}
{
currentSession
.
session
&&
(<>
<
Divider
type=
"vertical"
/>
<
MessageOutlined
/>
<
Divider
type=
"vertical"
/>
<
Breadcrumb
.
Item
>
{
currentSession
.
session
}
</
Breadcrumb
.
Item
>
</>)
}
</
Breadcrumb
>
</
Breadcrumb
>
</
Col
>
</
Col
>
<
Col
span=
{
8
}
offset=
{
8
}
>
<
Col
span=
{
8
}
offset=
{
8
}
>
...
@@ -293,5 +301,5 @@ export default connect(({Studio}: { Studio: StateType }) => ({
...
@@ -293,5 +301,5 @@ export default connect(({Studio}: { Studio: StateType }) => ({
currentPath
:
Studio
.
currentPath
,
currentPath
:
Studio
.
currentPath
,
tabs
:
Studio
.
tabs
,
tabs
:
Studio
.
tabs
,
refs
:
Studio
.
refs
,
refs
:
Studio
.
refs
,
// monaco: Studio.monaco
,
currentSession
:
Studio
.
currentSession
,
}))(
StudioMenu
);
}))(
StudioMenu
);
dlink-web/src/components/Studio/StudioRightTool/StudioConfig/index.tsx
View file @
18f1c9be
...
@@ -10,20 +10,10 @@ const { Option } = Select;
...
@@ -10,20 +10,10 @@ const { Option } = Select;
const
StudioConfig
=
(
props
:
any
)
=>
{
const
StudioConfig
=
(
props
:
any
)
=>
{
const
{
current
,
form
,
dispatch
,
tabs
,
session
}
=
props
;
const
{
current
,
form
,
dispatch
,
tabs
,
currentSession
}
=
props
;
const
[
newSesstion
,
setNewSesstion
]
=
useState
<
string
>
(
''
);
form
.
setFieldsValue
(
current
.
task
);
form
.
setFieldsValue
(
current
.
task
);
const
addSession
=
()
=>
{
if
(
newSesstion
!=
''
)
{
dispatch
&&
dispatch
({
type
:
"Studio/saveSession"
,
payload
:
newSesstion
,
});
setNewSesstion
(
''
);
}
};
const
onValuesChange
=
(
change
:
any
,
all
:
any
)
=>
{
const
onValuesChange
=
(
change
:
any
,
all
:
any
)
=>
{
let
newTabs
=
tabs
;
let
newTabs
=
tabs
;
...
@@ -42,9 +32,6 @@ const StudioConfig = (props: any) => {
...
@@ -42,9 +32,6 @@ const StudioConfig = (props: any) => {
});
});
};
};
const
onChangeClusterSession
=
()
=>
{
showTables
(
current
.
task
,
dispatch
);
};
return
(
return
(
<>
<>
<
Row
>
<
Row
>
...
@@ -65,51 +52,6 @@ const StudioConfig = (props: any) => {
...
@@ -65,51 +52,6 @@ const StudioConfig = (props: any) => {
className=
{
styles
.
form_setting
}
className=
{
styles
.
form_setting
}
onValuesChange=
{
onValuesChange
}
onValuesChange=
{
onValuesChange
}
>
>
<
Row
>
<
Col
span=
{
10
}
>
<
Form
.
Item
label=
"共享会话"
className=
{
styles
.
form_item
}
name=
"useSession"
valuePropName=
"checked"
tooltip=
{
{
title
:
'开启共享会话,将进行 Flink Catalog 的共享'
,
icon
:
<
InfoCircleOutlined
/>
}
}
>
<
Switch
checkedChildren=
"启用"
unCheckedChildren=
"禁用"
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
14
}
>
<
Form
.
Item
label=
"会话 Key"
tooltip=
"设置共享会话的 Key"
name=
"session"
className=
{
styles
.
form_item
}
>
<
Select
placeholder=
"选择会话"
allowClear
onChange=
{
onChangeClusterSession
}
dropdownRender=
{
menu
=>
(
<
div
>
{
menu
}
<
Divider
style=
{
{
margin
:
'4px 0'
}
}
/>
<
div
style=
{
{
display
:
'flex'
,
flexWrap
:
'nowrap'
,
padding
:
8
}
}
>
<
Input
style=
{
{
flex
:
'auto'
}
}
value=
{
newSesstion
}
onChange=
{
(
e
)
=>
{
setNewSesstion
(
e
.
target
.
value
);
}
}
/>
<
a
style=
{
{
flex
:
'none'
,
padding
:
'8px'
,
display
:
'block'
,
cursor
:
'pointer'
}
}
onClick=
{
addSession
}
>
<
PlusOutlined
/>
</
a
>
</
div
>
</
div
>
)
}
>
{
session
.
map
(
item
=>
(
<
Option
key=
{
item
}
>
{
item
}
</
Option
>
))
}
</
Select
>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
>
<
Row
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
<
Form
.
Item
...
@@ -144,6 +86,6 @@ const StudioConfig = (props: any) => {
...
@@ -144,6 +86,6 @@ const StudioConfig = (props: any) => {
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
cluster
:
Studio
.
cluster
,
cluster
:
Studio
.
cluster
,
current
:
Studio
.
current
,
current
:
Studio
.
current
,
currentSession
:
Studio
.
currentSession
,
tabs
:
Studio
.
tabs
,
tabs
:
Studio
.
tabs
,
session
:
Studio
.
session
,
}))(
StudioConfig
);
}))(
StudioConfig
);
dlink-web/src/components/Studio/StudioRightTool/StudioSetting/index.tsx
View file @
18f1c9be
...
@@ -10,7 +10,7 @@ const { Option } = Select;
...
@@ -10,7 +10,7 @@ const { Option } = Select;
const
StudioSetting
=
(
props
:
any
)
=>
{
const
StudioSetting
=
(
props
:
any
)
=>
{
const
{
cluster
,
current
,
form
,
dispatch
,
tabs
}
=
props
;
const
{
cluster
,
current
,
form
,
dispatch
,
tabs
,
currentSession
}
=
props
;
const
getClusterOptions
=
()
=>
{
const
getClusterOptions
=
()
=>
{
let
itemList
=
[(<
Option
value=
{
0
}
label=
{
(<><
Tag
color=
"default"
>
Local
</
Tag
>
本地环境
</>)
}
>
let
itemList
=
[(<
Option
value=
{
0
}
label=
{
(<><
Tag
color=
"default"
>
Local
</
Tag
>
本地环境
</>)
}
>
...
@@ -46,7 +46,7 @@ const StudioSetting = (props: any) => {
...
@@ -46,7 +46,7 @@ const StudioSetting = (props: any) => {
};
};
const
onChangeClusterSession
=
()
=>
{
const
onChangeClusterSession
=
()
=>
{
showTables
(
current
.
task
,
dispatch
);
showTables
(
current
Session
.
session
,
dispatch
);
};
};
return
(
return
(
<>
<>
...
@@ -133,4 +133,5 @@ export default connect(({Studio}: { Studio: StateType }) => ({
...
@@ -133,4 +133,5 @@ export default connect(({Studio}: { Studio: StateType }) => ({
current
:
Studio
.
current
,
current
:
Studio
.
current
,
tabs
:
Studio
.
tabs
,
tabs
:
Studio
.
tabs
,
session
:
Studio
.
session
,
session
:
Studio
.
session
,
currentSession
:
Studio
.
currentSession
,
}))(
StudioSetting
);
}))(
StudioSetting
);
dlink-web/src/pages/FlinkSqlStudio/model.ts
View file @
18f1c9be
...
@@ -72,6 +72,7 @@ export type RightClickMenu = {
...
@@ -72,6 +72,7 @@ export type RightClickMenu = {
export
type
ConnectorType
=
{
export
type
ConnectorType
=
{
tablename
:
string
;
tablename
:
string
;
}
}
export
type
SessionType
=
{
export
type
SessionType
=
{
session
?:
string
;
session
?:
string
;
type
?:
string
;
type
?:
string
;
...
@@ -85,7 +86,7 @@ export type SessionType = {
...
@@ -85,7 +86,7 @@ export type SessionType = {
}
}
export
type
StateType
=
{
export
type
StateType
=
{
cluster
?:
ClusterType
[];
cluster
?:
ClusterType
[];
currentSession
Cluster
?:
SessionType
;
currentSession
?:
SessionType
;
current
?:
TabsItemType
;
current
?:
TabsItemType
;
sql
?:
string
;
sql
?:
string
;
monaco
?:
any
;
monaco
?:
any
;
...
@@ -114,7 +115,8 @@ export type ModelType = {
...
@@ -114,7 +115,8 @@ export type ModelType = {
saveTaskData
:
Reducer
<
StateType
>
;
saveTaskData
:
Reducer
<
StateType
>
;
saveSession
:
Reducer
<
StateType
>
;
saveSession
:
Reducer
<
StateType
>
;
showRightClickMenu
:
Reducer
<
StateType
>
;
showRightClickMenu
:
Reducer
<
StateType
>
;
refreshCurrentSessionCluster
:
Reducer
<
StateType
>
;
refreshCurrentSession
:
Reducer
<
StateType
>
;
quitCurrentSession
:
Reducer
<
StateType
>
;
saveResult
:
Reducer
<
StateType
>
;
saveResult
:
Reducer
<
StateType
>
;
saveCluster
:
Reducer
<
StateType
>
;
saveCluster
:
Reducer
<
StateType
>
;
};
};
...
@@ -124,7 +126,7 @@ const Model: ModelType = {
...
@@ -124,7 +126,7 @@ const Model: ModelType = {
namespace
:
'Studio'
,
namespace
:
'Studio'
,
state
:
{
state
:
{
cluster
:
[],
cluster
:
[],
currentSession
Cluster
:
{
currentSession
:
{
connectors
:
[],
connectors
:
[],
},
},
current
:
{
current
:
{
...
@@ -336,12 +338,21 @@ const Model: ModelType = {
...
@@ -336,12 +338,21 @@ const Model: ModelType = {
rightClickMenu
:
payload
,
rightClickMenu
:
payload
,
};
};
},
},
refreshCurrentSession
Cluster
(
state
,
{
payload
})
{
refreshCurrentSession
(
state
,
{
payload
})
{
return
{
return
{
...
state
,
...
state
,
currentSessionCluster
:
{
currentSession
:
{
...
state
?.
currentSession
,
...
payload
...
payload
}
};
},
},
quitCurrentSession
(
state
)
{
return
{
...
state
,
currentSession
:
{
connectors
:
[],
}
};
};
},
},
saveResult
(
state
,
{
payload
})
{
saveResult
(
state
,
{
payload
})
{
...
...
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