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
a6ad2058
Commit
a6ad2058
authored
Jul 02, 2021
by
godkaikai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
执行历史
parent
a3f5b303
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
391 additions
and
188 deletions
+391
-188
StudioExecuteDTO.java
...k-admin/src/main/java/com/dlink/dto/StudioExecuteDTO.java
+3
-3
Job2MysqlHandler.java
...k-admin/src/main/java/com/dlink/job/Job2MysqlHandler.java
+3
-2
History.java
dlink-admin/src/main/java/com/dlink/model/History.java
+4
-0
HistoryMapper.xml
dlink-admin/src/main/resources/mapper/HistoryMapper.xml
+4
-2
JobConfig.java
dlink-core/src/main/java/com/dlink/job/JobConfig.java
+5
-5
JobManager.java
dlink-core/src/main/java/com/dlink/job/JobManager.java
+3
-3
index.less
.../components/Studio/StudioConsole/StudioHistory/index.less
+11
-0
index.tsx
...c/components/Studio/StudioConsole/StudioHistory/index.tsx
+277
-57
index2.tsx
.../components/Studio/StudioConsole/StudioHistory/index2.tsx
+0
-37
index.tsx
...src/components/Studio/StudioConsole/StudioTable/index.tsx
+4
-28
index.tsx
dlink-web/src/components/Studio/StudioLeftTool/index.tsx
+2
-2
index.tsx
dlink-web/src/components/Studio/StudioMenu/index.tsx
+6
-1
index.tsx
.../components/Studio/StudioRightTool/StudioConfig/index.tsx
+45
-45
index.less
dlink-web/src/components/Studio/index.less
+17
-2
model.ts
dlink-web/src/pages/FlinkSqlStudio/model.ts
+7
-1
No files found.
dlink-admin/src/main/java/com/dlink/dto/StudioExecuteDTO.java
View file @
a6ad2058
...
...
@@ -28,14 +28,14 @@ public class StudioExecuteDTO {
private
String
savePointPath
;
public
JobConfig
getJobConfig
()
{
return
new
JobConfig
(
useResult
,
useSession
,
getSession
()
,
useRemote
,
clusterId
,
taskId
,
jobName
,
fragment
,
maxRowNum
,
checkPoint
,
parallelism
,
savePointPath
);
return
new
JobConfig
(
useResult
,
useSession
,
session
,
useRemote
,
clusterId
,
taskId
,
jobName
,
fragment
,
maxRowNum
,
checkPoint
,
parallelism
,
savePointPath
);
}
public
String
getSession
()
{
/*
public String getSession() {
if(useRemote) {
return clusterId + "_" + session;
}else{
return "0_" + session;
}
}
}
*/
}
dlink-admin/src/main/java/com/dlink/job/Job2MysqlHandler.java
View file @
a6ad2058
...
...
@@ -28,7 +28,7 @@ public class Job2MysqlHandler implements JobHandler {
history
.
setClusterId
(
job
.
getJobConfig
().
getClusterId
());
history
.
setJobManagerAddress
(
job
.
getJobManagerAddress
());
history
.
setJobName
(
job
.
getJobConfig
().
getJobName
());
history
.
setSession
(
job
.
getJobConfig
().
getSession
Key
());
history
.
setSession
(
job
.
getJobConfig
().
getSession
());
history
.
setStatus
(
job
.
getStatus
().
ordinal
());
history
.
setStartTime
(
job
.
getStartTime
());
history
.
setTaskId
(
job
.
getJobConfig
().
getTaskId
());
...
...
@@ -54,9 +54,10 @@ public class Job2MysqlHandler implements JobHandler {
History
history
=
new
History
();
history
.
setId
(
job
.
getId
());
history
.
setJobId
(
job
.
getJobId
());
history
.
setStatement
(
job
.
getStatement
());
history
.
setStatus
(
job
.
getStatus
().
ordinal
());
history
.
setEndTime
(
job
.
getEndTime
());
history
.
setResult
(
JSONUtil
.
toJsonStr
(
job
.
getResult
()));
//
history.setResult(JSONUtil.toJsonStr(job.getResult()));
historyService
.
updateById
(
history
);
return
true
;
}
...
...
dlink-admin/src/main/java/com/dlink/model/History.java
View file @
a6ad2058
...
...
@@ -38,4 +38,8 @@ public class History implements Serializable {
@TableField
(
exist
=
false
)
private
String
statusText
;
@TableField
(
exist
=
false
)
private
String
clusterAlias
;
@TableField
(
exist
=
false
)
private
String
taskAlias
;
}
dlink-admin/src/main/resources/mapper/HistoryMapper.xml
View file @
a6ad2058
...
...
@@ -30,9 +30,11 @@
<select
id=
"selectForProTable"
resultType=
"com.dlink.model.History"
>
select
a.*
a.*,
(select b.alias FROM dlink_cluster b where b.id=a.cluster_id) as clusterAlias,
(select c.alias FROM dlink_task c where c.id=a.task_id) as taskAlias
from
dlink_
cluster
a
dlink_
history
a
<where>
1=1
<if
test=
'param.name!=null and param.name!=""'
>
...
...
dlink-core/src/main/java/com/dlink/job/JobConfig.java
View file @
a6ad2058
...
...
@@ -17,7 +17,7 @@ public class JobConfig {
private
boolean
useResult
;
private
boolean
useSession
;
private
String
session
Key
;
private
String
session
;
private
boolean
useRemote
;
private
Integer
clusterId
;
private
String
host
;
...
...
@@ -29,12 +29,12 @@ public class JobConfig {
private
Integer
parallelism
;
private
String
savePointPath
;
public
JobConfig
(
boolean
useResult
,
boolean
useSession
,
String
session
Key
,
boolean
useRemote
,
Integer
clusterId
,
public
JobConfig
(
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
Integer
clusterId
,
Integer
taskId
,
String
jobName
,
boolean
useSqlFragment
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
String
savePointPath
)
{
this
.
useResult
=
useResult
;
this
.
useSession
=
useSession
;
this
.
session
Key
=
sessionKey
;
this
.
session
=
session
;
this
.
useRemote
=
useRemote
;
this
.
clusterId
=
clusterId
;
this
.
taskId
=
taskId
;
...
...
@@ -46,10 +46,10 @@ public class JobConfig {
this
.
savePointPath
=
savePointPath
;
}
public
JobConfig
(
boolean
useResult
,
boolean
useSession
,
String
session
Key
,
boolean
useRemote
,
Integer
clusterId
)
{
public
JobConfig
(
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
Integer
clusterId
)
{
this
.
useResult
=
useResult
;
this
.
useSession
=
useSession
;
this
.
session
Key
=
sessionKey
;
this
.
session
=
session
;
this
.
useRemote
=
useRemote
;
this
.
clusterId
=
clusterId
;
}
...
...
dlink-core/src/main/java/com/dlink/job/JobManager.java
View file @
a6ad2058
...
...
@@ -117,12 +117,12 @@ public class JobManager extends RunTime {
private
Executor
createExecutorWithSession
()
{
if
(
config
.
isUseSession
())
{
ExecutorEntity
executorEntity
=
SessionPool
.
get
(
config
.
getSession
Key
());
ExecutorEntity
executorEntity
=
SessionPool
.
get
(
config
.
getSession
());
if
(
executorEntity
!=
null
)
{
executor
=
executorEntity
.
getExecutor
();
}
else
{
createExecutor
();
SessionPool
.
push
(
new
ExecutorEntity
(
config
.
getSession
Key
(),
executor
));
SessionPool
.
push
(
new
ExecutorEntity
(
config
.
getSession
(),
executor
));
}
}
else
{
createExecutor
();
...
...
@@ -134,7 +134,7 @@ public class JobManager extends RunTime {
public
boolean
init
()
{
handler
=
JobHandler
.
build
();
String
host
=
config
.
getHost
();
if
(
config
.
isUseRemote
()
&&
host
!=
null
&&
!(
""
).
equals
(
host
))
{
if
(
host
!=
null
&&
!(
""
).
equals
(
host
))
{
String
[]
strs
=
host
.
split
(
NetConstant
.
COLON
);
if
(
strs
.
length
>=
2
)
{
jobManagerHost
=
strs
[
0
];
...
...
dlink-web/src/components/Studio/StudioConsole/StudioHistory/index.less
0 → 100644
View file @
a6ad2058
.code{
width: 100%;
max-height: 500px;
display: block;
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: rgb(246, 248, 250);
border-radius: 3px;
}
dlink-web/src/components/Studio/StudioConsole/StudioHistory/index.tsx
View file @
a6ad2058
This diff is collapsed.
Click to expand it.
dlink-web/src/components/Studio/StudioConsole/StudioHistory/index2.tsx
deleted
100644 → 0
View file @
a3f5b303
import
{
Typography
,
Divider
,
Badge
,
Empty
}
from
"antd"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
connect
}
from
"umi"
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
const
StudioHistory2
=
(
props
:
any
)
=>
{
const
{
current
}
=
props
;
return
(
<
Typography
>
{
current
.
console
.
result
.
map
((
item
)
=>
{
return
(<
Paragraph
>
<
blockquote
><
Link
href=
{
`http://${item.flinkHost}:${item.flinkPort}`
}
target=
"_blank"
>
[
{
item
.
sessionId
}
:
{
item
.
flinkHost
}
:
{
item
.
flinkPort
}
]
</
Link
>
<
Divider
type=
"vertical"
/>
{
item
.
finishDate
}
<
Divider
type=
"vertical"
/>
{
!
item
.
success
?
<><
Badge
status=
"error"
/><
Text
type=
"danger"
>
Error
</
Text
></>
:
<><
Badge
status=
"success"
/><
Text
type=
"success"
>
Success
</
Text
></>
}
<
Divider
type=
"vertical"
/>
{
item
.
jobName
&&
<
Text
code
>
{
item
.
jobName
}
</
Text
>
}
{
item
.
jobId
&&
<
Text
code
>
{
item
.
jobId
}
</
Text
>
}
<
Text
keyboard
>
{
item
.
time
}
ms
</
Text
></
blockquote
>
{
item
.
statement
&&
(<
pre
style=
{
{
height
:
'40px'
}
}
>
{
item
.
statement
}
</
pre
>)
}
{
item
.
msg
?
item
.
msg
:
''
}
{
item
.
error
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
item
.
error
}
</
pre
>)
}
</
Paragraph
>)
})
}
{
current
.
console
.
result
.
length
==
0
?<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>:
''
}
</
Typography
>
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
current
:
Studio
.
current
,
}))(
StudioHistory2
);
dlink-web/src/components/Studio/StudioConsole/StudioTable/index.tsx
View file @
a6ad2058
...
...
@@ -5,6 +5,7 @@ import {useState} from "react";
// import Highlighter from 'react-highlight-words';
import
{
SearchOutlined
}
from
'@ant-design/icons'
;
import
{
showJobData
}
from
"@/components/Studio/StudioEvent/DQL"
;
import
ProTable
from
'@ant-design/pro-table'
;
const
{
Option
}
=
Select
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
...
...
@@ -96,36 +97,11 @@ const StudioTable = (props:any) => {
return
datas
;
};
const
onChange
=
(
val
:
string
)
=>
{
showJobData
(
val
,
dispatch
);
};
return
(
<
Typography
>
<
Form
.
Item
label=
"当前执行记录"
tooltip=
"选择最近的执行记录,仅包含成功的记录"
>
<
Select
style=
{
{
width
:
'100%'
}
}
placeholder=
"选择最近的执行记录"
optionLabelProp=
"label"
onChange=
{
onChange
}
>
{
current
.
console
.
result
.
map
((
item
,
index
)
=>
{
if
(
item
.
status
==
'SUCCESS'
&&
item
.
jobId
)
{
let
tag
=
(<>
<
Tooltip
placement=
"topLeft"
title=
{
item
.
statement
}
>
<
Tag
color=
"processing"
>
{
item
.
startTime
}
</
Tag
>
<
Tag
color=
"processing"
>
{
item
.
endTime
}
</
Tag
>
<
Text
underline
>
[
{
item
.
jobConfig
.
sessionKey
}
:
{
item
.
jobConfig
.
host
}
]
</
Text
>
{
item
.
jobConfig
.
jobName
&&
<
Text
code
>
{
item
.
jobConfig
.
jobName
}
</
Text
>
}
{
item
.
jobId
&&
<
Text
code
>
{
item
.
jobId
}
</
Text
>
}
{
item
.
statement
}
</
Tooltip
></>);
return
(<
Option
value=
{
item
.
jobId
}
label=
{
tag
}
>
{
tag
}
</
Option
>)
}
})
}
</
Select
>
</
Form
.
Item
>
{
result
&&
result
.
jobId
&&!
result
.
isDestroyed
?(<
Table
dataSource=
{
result
.
rowData
}
columns=
{
getColumns
(
result
.
columns
)
}
/>):(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
{
result
&&
result
.
jobId
&&!
result
.
isDestroyed
?
(<
ProTable
dataSource=
{
result
.
rowData
}
columns=
{
getColumns
(
result
.
columns
)
}
search=
{
false
}
/>):(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
</
Typography
>
);
};
...
...
dlink-web/src/components/Studio/StudioLeftTool/index.tsx
View file @
a6ad2058
import
{
Tabs
,
Empty
}
from
"antd"
;
import
{
BarsOutlined
,
DatabaseOutlined
,
AppstoreOutlined
,
ClusterOutlined
,
Api
Outlined
,
FireOutlined
,
FunctionOutlined
}
from
"@ant-design/icons"
;
import
{
BarsOutlined
,
DatabaseOutlined
,
AppstoreOutlined
,
ClusterOutlined
,
Message
Outlined
,
FireOutlined
,
FunctionOutlined
}
from
"@ant-design/icons"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
connect
}
from
"umi"
;
import
styles
from
"./index.less"
;
...
...
@@ -27,7 +27,7 @@ const StudioLeftTool = (props:any) => {
<
TabPane
tab=
{
<
span
><
ClusterOutlined
/>
集群
</
span
>
}
key=
"Cluster"
>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
</
TabPane
>
<
TabPane
tab=
{
<
span
><
ApiOutlined
/>
连接器
</
span
>
}
key=
"Connectors"
>
<
TabPane
tab=
{
<
span
><
MessageOutlined
/>
会话
</
span
>
}
key=
"Connectors"
>
<
StudioConnector
/>
</
TabPane
>
<
TabPane
tab=
{
<
span
><
FireOutlined
/>
任务
</
span
>
}
key=
"FlinkTask"
>
...
...
dlink-web/src/components/Studio/StudioMenu/index.tsx
View file @
a6ad2058
...
...
@@ -13,6 +13,7 @@ import { postDataArray} from "@/components/Common/crud";
import
{
executeSql
}
from
"@/pages/FlinkSqlStudio/service"
;
import
StudioHelp
from
"./StudioHelp"
;
import
{
showTables
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
timeout
}
from
"d3-timer"
;
const
menu
=
(
<
Menu
>
...
...
@@ -23,7 +24,7 @@ const menu = (
const
StudioMenu
=
(
props
:
any
)
=>
{
const
{
tabs
,
current
,
currentPath
,
form
,
dispatch
}
=
props
;
const
{
tabs
,
current
,
currentPath
,
form
,
refs
,
dispatch
}
=
props
;
const
execute
=
()
=>
{
let
selectsql
=
null
;
...
...
@@ -57,6 +58,9 @@ const StudioMenu = (props: any) => {
key
:
taskKey
,
icon
:
<
SmileOutlined
style=
{
{
color
:
'#108ee9'
}
}
/>,
});
setTimeout
(()
=>
{
refs
?.
history
?.
current
?.
reload
();
},
2000
);
const
result
=
executeSql
(
param
);
result
.
then
(
res
=>
{
notification
.
close
(
taskKey
);
...
...
@@ -284,5 +288,6 @@ export default connect(({Studio}: { Studio: StateType }) => ({
current
:
Studio
.
current
,
currentPath
:
Studio
.
currentPath
,
tabs
:
Studio
.
tabs
,
refs
:
Studio
.
refs
,
// monaco: Studio.monaco,
}))(
StudioMenu
);
dlink-web/src/components/Studio/StudioRightTool/StudioConfig/index.tsx
View file @
a6ad2058
...
...
@@ -71,6 +71,51 @@ const StudioConfig = (props: any) => {
>
<
Input
placeholder=
"自定义作业名"
/>
</
Form
.
Item
>
<
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
>
<
Col
span=
{
12
}
>
<
Form
.
Item
...
...
@@ -97,51 +142,6 @@ const StudioConfig = (props: any) => {
<
Switch
checkedChildren=
"启用"
unCheckedChildren=
"禁用"
/>
</
Form
.
Item
>
<
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
>
</
Form
>
</>
);
...
...
dlink-web/src/components/Studio/index.less
View file @
a6ad2058
...
...
@@ -24,8 +24,23 @@
padding: 0px;
}
/* --- card 内偏移样式 --- start */
/* --- list toolbar隐藏滚动条 --- start */
.ant-pro-table-list-toolbar {
overflow-x: hidden;
overflow-y: hidden;
line-height: 1;
}
/* --- list toolbar隐藏滚动条 --- start */
/* --- list toolbar修改内偏移 --- start */
.ant-pro-table-list-toolbar-container {
padding: 0;
}
/* --- list toolbar修改内偏移 --- start */
/* --- prodescription item宽度 --- start */
.ant-descriptions-item-content {
width: 100%;
}
/* --- prodescription item宽度 --- start */
}
/* --- tabs 垂直样式 --- start */
...
...
dlink-web/src/pages/FlinkSqlStudio/model.ts
View file @
a6ad2058
...
...
@@ -93,6 +93,9 @@ export type StateType = {
session
:
string
[];
result
:{};
rightClickMenu
?:
boolean
;
refs
:{
history
:
any
;
};
};
export
type
ModelType
=
{
...
...
@@ -196,7 +199,10 @@ const Model: ModelType = {
},
session
:
[],
result
:{},
rightClickMenu
:
false
rightClickMenu
:
false
,
refs
:{
history
:{},
}
},
effects
:
{
...
...
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