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
8d8ebc6f
Commit
8d8ebc6f
authored
Sep 08, 2021
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑器自动补全文档内容
parent
6d313dc0
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
165 additions
and
24 deletions
+165
-24
README.md
README.md
+2
-0
DocumentController.java
...rc/main/java/com/dlink/controller/DocumentController.java
+9
-6
Document.java
dlink-admin/src/main/java/com/dlink/model/Document.java
+1
-0
DocumentService.java
...dmin/src/main/java/com/dlink/service/DocumentService.java
+3
-0
DocumentServiceImpl.java
...main/java/com/dlink/service/impl/DocumentServiceImpl.java
+7
-0
DocumentMapper.xml
dlink-admin/src/main/resources/mapper/DocumentMapper.xml
+2
-1
dlink.sql
dlink-doc/sql/dlink.sql
+7
-0
index.tsx
dlink-web/src/components/Studio/StudioEdit/index.tsx
+23
-9
DDL.ts
dlink-web/src/components/Studio/StudioEvent/DDL.ts
+10
-0
index.tsx
dlink-web/src/components/Studio/index.tsx
+2
-2
pages.ts
dlink-web/src/locales/zh-CN/pages.ts
+1
-1
UpdateForm.tsx
dlink-web/src/pages/Document/components/UpdateForm.tsx
+8
-0
data.d.ts
dlink-web/src/pages/Document/data.d.ts
+1
-0
index.tsx
dlink-web/src/pages/Document/index.tsx
+40
-5
model.ts
dlink-web/src/pages/Document/model.ts
+39
-0
Welcome.tsx
dlink-web/src/pages/Welcome.tsx
+10
-0
No files found.
README.md
View file @
8d8ebc6f
...
...
@@ -243,7 +243,9 @@ AGG BY TOP2(value) as (value,rank);
#### 使用技巧
1.[
Flink AggTable 在 Dlink 的实践
](
https://github.com/DataLinkDC/dlink/blob/main/dlink-doc/doc/FlinkAggTable%E5%9C%A8Dlink%E7%9A%84%E5%BA%94%E7%94%A8.md
)
2.[
Dlink 概念原理与源码扩展介绍
](
https://github.com/DataLinkDC/dlink/blob/main/dlink-doc/doc/Dlink%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%E4%B8%8E%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86%E8%AF%A6%E8%A7%A3.md
)
3.[
Dlink 实时计算平台——部署篇
](
https://github.com/DataLinkDC/dlink/blob/dev/dlink-doc/doc/Dlink%E5%AE%9E%E6%97%B6%E8%AE%A1%E7%AE%97%E5%B9%B3%E5%8F%B0%E2%80%94%E2%80%94%E9%83%A8%E7%BD%B2%E7%AF%87.md
)
#### 常见问题及解决
...
...
dlink-admin/src/main/java/com/dlink/controller/DocumentController.java
View file @
8d8ebc6f
...
...
@@ -7,12 +7,7 @@ import com.dlink.service.DocumentService;
import
com.fasterxml.jackson.databind.JsonNode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -81,4 +76,12 @@ public class DocumentController {
document
=
documentService
.
getById
(
document
.
getId
());
return
Result
.
succeed
(
document
,
"获取成功"
);
}
/**
* 根据版本号获取自动补全内容
*/
@GetMapping
(
"/getFillAllByVersion"
)
public
Result
getFillAllByVersion
(
@RequestParam
String
version
)
{
return
Result
.
succeed
(
documentService
.
getFillAllByVersion
(
version
),
"获取成功"
);
}
}
dlink-admin/src/main/java/com/dlink/model/Document.java
View file @
8d8ebc6f
...
...
@@ -22,5 +22,6 @@ public class Document extends SuperEntity {
private
String
subtype
;
private
String
description
;
private
String
version
;
private
String
fillValue
;
private
String
likeNum
;
}
dlink-admin/src/main/java/com/dlink/service/DocumentService.java
View file @
8d8ebc6f
...
...
@@ -3,6 +3,8 @@ package com.dlink.service;
import
com.dlink.db.service.ISuperService
;
import
com.dlink.model.Document
;
import
java.util.List
;
/**
* DocumentService
*
...
...
@@ -10,4 +12,5 @@ import com.dlink.model.Document;
* @since 2021/6/3 14:35
**/
public
interface
DocumentService
extends
ISuperService
<
Document
>
{
List
<
Document
>
getFillAllByVersion
(
String
version
);
}
dlink-admin/src/main/java/com/dlink/service/impl/DocumentServiceImpl.java
View file @
8d8ebc6f
package
com
.
dlink
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.mapper.DocumentMapper
;
import
com.dlink.model.Document
;
import
com.dlink.service.DocumentService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* DocumentServiceImpl
*
...
...
@@ -15,4 +18,8 @@ import org.springframework.stereotype.Service;
@Service
public
class
DocumentServiceImpl
extends
SuperServiceImpl
<
DocumentMapper
,
Document
>
implements
DocumentService
{
@Override
public
List
<
Document
>
getFillAllByVersion
(
String
version
)
{
return
baseMapper
.
selectList
(
new
QueryWrapper
<
Document
>().
eq
(
"version"
,
version
).
eq
(
"enabled"
,
1
));
}
}
dlink-admin/src/main/resources/mapper/DocumentMapper.xml
View file @
8d8ebc6f
...
...
@@ -10,6 +10,7 @@
<result
column=
"type"
property=
"type"
/>
<result
column=
"subtype"
property=
"subtype"
/>
<result
column=
"description"
property=
"description"
/>
<result
column=
"fill_value"
property=
"fillValue"
/>
<result
column=
"version"
property=
"version"
/>
<result
column=
"like_num"
property=
"likeNum"
/>
<result
column=
"enabled"
property=
"enabled"
/>
...
...
@@ -19,7 +20,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, name, category, type,subtype,description, version,like_num, enabled, create_time, update_time
id, name, category, type,subtype,description, version,
fill_value,
like_num, enabled, create_time, update_time
</sql>
...
...
dlink-doc/sql/dlink.sql
View file @
8d8ebc6f
...
...
@@ -361,4 +361,11 @@ CREATE TABLE `dlink_database` (
ALTER
TABLE
`dlink`
.
`dlink_cluster`
ADD
COLUMN
`version`
varchar
(
20
)
NULL
COMMENT
'版本'
AFTER
`job_manager_host`
;
ALTER
TABLE
`dlink`
.
`dlink_flink_document`
ADD
COLUMN
`fill_value`
varchar
(
255
)
NULL
COMMENT
'填充值'
AFTER
`description`
;
update
dlink_flink_document
set
fill_value
=
name
;
update
dlink_flink_document
set
category
=
'Function'
where
category
=
'function'
;
SET
FOREIGN_KEY_CHECKS
=
1
;
dlink-web/src/components/Studio/StudioEdit/index.tsx
View file @
8d8ebc6f
...
...
@@ -7,6 +7,8 @@ import styles from './index.less';
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
DocumentStateType
}
from
"@/pages/Document/model"
;
import
{
DocumentTableListItem
}
from
"@/pages/Document/data"
;
let
provider
=
{
dispose
:
()
=>
{},
...
...
@@ -37,6 +39,7 @@ const FlinkSqlEditor = (props:any) => {
renderSideBySide
:
false
,
},
tabs
,
fillDocuments
,
dispatch
,
}
=
props
;
...
...
@@ -135,14 +138,24 @@ const FlinkSqlEditor = (props:any) => {
});
});
}
Completion
.
forEach
((
item
:
CompletionItem
)
=>
{
suggestions
.
push
(
{
label
:
item
.
label
,
kind
:
item
.
kind
,
insertText
:
item
.
insertText
,
insertTextRules
:
item
.
insertTextRules
,
detail
:
item
.
detail
fillDocuments
.
forEach
((
item
:
DocumentTableListItem
)
=>
{
if
(
monaco
.
languages
.
CompletionItemKind
[
item
.
category
])
{
suggestions
.
push
({
label
:
item
.
name
,
kind
:
monaco
.
languages
.
CompletionItemKind
[
item
.
category
],
insertText
:
item
.
fillValue
,
insertTextRules
:
monaco
.
languages
.
CompletionItemInsertTextRule
.
InsertAsSnippet
,
detail
:
item
.
description
});
}
else
{
suggestions
.
push
({
label
:
item
.
name
,
kind
:
monaco
.
languages
.
CompletionItemKind
.
Text
,
insertText
:
item
.
fillValue
,
insertTextRules
:
monaco
.
languages
.
CompletionItemInsertTextRule
.
InsertAsSnippet
,
detail
:
item
.
description
});
}
});
return
{
suggestions
,
...
...
@@ -171,9 +184,10 @@ return (
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
,
Document
}:
{
Studio
:
StateType
,
Document
:
Document
StateType
})
=>
({
current
:
Studio
.
current
,
sql
:
Studio
.
sql
,
tabs
:
Studio
.
tabs
,
monaco
:
Studio
.
monaco
,
fillDocuments
:
Document
.
fillDocuments
,
}))(
FlinkSqlEditor
);
dlink-web/src/components/Studio/StudioEvent/DDL.ts
View file @
8d8ebc6f
...
...
@@ -131,3 +131,13 @@ export function showFlinkJobs(clusterId:number) {
export
function
cancelJob
(
clusterId
:
number
,
jobId
:
string
)
{
return
getData
(
'api/studio/cancel'
,{
clusterId
:
clusterId
,
jobId
:
jobId
});
}
/*--- 根据版本号获取所有自动补全的文档 ---*/
export
function
getFillAllByVersion
(
version
:
string
,
dispatch
:
any
)
{
const
res
=
getData
(
'api/document/getFillAllByVersion'
,{
version
:
version
});
res
.
then
((
result
)
=>
{
result
.
datas
&&
dispatch
&&
dispatch
({
type
:
"Document/saveAllFillDocuments"
,
payload
:
result
.
datas
,
});
});
}
dlink-web/src/components/Studio/index.tsx
View file @
8d8ebc6f
...
...
@@ -11,7 +11,7 @@ import {StateType} from "@/pages/FlinkSqlStudio/model";
import
StudioConsole
from
"./StudioConsole"
;
import
StudioLeftTool
from
"./StudioLeftTool"
;
import
StudioRightTool
from
"./StudioRightTool"
;
import
{
listSession
,
showCluster
,
showDataBase
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
listSession
,
showCluster
,
showDataBase
,
getFillAllByVersion
}
from
"@/components/Studio/StudioEvent/DDL"
;
type
StudioProps
=
{
rightClickMenu
:
StateType
[
'rightClickMenu'
];
...
...
@@ -22,7 +22,7 @@ const Studio: React.FC<StudioProps> = (props) => {
const
{
rightClickMenu
,
dispatch
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
getFillAllByVersion
(
'1.12'
,
dispatch
);
showCluster
(
dispatch
);
showDataBase
(
dispatch
);
listSession
(
dispatch
);
...
...
dlink-web/src/locales/zh-CN/pages.ts
View file @
8d8ebc6f
...
...
@@ -29,7 +29,7 @@ export default {
'pages.welcome.link'
:
'欢迎加入'
,
'pages.welcome.star'
:
'欢迎 Star '
,
'pages.welcome.advancedLayout'
:
'Github'
,
'pages.welcome.alertMessage'
:
'实时计算平台 Dlink & Apache Flink 即将发布,目前为体验版,版本号为 0.3.
1
。'
,
'pages.welcome.alertMessage'
:
'实时计算平台 Dlink & Apache Flink 即将发布,目前为体验版,版本号为 0.3.
2
。'
,
'pages.admin.subPage.title'
:
' 这个页面只有 admin 权限才能查看'
,
'pages.admin.subPage.alertMessage'
:
'umi ui 现已发布,欢迎使用 npm run ui 启动体验。'
,
'pages.searchTable.createForm.newRule'
:
'新建规则'
,
...
...
dlink-web/src/pages/Document/components/UpdateForm.tsx
View file @
8d8ebc6f
...
...
@@ -27,6 +27,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
type
:
props
.
values
.
type
,
subtype
:
props
.
values
.
subtype
,
description
:
props
.
values
.
description
,
fillValue
:
props
.
values
.
fillValue
,
version
:
props
.
values
.
version
,
likeNum
:
props
.
values
.
likeNum
,
enabled
:
props
.
values
.
enabled
,
...
...
@@ -101,6 +102,12 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
label=
"描述"
>
<
TextArea
placeholder=
""
allowClear
autoSize=
{
{
minRows
:
3
,
maxRows
:
10
}
}
/>
</
FormItem
>
<
FormItem
name=
"fillValue"
label=
"填充值"
>
<
TextArea
placeholder=
""
allowClear
autoSize=
{
{
minRows
:
3
,
maxRows
:
10
}
}
/>
</
FormItem
>
<
FormItem
name=
"version"
...
...
@@ -150,6 +157,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
type
:
formVals
.
type
,
subtype
:
formVals
.
subtype
,
description
:
formVals
.
description
,
fillValue
:
formVals
.
fillValue
,
version
:
formVals
.
version
,
likeNum
:
formVals
.
likeNum
,
enabled
:
formVals
.
enabled
,
...
...
dlink-web/src/pages/Document/data.d.ts
View file @
8d8ebc6f
...
...
@@ -5,6 +5,7 @@ export type DocumentTableListItem = {
type
:
string
,
subtype
:
string
,
description
:
string
,
fillValue
:
string
,
version
:
string
,
likeNum
:
number
,
enabled
:
boolean
,
...
...
dlink-web/src/pages/Document/index.tsx
View file @
8d8ebc6f
...
...
@@ -103,7 +103,34 @@ const DocumentTableList: React.FC<{}> = () => {
],
filterMultiple
:
false
,
valueEnum
:
{
'function'
:
{
text
:
'函数'
},
'Method'
:
{
text
:
'Method'
},
'Function'
:
{
text
:
'Function'
},
'Constructor'
:
{
text
:
'Constructor'
},
'Field'
:
{
text
:
'Field'
},
'Variable'
:
{
text
:
'Variable'
},
'Class'
:
{
text
:
'Class'
},
'Struct'
:
{
text
:
'Struct'
},
'Interface'
:
{
text
:
'Interface'
},
'Module'
:
{
text
:
'Module'
},
'Property'
:
{
text
:
'Property'
},
'Event'
:
{
text
:
'Event'
},
'Operator'
:
{
text
:
'Operator'
},
'Unit'
:
{
text
:
'Unit'
},
'Value'
:
{
text
:
'Value'
},
'Constant'
:
{
text
:
'Constant'
},
'Enum'
:
{
text
:
'Enum'
},
'EnumMember'
:
{
text
:
'EnumMember'
},
'Keyword'
:
{
text
:
'Keyword'
},
'Text'
:
{
text
:
'Text'
},
'Color'
:
{
text
:
'Color'
},
'File'
:
{
text
:
'File'
},
'Reference'
:
{
text
:
'Reference'
},
'Customcolor'
:
{
text
:
'Customcolor'
},
'Folder'
:
{
text
:
'Folder'
},
'TypeParameter'
:
{
text
:
'TypeParameter'
},
'User'
:
{
text
:
'User'
},
'Issue'
:
{
text
:
'Issue'
},
'Snippet'
:
{
text
:
'Snippet'
},
},
},
{
...
...
@@ -113,7 +140,7 @@ const DocumentTableList: React.FC<{}> = () => {
hideInForm
:
false
,
hideInSearch
:
true
,
hideInTable
:
false
,
filters
:
[
/*
filters: [
{
text: '内置函数',
value: '内置函数',
...
...
@@ -127,7 +154,7 @@ const DocumentTableList: React.FC<{}> = () => {
valueEnum: {
'内置函数': { text: '内置函数'},
'UDF': { text: 'UDF'},
},
},
*/
},
{
title
:
'子类型'
,
...
...
@@ -136,7 +163,7 @@ const DocumentTableList: React.FC<{}> = () => {
hideInForm
:
false
,
hideInSearch
:
true
,
hideInTable
:
false
,
filters
:
[
/*
filters: [
{
text: '比较函数',
value: '比较函数',
...
...
@@ -206,7 +233,7 @@ const DocumentTableList: React.FC<{}> = () => {
'列函数': { text: '列函数'},
'表值聚合函数': { text: '表值聚合函数'},
'其他函数': { text: '其他函数'},
},
},
*/
},
{
title
:
'描述'
,
...
...
@@ -216,6 +243,14 @@ const DocumentTableList: React.FC<{}> = () => {
hideInForm
:
false
,
hideInSearch
:
false
,
hideInTable
:
true
,
},{
title
:
'填充值'
,
sorter
:
true
,
dataIndex
:
'fillValue'
,
valueType
:
'textarea'
,
hideInForm
:
false
,
hideInSearch
:
true
,
hideInTable
:
true
,
},
{
title
:
'版本'
,
...
...
dlink-web/src/pages/Document/model.ts
0 → 100644
View file @
8d8ebc6f
import
{
Effect
,
Reducer
}
from
"umi"
;
import
{
DocumentTableListItem
}
from
"@/pages/Document/data"
;
export
type
DocumentStateType
=
{
fillDocuments
:
DocumentTableListItem
[],
};
export
type
ModelType
=
{
namespace
:
string
;
state
:
DocumentStateType
;
effects
:
{
};
reducers
:
{
saveAllFillDocuments
:
Reducer
<
DocumentStateType
>
;
};
};
const
DocumentModel
:
ModelType
=
{
namespace
:
'Document'
,
state
:
{
fillDocuments
:[],
},
effects
:
{
},
reducers
:
{
saveAllFillDocuments
(
state
,
{
payload
})
{
return
{
...
state
,
fillDocuments
:
payload
,
};
},
},
};
export
default
DocumentModel
;
dlink-web/src/pages/Welcome.tsx
View file @
8d8ebc6f
...
...
@@ -304,6 +304,16 @@ export default (): React.ReactNode => {
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
<
Timeline
.
Item
><
Text
code
>
0.3.2
</
Text
>
<
Text
type=
"secondary"
>
2021-09-?
</
Text
>
<
p
>
</
p
>
<
Paragraph
>
<
ul
>
<
li
>
<
Link
>
新增了SQL编辑器自动补全文档的功能
</
Link
>
</
li
>
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
</
Timeline
>
</
Card
>
</
PageContainer
>
...
...
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