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
4b6db6d8
Commit
4b6db6d8
authored
Jul 07, 2021
by
godkaikai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会话创建
parent
a5426c4e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
154 additions
and
76 deletions
+154
-76
ClusterController.java
...src/main/java/com/dlink/controller/ClusterController.java
+3
-3
ClusterService.java
...admin/src/main/java/com/dlink/service/ClusterService.java
+4
-0
ClusterServiceImpl.java
.../main/java/com/dlink/service/impl/ClusterServiceImpl.java
+18
-8
StudioServiceImpl.java
...c/main/java/com/dlink/service/impl/StudioServiceImpl.java
+14
-16
pom.xml
dlink-core/pom.xml
+3
-3
dlink.sql
dlink-doc/sql/dlink.sql
+1
-0
crud.ts
dlink-web/src/components/Common/crud.ts
+9
-1
SessionForm.tsx
...StudioLeftTool/StudioConnector/components/SessionForm.tsx
+50
-22
data.d.ts
...omponents/Studio/StudioLeftTool/StudioConnector/data.d.ts
+5
-5
index.tsx
...omponents/Studio/StudioLeftTool/StudioConnector/index.tsx
+34
-3
model.ts
dlink-web/src/pages/FlinkSqlStudio/model.ts
+13
-15
No files found.
dlink-admin/src/main/java/com/dlink/controller/ClusterController.java
View file @
4b6db6d8
...
@@ -80,10 +80,10 @@ public class ClusterController {
...
@@ -80,10 +80,10 @@ public class ClusterController {
}
}
/**
/**
* 获取
指定ID的信息
* 获取
可用的集群列表
*/
*/
@
Pos
tMapping
(
"/listEnabledAll"
)
@
Ge
tMapping
(
"/listEnabledAll"
)
public
Result
listEnabledAll
()
throws
Exception
{
public
Result
listEnabledAll
()
{
List
<
Cluster
>
clusters
=
clusterService
.
listEnabledAll
();
List
<
Cluster
>
clusters
=
clusterService
.
listEnabledAll
();
return
Result
.
succeed
(
clusters
,
"获取成功"
);
return
Result
.
succeed
(
clusters
,
"获取成功"
);
}
}
...
...
dlink-admin/src/main/java/com/dlink/service/ClusterService.java
View file @
4b6db6d8
...
@@ -19,5 +19,9 @@ public interface ClusterService extends ISuperService<Cluster> {
...
@@ -19,5 +19,9 @@ public interface ClusterService extends ISuperService<Cluster> {
String
buildEnvironmentAddress
(
boolean
useRemote
,
Integer
id
);
String
buildEnvironmentAddress
(
boolean
useRemote
,
Integer
id
);
String
buildRemoteEnvironmentAddress
(
Integer
id
);
String
buildLocalEnvironmentAddress
();
List
<
Cluster
>
listEnabledAll
();
List
<
Cluster
>
listEnabledAll
();
}
}
dlink-admin/src/main/java/com/dlink/service/impl/ClusterServiceImpl.java
View file @
4b6db6d8
...
@@ -44,16 +44,26 @@ public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster>
...
@@ -44,16 +44,26 @@ public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster>
@Override
@Override
public
String
buildEnvironmentAddress
(
boolean
useRemote
,
Integer
id
)
{
public
String
buildEnvironmentAddress
(
boolean
useRemote
,
Integer
id
)
{
if
(
useRemote
)
{
if
(
useRemote
)
{
return
getJobManagerAddress
(
getById
(
id
)
);
return
buildRemoteEnvironmentAddress
(
id
);
}
else
{
}
else
{
try
{
return
buildLocalEnvironmentAddress
();
InetAddress
inetAddress
=
InetAddress
.
getLocalHost
();
}
if
(
inetAddress
!=
null
)
{
}
return
inetAddress
.
getHostAddress
()+
NetConstant
.
COLON
+
FlinkConstant
.
PORT
;
}
@Override
}
catch
(
UnknownHostException
e
)
{
public
String
buildRemoteEnvironmentAddress
(
Integer
id
)
{
e
.
printStackTrace
();
return
getJobManagerAddress
(
getById
(
id
));
}
@Override
public
String
buildLocalEnvironmentAddress
()
{
try
{
InetAddress
inetAddress
=
InetAddress
.
getLocalHost
();
if
(
inetAddress
!=
null
)
{
return
inetAddress
.
getHostAddress
()+
NetConstant
.
COLON
+
FlinkConstant
.
PORT
;
}
}
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
}
}
return
FlinkConstant
.
LOCAL_HOST
;
return
FlinkConstant
.
LOCAL_HOST
;
}
}
...
...
dlink-admin/src/main/java/com/dlink/service/impl/StudioServiceImpl.java
View file @
4b6db6d8
package
com
.
dlink
.
service
.
impl
;
package
com
.
dlink
.
service
.
impl
;
import
com.dlink.assertion.Assert
;
import
com.dlink.cluster.FlinkCluster
;
import
com.dlink.constant.FlinkConstant
;
import
com.dlink.dto.SessionDTO
;
import
com.dlink.dto.SessionDTO
;
import
com.dlink.dto.StudioDDLDTO
;
import
com.dlink.dto.StudioDDLDTO
;
import
com.dlink.dto.StudioExecuteDTO
;
import
com.dlink.dto.StudioExecuteDTO
;
import
com.dlink.exception.BusException
;
import
com.dlink.exception.JobException
;
import
com.dlink.executor.Executor
;
import
com.dlink.executor.ExecutorSetting
;
import
com.dlink.explainer.ca.CABuilder
;
import
com.dlink.explainer.ca.CABuilder
;
import
com.dlink.explainer.ca.TableCANode
;
import
com.dlink.explainer.ca.TableCANode
;
import
com.dlink.job.JobConfig
;
import
com.dlink.job.JobConfig
;
...
@@ -17,7 +10,6 @@ import com.dlink.job.JobManager;
...
@@ -17,7 +10,6 @@ import com.dlink.job.JobManager;
import
com.dlink.job.JobResult
;
import
com.dlink.job.JobResult
;
import
com.dlink.model.Cluster
;
import
com.dlink.model.Cluster
;
import
com.dlink.result.IResult
;
import
com.dlink.result.IResult
;
import
com.dlink.result.RunResult
;
import
com.dlink.result.SelectResult
;
import
com.dlink.result.SelectResult
;
import
com.dlink.service.ClusterService
;
import
com.dlink.service.ClusterService
;
import
com.dlink.service.StudioService
;
import
com.dlink.service.StudioService
;
...
@@ -27,8 +19,6 @@ import com.dlink.session.SessionPool;
...
@@ -27,8 +19,6 @@ import com.dlink.session.SessionPool;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -66,12 +56,20 @@ public class StudioServiceImpl implements StudioService {
...
@@ -66,12 +56,20 @@ public class StudioServiceImpl implements StudioService {
@Override
@Override
public
boolean
createSession
(
SessionDTO
sessionDTO
,
String
createUser
)
{
public
boolean
createSession
(
SessionDTO
sessionDTO
,
String
createUser
)
{
Cluster
cluster
=
clusterService
.
getById
(
sessionDTO
.
getClusterId
());
if
(
sessionDTO
.
isUseRemote
())
{
SessionConfig
sessionConfig
=
SessionConfig
.
build
(
Cluster
cluster
=
clusterService
.
getById
(
sessionDTO
.
getClusterId
());
sessionDTO
.
getType
(),
sessionDTO
.
isUseRemote
(),
SessionConfig
sessionConfig
=
SessionConfig
.
build
(
cluster
.
getId
(),
cluster
.
getAlias
(),
sessionDTO
.
getType
(),
true
,
clusterService
.
buildEnvironmentAddress
(
sessionDTO
.
isUseRemote
(),
sessionDTO
.
getClusterId
()));
cluster
.
getId
(),
cluster
.
getAlias
(),
return
JobManager
.
createSession
(
sessionDTO
.
getSession
(),
sessionConfig
,
createUser
);
clusterService
.
buildEnvironmentAddress
(
true
,
sessionDTO
.
getClusterId
()));
return
JobManager
.
createSession
(
sessionDTO
.
getSession
(),
sessionConfig
,
createUser
);
}
else
{
SessionConfig
sessionConfig
=
SessionConfig
.
build
(
sessionDTO
.
getType
(),
false
,
null
,
null
,
clusterService
.
buildEnvironmentAddress
(
false
,
null
));
return
JobManager
.
createSession
(
sessionDTO
.
getSession
(),
sessionConfig
,
createUser
);
}
}
}
@Override
@Override
...
...
dlink-core/pom.xml
View file @
4b6db6d8
...
@@ -37,17 +37,17 @@
...
@@ -37,17 +37,17 @@
<dependency>
<dependency>
<groupId>
com.dlink
</groupId>
<groupId>
com.dlink
</groupId>
<artifactId>
dlink-client-1.12
</artifactId>
<artifactId>
dlink-client-1.12
</artifactId>
<
!--<scope>provided</scope>--
>
<
scope>
provided
</scope
>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.dlink
</groupId>
<groupId>
com.dlink
</groupId>
<artifactId>
dlink-connector-jdbc
</artifactId>
<artifactId>
dlink-connector-jdbc
</artifactId>
<
!--<scope>provided</scope>--
>
<
scope>
provided
</scope
>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.dlink
</groupId>
<groupId>
com.dlink
</groupId>
<artifactId>
dlink-function
</artifactId>
<artifactId>
dlink-function
</artifactId>
<
!--<scope>provided</scope>--
>
<
scope>
provided
</scope
>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
dlink-doc/sql/dlink.sql
View file @
4b6db6d8
...
@@ -315,6 +315,7 @@ CREATE TABLE `dlink_history` (
...
@@ -315,6 +315,7 @@ CREATE TABLE `dlink_history` (
`job_name`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'作业名'
,
`job_name`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'作业名'
,
`job_manager_address`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'JM地址'
,
`job_manager_address`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'JM地址'
,
`status`
int
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'状态'
,
`status`
int
(
1
)
NOT
NULL
DEFAULT
0
COMMENT
'状态'
,
`type`
varchar
(
50
)
NULL
DEFAULT
NULL
COMMENT
'类型'
,
`statement`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
COMMENT
'语句集'
,
`statement`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
COMMENT
'语句集'
,
`error`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
COMMENT
'异常信息'
,
`error`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
COMMENT
'异常信息'
,
`result`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
COMMENT
'结果集'
,
`result`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
COMMENT
'结果集'
,
...
...
dlink-web/src/components/Common/crud.ts
View file @
4b6db6d8
import
request
from
"umi-request"
;
import
request
from
"umi-request"
;
import
{
TableListParams
}
from
"@/components/Common/data"
;
import
{
TableListParams
}
from
"@/components/Common/data"
;
import
{
message
,
Modal
}
from
"antd"
;
import
{
message
,
Modal
}
from
"antd"
;
import
{
submitTask
}
from
"@/pages/Dlink/Task/service"
;
export
async
function
queryData
(
url
:
string
,
params
?:
TableListParams
)
{
export
async
function
queryData
(
url
:
string
,
params
?:
TableListParams
)
{
return
request
(
url
,
{
return
request
(
url
,
{
...
@@ -12,6 +11,15 @@ export async function queryData(url:string,params?: TableListParams) {
...
@@ -12,6 +11,15 @@ export async function queryData(url:string,params?: TableListParams) {
});
});
}
}
export
async
function
getData
(
url
:
string
,
params
?:
any
)
{
return
request
(
url
,
{
method
:
'GET'
,
params
:
{
...
params
,
},
});
}
export
async
function
removeData
(
url
:
string
,
params
:
any
[])
{
export
async
function
removeData
(
url
:
string
,
params
:
any
[])
{
return
request
(
url
,
{
return
request
(
url
,
{
method
:
'DELETE'
,
method
:
'DELETE'
,
...
...
dlink-web/src/components/Studio/StudioLeftTool/StudioConnector/components/SessionForm.tsx
View file @
4b6db6d8
import
React
,
{
use
Effect
,
use
State
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
Form
,
Button
,
Input
,
Modal
}
from
'antd'
;
import
{
Form
,
Button
,
Input
,
Modal
,
Select
,
Switch
}
from
'antd'
;
import
type
{
SessionItem
}
from
'../data.d'
;
import
{
SessionItem
}
from
'../data.d'
;
import
{
connect
}
from
"umi"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
export
type
UpdateFormProps
=
{
export
type
UpdateFormProps
=
{
onCancel
:
(
flag
?:
boolean
,
formVals
?:
Partial
<
SessionItem
>
)
=>
void
;
onCancel
:
(
flag
?:
boolean
,
formVals
?:
Partial
<
SessionItem
>
)
=>
void
;
onSubmit
:
(
values
:
Partial
<
SessionItem
>
)
=>
void
;
onSubmit
:
(
values
:
Partial
<
SessionItem
>
)
=>
void
;
updateModalVisible
:
boolean
;
updateModalVisible
:
boolean
;
isCreate
:
boolean
;
values
:
Partial
<
SessionItem
>
;
values
:
Partial
<
SessionItem
>
;
};
};
const
FormItem
=
Form
.
Item
;
const
{
Item
}
=
Form
;
const
{
Option
}
=
Select
;
const
formLayout
=
{
const
formLayout
=
{
labelCol
:
{
span
:
7
},
labelCol
:
{
span
:
7
},
...
@@ -21,9 +23,11 @@ const formLayout = {
...
@@ -21,9 +23,11 @@ const formLayout = {
const
SessionForm
:
React
.
FC
<
UpdateFormProps
>
=
(
props
)
=>
{
const
SessionForm
:
React
.
FC
<
UpdateFormProps
>
=
(
props
)
=>
{
const
[
formVals
,
setFormVals
]
=
useState
<
Partial
<
SessionItem
>>
({
const
[
formVals
,
setFormVals
]
=
useState
<
Partial
<
SessionItem
>>
({
session
:
props
.
values
.
session
,
session
:
props
.
values
.
session
,
type
:
props
.
values
.
sessionConfig
?.
type
,
type
:
props
.
values
.
type
,
useRemote
:
props
.
values
.
sessionConfig
?.
useRemote
,
useRemote
:
props
.
values
.
useRemote
,
address
:
props
.
values
.
sessionConfig
?.
address
,
clusterId
:
props
.
values
.
clusterId
,
clusterName
:
props
.
values
.
clusterName
,
address
:
props
.
values
.
address
,
createUser
:
props
.
values
.
createUser
,
createUser
:
props
.
values
.
createUser
,
createTime
:
props
.
values
.
createTime
,
createTime
:
props
.
values
.
createTime
,
});
});
...
@@ -35,7 +39,6 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
...
@@ -35,7 +39,6 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
onCancel
:
handleUpdateModalVisible
,
onCancel
:
handleUpdateModalVisible
,
updateModalVisible
,
updateModalVisible
,
values
,
values
,
isCreate
,
}
=
props
;
}
=
props
;
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
...
@@ -47,18 +50,41 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
...
@@ -47,18 +50,41 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
const
renderContent
=
()
=>
{
const
renderContent
=
()
=>
{
return
(
return
(
<>
<>
<
Form
Item
<
Item
name=
"session"
name=
"session"
label=
"名称"
label=
"名称"
rules=
{
[{
required
:
true
,
message
:
'请输入唯一名称!'
}]
}
>
rules=
{
[{
required
:
true
,
message
:
'请输入唯一名称!'
}]
}
>
<
Input
placeholder=
"请输入"
/>
<
Input
placeholder=
"请输入"
/>
</
Form
Item
>
</
Item
>
<
Form
Item
<
Item
name=
"
alias
"
name=
"
type
"
label=
"
别名
"
label=
"
访问权限
"
rules=
{
[{
required
:
true
,
message
:
'请输入别名!'
}]
}
>
rules=
{
[{
required
:
true
,
message
:
'请输入别名!'
}]
}
>
<
Input
placeholder=
"请输入"
/>
<
Select
defaultValue=
"PUBLIC"
>
</
FormItem
>
<
Option
value=
"PUBLIC"
>
共享
</
Option
>
<
Option
value=
"PRIVATE"
>
私密
</
Option
>
</
Select
>
</
Item
>
<
Item
name=
"useRemote"
label=
"是否远程"
rules=
{
[{
required
:
true
,
message
:
'禁用则为本地模式'
}]
}
>
<
Switch
checkedChildren=
"启用"
unCheckedChildren=
"禁用"
defaultChecked=
{
formVals
.
useRemote
}
/>
</
Item
>
<
Item
name=
"clusterId"
label=
"集群"
rules=
{
[{
required
:
true
,
message
:
'请输入别名!'
}]
}
>
<
Select
style=
{
{
width
:
'100%'
}
}
placeholder=
"选择Flink集群"
defaultValue=
{
0
}
optionLabelProp=
"label"
>
</
Select
>
</
Item
>
</>
</>
);
);
};
};
...
@@ -79,7 +105,7 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
...
@@ -79,7 +105,7 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
width=
{
640
}
width=
{
640
}
bodyStyle=
{
{
padding
:
'32px 40px 48px'
}
}
bodyStyle=
{
{
padding
:
'32px 40px 48px'
}
}
destroyOnClose
destroyOnClose
title=
{
isCreate
?
'创建新作业'
:
(
'重命名作业-'
+
formVals
.
name
)
}
title=
{
'创建新会话'
}
visible=
{
updateModalVisible
}
visible=
{
updateModalVisible
}
footer=
{
renderFooter
()
}
footer=
{
renderFooter
()
}
onCancel=
{
()
=>
handleUpdateModalVisible
()
}
onCancel=
{
()
=>
handleUpdateModalVisible
()
}
...
@@ -88,10 +114,10 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
...
@@ -88,10 +114,10 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
{
...
formLayout
}
{
...
formLayout
}
form=
{
form
}
form=
{
form
}
initialValues=
{
{
initialValues=
{
{
id
:
formVals
.
id
,
session
:
formVals
.
session
,
name
:
formVals
.
nam
e
,
type
:
formVals
.
typ
e
,
alias
:
formVals
.
alias
,
useRemote
:
formVals
.
useRemote
,
parentId
:
formVals
.
parent
Id
,
clusterId
:
formVals
.
cluster
Id
,
}
}
}
}
>
>
{
renderContent
()
}
{
renderContent
()
}
...
@@ -100,4 +126,6 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
...
@@ -100,4 +126,6 @@ const SessionForm: React.FC<UpdateFormProps> = (props) => {
);
);
};
};
export
default
SessionForm
;
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
cluster
:
Studio
.
cluster
,
}))(
SessionForm
);
dlink-web/src/components/Studio/StudioLeftTool/StudioConnector/data.d.ts
View file @
4b6db6d8
export
type
SessionItem
=
{
export
type
SessionItem
=
{
session
:
string
,
session
:
string
,
sessionConfig
:
{
type
:
string
,
type
:
string
,
useRemote
:
boolean
,
useRemote
:
boolean
,
clusterId
:
number
,
clusterId
:
number
,
clusterName
:
string
,
}
,
address
:
string
,
createUser
:
string
,
createUser
:
string
,
createTime
:
string
,
createTime
:
string
,
};
};
dlink-web/src/components/Studio/StudioLeftTool/StudioConnector/index.tsx
View file @
4b6db6d8
...
@@ -12,6 +12,8 @@ import {
...
@@ -12,6 +12,8 @@ import {
}
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
ProTable
from
'@ant-design/pro-table'
;
import
{
getData
,
handleAddOrUpdate
}
from
"@/components/Common/crud"
;
import
SessionForm
from
"@/components/Studio/StudioLeftTool/StudioConnector/components/SessionForm"
;
const
StudioConnector
=
(
props
:
any
)
=>
{
const
StudioConnector
=
(
props
:
any
)
=>
{
...
@@ -23,6 +25,8 @@ const StudioConnector = (props:any) => {
...
@@ -23,6 +25,8 @@ const StudioConnector = (props:any) => {
const
[
modalVisit
,
setModalVisit
]
=
useState
(
false
);
const
[
modalVisit
,
setModalVisit
]
=
useState
(
false
);
const
[
type
,
setType
]
=
useState
<
number
>
();
const
[
type
,
setType
]
=
useState
<
number
>
();
const
[
sessionData
,
setSessionData
]
=
useState
<
{}
>
();
const
[
sessionData
,
setSessionData
]
=
useState
<
{}
>
();
const
[
createSessionModalVisible
,
handleCreateSessionModalVisible
]
=
useState
<
boolean
>
(
false
);
const
getColumnSearchProps
=
(
dIndex
)
=>
({
const
getColumnSearchProps
=
(
dIndex
)
=>
({
filterDropdown
:
({
setSelectedKeys
,
selectedKeys
,
confirm
,
clearFilters
})
=>
(
filterDropdown
:
({
setSelectedKeys
,
selectedKeys
,
confirm
,
clearFilters
})
=>
(
...
@@ -189,8 +193,18 @@ const StudioConnector = (props:any) => {
...
@@ -189,8 +193,18 @@ const StudioConnector = (props:any) => {
},];
},];
return
columns
;
return
columns
;
};
};
const
showSessions
=
()
=>
{
const
createSessions
=
()
=>
{
handleCreateSessionModalVisible
(
true
);
};
const
showSessions
=
()
=>
{
setModalVisit
(
true
);
setType
(
1
);
const
res
=
getData
(
"api/studio/listSession"
);
res
.
then
((
result
)
=>
{
setSessionData
(
result
.
datas
);
});
};
};
return
(
return
(
...
@@ -207,7 +221,7 @@ const StudioConnector = (props:any) => {
...
@@ -207,7 +221,7 @@ const StudioConnector = (props:any) => {
<
Button
<
Button
type=
"text"
type=
"text"
icon=
{
<
PlusOutlined
/>
}
icon=
{
<
PlusOutlined
/>
}
onClick=
{
show
Sessions
}
onClick=
{
create
Sessions
}
/>
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
title=
"刷新连接器"
>
<
Tooltip
title=
"刷新连接器"
>
...
@@ -253,13 +267,30 @@ const StudioConnector = (props:any) => {
...
@@ -253,13 +267,30 @@ const StudioConnector = (props:any) => {
>
>
<
ProDescriptions
.
Item
span=
{
2
}
>
<
ProDescriptions
.
Item
span=
{
2
}
>
{
sessionData
?
{
sessionData
?
(<
Table
dataSource=
{
sessionData
}
columns=
{
getSessionsColumns
}
size=
"small"
(<
Table
dataSource=
{
sessionData
}
columns=
{
getSessionsColumns
()
}
size=
"small"
/>):(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
/>):(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
</
ProDescriptions
.
Item
>
</
ProDescriptions
.
Item
>
</
ProDescriptions
>
</
ProDescriptions
>
)
)
}
}
</
ModalForm
>
</
ModalForm
>
<
SessionForm
onSubmit=
{
async
(
value
)
=>
{
const
success
=
await
handleAddOrUpdate
(
"api/studio/createSession"
,
value
);
if
(
success
)
{
handleCreateSessionModalVisible
(
false
);
/*if (actionRef.current) {
actionRef.current.reload();
}*/
}
}
}
onCancel=
{
()
=>
{
handleCreateSessionModalVisible
(
false
);
// setFormValues(
{});
}
}
updateModalVisible=
{
createSessionModalVisible
}
values=
{
{}
}
/>
</>
</>
);
);
};
};
...
...
dlink-web/src/pages/FlinkSqlStudio/model.ts
View file @
4b6db6d8
import
{
Effect
,
Reducer
}
from
"umi"
;
import
{
Effect
,
Reducer
}
from
"umi"
;
import
{
executeSql
}
from
"./service"
;
import
{
import
{
addOrUpdateData
,
handleAddOrUpdate
,
handleRemove
,
handleRemoveById
,
postAll
,
getData
,
handleAddOrUpdate
queryData
}
from
"@/components/Common/crud"
;
}
from
"@/components/Common/crud"
;
import
{
Form
}
from
"antd"
;
import
{
executeDDL
}
from
"@/pages/FlinkSqlStudio/service"
;
export
type
ClusterType
=
{
export
type
ClusterType
=
{
id
:
number
,
id
:
number
,
...
@@ -76,21 +72,26 @@ export type RightClickMenu = {
...
@@ -76,21 +72,26 @@ export type RightClickMenu = {
export
type
ConnectorType
=
{
export
type
ConnectorType
=
{
tablename
:
string
;
tablename
:
string
;
}
}
export
type
SessionClusterType
=
{
export
type
SessionType
=
{
session
:
string
;
session
?:
string
;
clusterId
:
number
;
type
?:
string
;
clusterName
:
string
;
useRemote
?:
string
;
clusterId
?:
number
;
clusterName
?:
string
;
address
?:
string
;
createUser
?:
string
;
createTime
?:
string
;
connectors
:
ConnectorType
[];
connectors
:
ConnectorType
[];
}
}
export
type
StateType
=
{
export
type
StateType
=
{
cluster
?:
ClusterType
[];
cluster
?:
ClusterType
[];
currentSessionCluster
:
Session
ClusterType
[]
;
currentSessionCluster
:
Session
Type
;
current
:
TabsItemType
;
current
:
TabsItemType
;
sql
?:
string
;
sql
?:
string
;
monaco
?:
any
;
monaco
?:
any
;
currentPath
?:
string
[];
currentPath
?:
string
[];
tabs
:
TabsType
;
tabs
:
TabsType
;
session
:
string
[];
session
:
SessionType
[];
result
:{};
result
:{};
rightClickMenu
?:
boolean
;
rightClickMenu
?:
boolean
;
refs
:{
refs
:{
...
@@ -120,7 +121,7 @@ export type ModelType = {
...
@@ -120,7 +121,7 @@ export type ModelType = {
const
getClusters
=
async
()
=>
{
const
getClusters
=
async
()
=>
{
try
{
try
{
const
{
datas
}
=
await
postAll
(
'api/cluster/listEnabledAll'
);
const
{
datas
}
=
await
getData
(
'api/cluster/listEnabledAll'
);
return
datas
;
return
datas
;
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'获取Flink集群失败'
);
console
.
error
(
'获取Flink集群失败'
);
...
@@ -134,9 +135,6 @@ const Model: ModelType = {
...
@@ -134,9 +135,6 @@ const Model: ModelType = {
state
:
{
state
:
{
cluster
:
getClusters
(),
cluster
:
getClusters
(),
currentSessionCluster
:
{
currentSessionCluster
:
{
session
:
''
,
clusterId
:
0
,
clusterName
:
'本地环境'
,
connectors
:
[],
connectors
:
[],
},
},
current
:
{
current
:
{
...
...
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