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
7804ed29
Commit
7804ed29
authored
Jun 15, 2021
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.2.2 bug修复
parent
62957187
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
173 additions
and
33 deletions
+173
-33
CatalogueController.java
...c/main/java/com/dlink/controller/CatalogueController.java
+3
-2
CatalogueService.java
...min/src/main/java/com/dlink/service/CatalogueService.java
+1
-1
CatalogueServiceImpl.java
...ain/java/com/dlink/service/impl/CatalogueServiceImpl.java
+3
-2
TaskServiceImpl.java
...src/main/java/com/dlink/service/impl/TaskServiceImpl.java
+9
-0
config.ts
dlink-web/config/config.ts
+3
-0
crud.ts
dlink-web/src/components/Common/crud.ts
+29
-0
index.tsx
dlink-web/src/components/Studio/StudioEdit/index.tsx
+18
-6
index.tsx
dlink-web/src/components/Studio/StudioMenu/index.tsx
+3
-3
index.tsx
dlink-web/src/components/Studio/StudioSetting/index.tsx
+2
-4
index.tsx
dlink-web/src/components/Studio/StudioTabs/index.tsx
+2
-0
Function.ts
dlink-web/src/components/Studio/StudioTree/Function.ts
+15
-0
index.tsx
dlink-web/src/components/Studio/StudioTree/index.tsx
+34
-7
index.tsx
dlink-web/src/components/Studio/index.tsx
+1
-1
pages.ts
dlink-web/src/locales/zh-CN/pages.ts
+1
-1
model.ts
dlink-web/src/pages/FlinkSqlStudio/model.ts
+32
-4
Welcome.tsx
dlink-web/src/pages/Welcome.tsx
+17
-2
No files found.
dlink-admin/src/main/java/com/dlink/controller/CatalogueController.java
View file @
7804ed29
...
...
@@ -98,8 +98,9 @@ public class CatalogueController {
*/
@PutMapping
(
"/createTask"
)
public
Result
createTask
(
@RequestBody
CatalogueTaskDTO
catalogueTaskDTO
)
throws
Exception
{
if
(
catalogueService
.
createCatalogueAndTask
(
catalogueTaskDTO
)){
return
Result
.
succeed
(
"创建成功"
);
Catalogue
catalogue
=
catalogueService
.
createCatalogueAndTask
(
catalogueTaskDTO
);
if
(
catalogue
.
getId
()!=
null
){
return
Result
.
succeed
(
catalogue
,
"创建成功"
);
}
else
{
return
Result
.
failed
(
"创建失败"
);
}
...
...
dlink-admin/src/main/java/com/dlink/service/CatalogueService.java
View file @
7804ed29
...
...
@@ -16,7 +16,7 @@ public interface CatalogueService extends ISuperService<Catalogue> {
List
<
Catalogue
>
getAllData
();
boolean
createCatalogueAndTask
(
CatalogueTaskDTO
catalogueTaskDTO
);
Catalogue
createCatalogueAndTask
(
CatalogueTaskDTO
catalogueTaskDTO
);
boolean
toRename
(
Catalogue
catalogue
);
...
...
dlink-admin/src/main/java/com/dlink/service/impl/CatalogueServiceImpl.java
View file @
7804ed29
...
...
@@ -36,7 +36,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
createCatalogueAndTask
(
CatalogueTaskDTO
catalogueTaskDTO
)
{
public
Catalogue
createCatalogueAndTask
(
CatalogueTaskDTO
catalogueTaskDTO
)
{
Task
task
=
new
Task
();
task
.
setName
(
catalogueTaskDTO
.
getName
());
task
.
setAlias
(
catalogueTaskDTO
.
getAlias
());
...
...
@@ -46,7 +46,8 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
catalogue
.
setIsLeaf
(
true
);
catalogue
.
setTaskId
(
task
.
getId
());
catalogue
.
setParentId
(
catalogueTaskDTO
.
getParentId
());
return
this
.
save
(
catalogue
);
this
.
save
(
catalogue
);
return
catalogue
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
dlink-admin/src/main/java/com/dlink/service/impl/TaskServiceImpl.java
View file @
7804ed29
...
...
@@ -80,6 +80,15 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
statementService
.
updateById
(
statement
);
}
}
else
{
if
(
task
.
getCheckPoint
()==
null
){
task
.
setCheckPoint
(
0
);
}
if
(
task
.
getParallelism
()==
null
){
task
.
setParallelism
(
1
);
}
if
(
task
.
getClusterId
()==
null
){
task
.
setClusterId
(
0
);
}
this
.
save
(
task
);
Statement
statement
=
new
Statement
();
statement
.
setId
(
task
.
getId
());
...
...
dlink-web/config/config.ts
View file @
7804ed29
...
...
@@ -50,6 +50,9 @@ export default defineConfig({
manifest
:
{
basePath
:
'/'
,
},
history
:{
type
:
'hash'
},
// Fast Refresh 热更新
fastRefresh
:
{},
openAPI
:
[
...
...
dlink-web/src/components/Common/crud.ts
View file @
7804ed29
...
...
@@ -72,6 +72,21 @@ export const handleAddOrUpdate = async (url:string,fields: any) => {
}
};
export
const
handleAddOrUpdateWithResult
=
async
(
url
:
string
,
fields
:
any
)
=>
{
const
tipsTitle
=
fields
.
id
?
"修改"
:
"添加"
;
const
hide
=
message
.
loading
(
`正在
${
tipsTitle
}
`
);
try
{
const
{
msg
,
datas
}
=
await
addOrUpdateData
(
url
,{...
fields
});
hide
();
message
.
success
(
msg
);
return
datas
;
}
catch
(
error
)
{
hide
();
message
.
error
(
'出错啦'
);
return
null
;
}
};
export
const
handleRemove
=
async
(
url
:
string
,
selectedRows
:
[])
=>
{
const
hide
=
message
.
loading
(
'正在删除'
);
if
(
!
selectedRows
)
return
true
;
...
...
@@ -87,6 +102,20 @@ export const handleRemove = async (url:string,selectedRows: []) => {
}
};
export
const
handleRemoveById
=
async
(
url
:
string
,
id
:
number
)
=>
{
const
hide
=
message
.
loading
(
'正在删除'
);
try
{
const
{
msg
}
=
await
removeData
(
url
,[
id
]);
hide
();
message
.
success
(
msg
);
return
true
;
}
catch
(
error
)
{
hide
();
message
.
error
(
'删除失败,请重试'
);
return
false
;
}
};
export
const
handleSubmit
=
async
(
url
:
string
,
title
:
string
,
selectedRows
:
any
[])
=>
{
const
hide
=
message
.
loading
(
'正在'
+
title
);
if
(
!
selectedRows
)
return
true
;
...
...
dlink-web/src/components/Studio/StudioEdit/index.tsx
View file @
7804ed29
...
...
@@ -14,6 +14,7 @@ let provider = {
};
interface
IRightContent
{
key
:
string
;
value
:
any
;
handleCheck
:
()
=>
Promise
<
boolean
>
;
secondRightData
:
(
BaseDataSourceField
|
BaseDataSourceHeader
)[];
...
...
@@ -29,19 +30,30 @@ const FlinkSqlEditor = (props:any) => {
selectOnLineNumbers
:
true
,
renderSideBySide
:
false
,
},
current
=
props
.
current
,
// current,
tabs
,
// current=props.current,
dispatch
,
monaco
,
}
=
props
;
const
{
value
,
handleCheck
,
secondRightData
=
[]
}:
IRightContent
=
props
;
const
{
tabsKey
,
value
,
handleCheck
,
secondRightData
=
[]
}:
IRightContent
=
props
;
const
editorInstance
:
any
=
useRef
<
any
>
();
const
monacoInstance
:
any
=
useRef
();
const
code
:
any
=
useRef
(
current
.
sql
?
current
.
sql
:
''
);
const
getTabIndex
=
():
number
=>
{
for
(
let
i
=
0
;
i
<
tabs
.
panes
.
length
;
i
++
){
if
(
tabs
.
panes
[
i
].
key
==
tabsKey
){
return
i
;
}
}
return
0
;
};
const
tabIndex
=
getTabIndex
();
const
code
:
any
=
useRef
(
tabs
.
panes
[
tabIndex
].
value
?
tabs
.
panes
[
tabIndex
].
value
:
''
);
// const code: any = useRef(current.sql ? current.sql : '');
// const code: any = useRef(value ? value.formulaContent : '');
const
cache
:
any
=
useRef
(
code
.
current
);
...
...
@@ -148,11 +160,11 @@ const FlinkSqlEditor = (props:any) => {
return
(
<
React
.
Fragment
>
<
MonacoEditor
ref=
{
monaco
}
ref=
{
tabs
.
panes
[
tabIndex
].
monaco
}
width=
{
width
}
height=
{
height
}
language=
{
language
}
value=
{
current
.
value
}
value=
{
tabs
.
panes
[
tabIndex
]
.
value
}
options=
{
options
}
onChange=
{
onChangeHandle
}
theme=
"vs-dark"
...
...
dlink-web/src/components/Studio/StudioMenu/index.tsx
View file @
7804ed29
...
...
@@ -25,8 +25,8 @@ const StudioMenu = (props: any) => {
const
{
tabs
,
current
,
currentPath
,
form
,
dispatch
,
monaco
}
=
props
;
const
execute
=
()
=>
{
let
selection
=
monaco
.
current
.
editor
.
getSelection
();
let
selectsql
=
monaco
.
current
.
editor
.
getModel
().
getValueInRange
(
selection
);
let
selection
=
current
.
monaco
.
current
.
editor
.
getSelection
();
let
selectsql
=
current
.
monaco
.
current
.
editor
.
getModel
().
getValueInRange
(
selection
);
if
(
selectsql
==
null
||
selectsql
==
''
){
selectsql
=
current
.
value
;
}
...
...
@@ -277,5 +277,5 @@ export default connect(({Studio}: { Studio: StateType }) => ({
current
:
Studio
.
current
,
currentPath
:
Studio
.
currentPath
,
tabs
:
Studio
.
tabs
,
monaco
:
Studio
.
monaco
,
//
monaco: Studio.monaco,
}))(
StudioMenu
);
dlink-web/src/components/Studio/StudioSetting/index.tsx
View file @
7804ed29
...
...
@@ -58,7 +58,6 @@ const StudioSetting = (props: any) => {
payload
:
newTabs
,
});
};
const
localOption
=
(<><
Tag
color=
"default"
>
Local
</
Tag
>
本地环境
</>);
return
(
<>
<
Row
>
...
...
@@ -126,13 +125,12 @@ const StudioSetting = (props: any) => {
<
Form
.
Item
label=
"Flink集群"
tooltip=
"选择Flink集群进行远程提交任务"
name=
"clusterId"
className=
{
styles
.
form_item
}
>
<
Select
//mode="multiple"
style=
{
{
width
:
'100%'
}
}
placeholder=
"选择Flink集群"
defaultValue=
{
[
'0'
]
}
defaultValue=
{
0
}
optionLabelProp=
"label"
>
<
Option
value=
"0"
label=
{
localOption
}
>
<
Option
value=
{
0
}
label=
{
(<><
Tag
color=
"default"
>
Local
</
Tag
>
本地环境
</>)
}
>
<
Tag
color=
"default"
>
Local
</
Tag
>
本地环境
</
Option
>
...
...
dlink-web/src/components/Studio/StudioTabs/index.tsx
View file @
7804ed29
...
...
@@ -3,6 +3,7 @@ import React, {useState} from 'react';
import
{
connect
}
from
"umi"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
styles
from
'./index.less'
;
import
StudioEdit
from
'../StudioEdit'
;
const
{
TabPane
}
=
Tabs
;
...
...
@@ -70,6 +71,7 @@ const EditorTabs = (props: any) => {
>
{
tabs
.
panes
.
map
(
pane
=>
(
<
TabPane
tab=
{
pane
.
title
}
key=
{
pane
.
key
}
closable=
{
pane
.
closable
}
>
<
StudioEdit
tabsKey=
{
pane
.
key
}
height=
'400px'
/>
</
TabPane
>
))
}
</
Tabs
>
...
...
dlink-web/src/components/Studio/StudioTree/Function.ts
View file @
7804ed29
...
...
@@ -34,3 +34,18 @@ export function convertToTreeData(data:TreeDataNode[], pid:number,path?:string[]
}
return
result
}
export
function
getTreeNodeByKey
(
node
:
any
[],
key
:
number
)
{
for
(
let
i
=
0
;
i
<
node
.
length
;
i
++
)
{
if
(
node
[
i
].
key
==
key
)
{
return
node
[
i
];
}
else
if
(
node
[
i
].
children
)
{
let
result
=
getTreeNodeByKey
(
node
[
i
].
children
,
key
);
if
(
result
){
return
result
;
}
}
else
{
return
null
;
}
}
}
dlink-web/src/components/Studio/StudioTree/index.tsx
View file @
7804ed29
...
...
@@ -3,10 +3,13 @@ import {connect} from "umi";
import
{
DownOutlined
,
SwitcherOutlined
,
FrownOutlined
,
MehOutlined
,
SmileOutlined
,
FolderAddOutlined
}
from
"@ant-design/icons"
;
import
{
Tree
,
Input
,
Menu
,
Empty
,
Button
,
message
,
Modal
,
Tooltip
,
Row
,
Col
}
from
'antd'
;
import
{
getCatalogueTreeData
}
from
"@/pages/FlinkSqlStudio/service"
;
import
{
convertToTreeData
,
DataType
,
TreeDataNode
}
from
"@/components/Studio/StudioTree/Function"
;
import
{
convertToTreeData
,
DataType
,
getTreeNodeByKey
,
TreeDataNode
}
from
"@/components/Studio/StudioTree/Function"
;
import
style
from
"./index.less"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
getInfoById
,
handleAddOrUpdate
,
handleInfo
,
handleRemove
,
handleSubmit
}
from
"@/components/Common/crud"
;
import
{
getInfoById
,
handleAddOrUpdate
,
handleAddOrUpdateWithResult
,
handleInfo
,
handleRemove
,
handleRemoveById
,
handleSubmit
}
from
"@/components/Common/crud"
;
import
UpdateCatalogueForm
from
'./components/UpdateCatalogueForm'
;
import
{
ActionType
}
from
"@ant-design/pro-table"
;
import
UpdateTaskForm
from
"@/components/Studio/StudioTree/components/UpdateTaskForm"
;
...
...
@@ -71,6 +74,21 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
setTreeData
(
data
);
};
const
openByKey
=
async
(
key
)
=>
{
const
result
=
await
getCatalogueTreeData
();
let
data
=
result
.
datas
;
let
list
=
data
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
list
[
i
].
title
=
list
[
i
].
name
;
list
[
i
].
key
=
list
[
i
].
id
;
}
setDataList
(
list
);
data
=
convertToTreeData
(
data
,
0
);
setTreeData
(
data
);
let
node
=
getTreeNodeByKey
(
data
,
key
);
onSelect
([],{
node
:
node
});
};
useEffect
(()
=>
{
getTreeData
();
},
[]);
...
...
@@ -192,7 +210,7 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
setTaskFormValues
({
parentId
:
node
.
id
,
});
getTreeData
();
//
getTreeData();
}
else
{
message
.
error
(
'只能在目录上创建作业'
);
}
...
...
@@ -206,7 +224,13 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
okText
:
'确认'
,
cancelText
:
'取消'
,
onOk
:
async
()
=>
{
await
handleRemove
(
'/api/catalogue'
,[
node
]);
await
handleRemoveById
(
'/api/catalogue'
,
node
.
id
);
if
(
node
.
taskId
)
{
dispatch
({
type
:
"Studio/deleteTabByKey"
,
payload
:
node
.
taskId
,
});
}
getTreeData
();
}
});
...
...
@@ -358,11 +382,14 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
{
updateTaskModalVisible
?
(
<
UpdateTaskForm
onSubmit=
{
async
(
value
)
=>
{
const
success
=
await
handleAddOrUpdate
(
'/api/catalogue/createTask'
,
value
);
if
(
succes
s
)
{
const
datas
=
await
handleAddOrUpdateWithResult
(
'/api/catalogue/createTask'
,
value
);
if
(
data
s
)
{
handleUpdateTaskModalVisible
(
false
);
setTaskFormValues
({});
getTreeData
()
openByKey
(
datas
.
id
);
// getTreeData();
// console.log(datas);
// onSelect([],openByKey(datas.id));
}
}
}
onCancel=
{
()
=>
{
...
...
dlink-web/src/components/Studio/index.tsx
View file @
7804ed29
...
...
@@ -73,7 +73,7 @@ const Studio: React.FC<StudioProps> = (props) => {
</
Col
>
<
Col
span=
{
16
}
>
<
StudioTabs
/>
<
StudioEdit
/>
{
/*<StudioEdit/>*/
}
</
Col
>
<
Col
span=
{
4
}
className=
{
styles
[
"vertical-tabs"
]
}
>
<
Tabs
defaultActiveKey=
"1"
size=
"small"
tabPosition=
"right"
style=
{
{
height
:
"100%"
,
border
:
"1px solid #f0f0f0"
}
}
>
...
...
dlink-web/src/locales/zh-CN/pages.ts
View file @
7804ed29
...
...
@@ -29,7 +29,7 @@ export default {
'pages.welcome.link'
:
'欢迎加入'
,
'pages.welcome.star'
:
'欢迎 Star '
,
'pages.welcome.advancedLayout'
:
'Github'
,
'pages.welcome.alertMessage'
:
'实时计算平台 Dlink & Apache Flink 即将发布,目前为体验版,版本号为 0.2.
1
。'
,
'pages.welcome.alertMessage'
:
'实时计算平台 Dlink & Apache Flink 即将发布,目前为体验版,版本号为 0.2.
2
。'
,
'pages.admin.subPage.title'
:
' 这个页面只有 admin 权限才能查看'
,
'pages.admin.subPage.alertMessage'
:
'umi ui 现已发布,欢迎使用 npm run ui 启动体验。'
,
'pages.searchTable.createForm.newRule'
:
'新建规则'
,
...
...
dlink-web/src/pages/FlinkSqlStudio/model.ts
View file @
7804ed29
import
{
Effect
,
Reducer
}
from
"umi"
;
import
{
executeSql
}
from
"./service"
;
import
{
addOrUpdateData
,
handleAddOrUpdate
,
postAll
,
queryData
}
from
"@/components/Common/crud"
;
import
{
addOrUpdateData
,
handleAddOrUpdate
,
handleRemove
,
handleRemoveById
,
postAll
,
queryData
}
from
"@/components/Common/crud"
;
import
{
Form
}
from
"antd"
;
export
type
ClusterType
=
{
...
...
@@ -50,6 +53,7 @@ export type TabsItemType = {
path
:
string
[];
task
?:
TaskType
;
console
:
ConsoleType
;
monaco
?:
any
;
}
export
type
TabsType
=
{
...
...
@@ -118,14 +122,15 @@ const Model: ModelType = {
savePointPath
:
''
,
parallelism
:
1
,
fragment
:
true
,
clusterId
:
'0'
,
clusterId
:
0
,
maxRowNum
:
100
,
session
:
'admin'
,
alias
:
'草稿'
,
},
console
:{
result
:[],
}
},
monaco
:
{},
},
sql
:
''
,
monaco
:
{},
...
...
@@ -150,7 +155,8 @@ const Model: ModelType = {
},
console
:{
result
:[],
}
},
monaco
:
{},
}],
},
session
:[
'admin'
],
...
...
@@ -219,6 +225,28 @@ const Model: ModelType = {
},
};
},
deleteTabByKey
(
state
,
{
payload
})
{
let
newTabs
=
state
.
tabs
;
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
){
if
(
newTabs
.
panes
[
i
].
key
==
payload
){
newTabs
.
panes
.
splice
(
i
,
1
);
break
;
}
}
let
newCurrent
=
newTabs
.
panes
[
newTabs
.
panes
.
length
-
1
];
if
(
newTabs
.
activeKey
==
payload
)
{
newTabs
.
activeKey
=
newCurrent
.
key
;
}
return
{
...
state
,
current
:{
...
newCurrent
,
},
tabs
:{
...
newTabs
,
},
};
},
changeActiveKey
(
state
,
{
payload
})
{
let
tabs
=
state
.
tabs
;
tabs
.
activeKey
=
payload
;
...
...
dlink-web/src/pages/Welcome.tsx
View file @
7804ed29
...
...
@@ -20,7 +20,7 @@ export default (): React.ReactNode => {
<
Alert
message=
{
intl
.
formatMessage
({
id
:
'pages.welcome.alertMessage'
,
defaultMessage
:
'实时计算平台 Dlink & Apache Flink 即将发布,目前为体验版,版本号为 0.2.2
-rc1
。'
,
defaultMessage
:
'实时计算平台 Dlink & Apache Flink 即将发布,目前为体验版,版本号为 0.2.2。'
,
})
}
type=
"success"
showIcon
...
...
@@ -177,7 +177,7 @@ export default (): React.ReactNode => {
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
<
Timeline
.
Item
><
Text
code
>
0.2.2
-rc1
</
Text
>
<
Text
type=
"secondary"
>
2021-06-15
</
Text
>
<
Timeline
.
Item
><
Text
code
>
0.2.2
</
Text
>
<
Text
type=
"secondary"
>
2021-06-15
</
Text
>
<
p
>
</
p
>
<
Paragraph
>
<
ul
>
...
...
@@ -190,6 +190,21 @@ export default (): React.ReactNode => {
<
li
>
<
Link
href=
""
>
解决了表单无法正确提交 Fragment 的问题
</
Link
>
</
li
>
<
li
>
<
Link
href=
""
>
开启Hash路由解决了历史路由集成Springboot的问题
</
Link
>
</
li
>
<
li
>
<
Link
href=
""
>
解决了 FlinkSQL 编辑器的 CTRL+C 撤销乱窜问题
</
Link
>
</
li
>
<
li
>
<
Link
href=
""
>
解决了右键删除目录树的作业时对应选项卡不关闭的问题
</
Link
>
</
li
>
<
li
>
<
Link
href=
""
>
解决了新增作业其配置无法正常初始化的问题
</
Link
>
</
li
>
<
li
>
<
Link
href=
""
>
增加了新增作业自动定位及打开选项卡的功能
</
Link
>
</
li
>
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
...
...
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