Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
7f8134e2
Unverified
Commit
7f8134e2
authored
Aug 07, 2023
by
ZackYoung
Committed by
GitHub
Aug 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature][Web]add_footer (#2172)
* add_footer * add_footer * spotless * spotless * spotless
parent
dc7f1bf3
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
360 additions
and
23 deletions
+360
-23
SseController.java
...min/src/main/java/org/dinky/controller/SseController.java
+9
-1
MonitorService.java
...admin/src/main/java/org/dinky/service/MonitorService.java
+2
-0
MonitorServiceImpl.java
.../main/java/org/dinky/service/impl/MonitorServiceImpl.java
+21
-0
index.tsx
dinky-web/src/components/CustomEditor/CodeShow/index.tsx
+21
-0
global.less
dinky-web/src/global.less
+3
-0
menu.ts
dinky-web/src/locales/en-US/menu.ts
+2
-0
pages.ts
dinky-web/src/locales/en-US/pages.ts
+8
-0
menu.ts
dinky-web/src/locales/zh-CN/menu.ts
+2
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+6
-0
index.tsx
...eb/src/pages/DataStudio/BottomContainer/Console/index.tsx
+1
-2
index.tsx
dinky-web/src/pages/DataStudio/FooterContainer/index.tsx
+104
-0
index.tsx
...eb/src/pages/DataStudio/HeaderContainer/Explain/index.tsx
+1
-1
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+2
-2
index.tsx
.../pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
+2
-2
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
+2
-0
index.tsx
...web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
+66
-5
index.tsx
...src/pages/DataStudio/MiddleContainer/QuickGuide/index.tsx
+0
-0
index.tsx
...b/src/pages/DataStudio/RightContainer/JobConfig/index.tsx
+0
-0
function.ts
dinky-web/src/pages/DataStudio/function.ts
+12
-0
index.tsx
dinky-web/src/pages/DataStudio/index.tsx
+14
-1
model.ts
dinky-web/src/pages/DataStudio/model.ts
+55
-3
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+27
-6
No files found.
dinky-admin/src/main/java/org/dinky/controller/SseController.java
View file @
7f8134e2
...
@@ -37,7 +37,7 @@ import cn.hutool.core.lang.Opt;
...
@@ -37,7 +37,7 @@ import cn.hutool.core.lang.Opt;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
@RestController
@RestController
@RequestMapping
(
"/sse"
)
@RequestMapping
(
"/
api/
sse"
)
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
SseController
{
public
class
SseController
{
private
final
MonitorService
monitorService
;
private
final
MonitorService
monitorService
;
...
@@ -50,4 +50,12 @@ public class SseController {
...
@@ -50,4 +50,12 @@ public class SseController {
return
monitorService
.
sendLatestData
(
return
monitorService
.
sendLatestData
(
emitter
,
DateUtil
.
date
(
Opt
.
ofNullable
(
lastTime
).
orElse
(
DateUtil
.
date
().
getTime
())));
emitter
,
DateUtil
.
date
(
Opt
.
ofNullable
(
lastTime
).
orElse
(
DateUtil
.
date
().
getTime
())));
}
}
@GetMapping
(
value
=
"/getJvmInfo"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@CrossOrigin
(
"*"
)
@PublicInterface
public
SseEmitter
getJvmInfo
(
Long
lastTime
)
{
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
return
monitorService
.
sendJvmInfo
(
emitter
);
}
}
}
dinky-admin/src/main/java/org/dinky/service/MonitorService.java
View file @
7f8134e2
...
@@ -36,6 +36,8 @@ public interface MonitorService extends IService<Metrics> {
...
@@ -36,6 +36,8 @@ public interface MonitorService extends IService<Metrics> {
SseEmitter
sendLatestData
(
SseEmitter
sseEmitter
,
Date
lastDate
);
SseEmitter
sendLatestData
(
SseEmitter
sseEmitter
,
Date
lastDate
);
SseEmitter
sendJvmInfo
(
SseEmitter
sseEmitter
);
void
saveFlinkMetricLayout
(
List
<
MetricsLayoutDTO
>
metricsList
);
void
saveFlinkMetricLayout
(
List
<
MetricsLayoutDTO
>
metricsList
);
Map
<
String
,
List
<
Metrics
>>
getMetricsLayout
();
Map
<
String
,
List
<
Metrics
>>
getMetricsLayout
();
...
...
dinky-admin/src/main/java/org/dinky/service/impl/MonitorServiceImpl.java
View file @
7f8134e2
...
@@ -21,6 +21,7 @@ package org.dinky.service.impl;
...
@@ -21,6 +21,7 @@ package org.dinky.service.impl;
import
org.dinky.configure.MetricConfig
;
import
org.dinky.configure.MetricConfig
;
import
org.dinky.data.dto.MetricsLayoutDTO
;
import
org.dinky.data.dto.MetricsLayoutDTO
;
import
org.dinky.data.metrics.Jvm
;
import
org.dinky.data.model.Metrics
;
import
org.dinky.data.model.Metrics
;
import
org.dinky.data.vo.MetricsVO
;
import
org.dinky.data.vo.MetricsVO
;
import
org.dinky.mapper.MetricsMapper
;
import
org.dinky.mapper.MetricsMapper
;
...
@@ -55,6 +56,7 @@ import cn.hutool.core.collection.CollUtil;
...
@@ -55,6 +56,7 @@ import cn.hutool.core.collection.CollUtil;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.core.thread.ThreadUtil
;
import
cn.hutool.core.thread.ThreadUtil
;
import
cn.hutool.json.JSONUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
@Service
@Service
...
@@ -116,6 +118,25 @@ public class MonitorServiceImpl extends ServiceImpl<MetricsMapper, Metrics>
...
@@ -116,6 +118,25 @@ public class MonitorServiceImpl extends ServiceImpl<MetricsMapper, Metrics>
return
sseEmitter
;
return
sseEmitter
;
}
}
@Override
public
SseEmitter
sendJvmInfo
(
SseEmitter
sseEmitter
)
{
scheduleRefreshMonitorDataExecutor
.
execute
(
()
->
{
try
{
while
(
true
)
{
sseEmitter
.
send
(
JSONUtil
.
toJsonStr
(
Jvm
.
of
()));
ThreadUtil
.
sleep
(
10000
);
}
}
catch
(
IOException
e
)
{
sseEmitter
.
complete
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
sseEmitter
.
complete
();
}
});
return
sseEmitter
;
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveFlinkMetricLayout
(
List
<
MetricsLayoutDTO
>
metricsList
)
{
public
void
saveFlinkMetricLayout
(
List
<
MetricsLayoutDTO
>
metricsList
)
{
...
...
dinky-web/src/components/CustomEditor/CodeShow/index.tsx
View file @
7f8134e2
...
@@ -213,6 +213,7 @@ const CodeShow = (props: CodeShowFormProps) => {
...
@@ -213,6 +213,7 @@ const CodeShow = (props: CodeShowFormProps) => {
language=
{
language
}
language=
{
language
}
options=
{
{
options=
{
{
...
options
,
...
options
,
scrollBeyondLastLine
:
false
,
readOnly
:
true
,
readOnly
:
true
,
wordWrap
:
autoWrap
,
wordWrap
:
autoWrap
,
autoDetectHighContrast
:
true
,
autoDetectHighContrast
:
true
,
...
@@ -220,7 +221,27 @@ const CodeShow = (props: CodeShowFormProps) => {
...
@@ -220,7 +221,27 @@ const CodeShow = (props: CodeShowFormProps) => {
fixedOverflowWidgets
:
true
,
fixedOverflowWidgets
:
true
,
autoClosingDelete
:
"always"
,
autoClosingDelete
:
"always"
,
lineNumbers
,
lineNumbers
,
scrollbar
:
{
// Subtle shadows to the left & top. Defaults to true.
useShadows
:
false
,
// Render vertical arrows. Defaults to false.
// verticalHasArrows: true,
// Render horizontal arrows. Defaults to false.
// horizontalHasArrows: true,
// Render vertical scrollbar.
// Accepted values: 'auto', 'visible', 'hidden'.
// Defaults to 'auto'
vertical
:
"visible"
,
// Render horizontal scrollbar.
// Accepted values: 'auto', 'visible', 'hidden'.
// Defaults to 'auto'
horizontal
:
"visible"
,
verticalScrollbarSize
:
8
,
horizontalScrollbarSize
:
8
,
arrowSize
:
30
,
}
}
}
}
}
onMount=
{
editorDidMount
}
onMount=
{
editorDidMount
}
theme=
{
theme
?
theme
:
convertCodeEditTheme
()
}
theme=
{
theme
?
theme
:
convertCodeEditTheme
()
}
...
...
dinky-web/src/global.less
View file @
7f8134e2
...
@@ -119,6 +119,9 @@ body,
...
@@ -119,6 +119,9 @@ body,
::-webkit-scrollbar-corner {
::-webkit-scrollbar-corner {
background-color: #f5f5f5;
background-color: #f5f5f5;
}
}
.monaco-scrollable-element > .scrollbar > .slider {
background: #8db7fd !important;
}
// scrollbar style --- end ----
// scrollbar style --- end ----
...
...
dinky-web/src/locales/en-US/menu.ts
View file @
7f8134e2
...
@@ -87,4 +87,6 @@ export default {
...
@@ -87,4 +87,6 @@ export default {
'menu.datastudio.process'
:
'Process'
,
'menu.datastudio.process'
:
'Process'
,
'menu.datastudio.history'
:
'History'
,
'menu.datastudio.history'
:
'History'
,
'menu.datastudio.table-data'
:
'Table Data'
,
'menu.datastudio.table-data'
:
'Table Data'
,
'menu.datastudio.tool.text-comparison'
:
'Text Comparison'
,
};
};
dinky-web/src/locales/en-US/pages.ts
View file @
7f8134e2
...
@@ -967,4 +967,12 @@ export default {
...
@@ -967,4 +967,12 @@ export default {
'pages.datastudio.explain.validate.grammar.error'
:
'Grammar Error'
,
'pages.datastudio.explain.validate.grammar.error'
:
'Grammar Error'
,
'pages.datastudio.explain.validate.logic.right'
:
'Logical Right'
,
'pages.datastudio.explain.validate.logic.right'
:
'Logical Right'
,
'pages.datastudio.explain.validate.logic.error'
:
'Logical Error'
,
'pages.datastudio.explain.validate.logic.error'
:
'Logical Error'
,
// footer
'pages.datastudio.footer.memDetails'
:
"Maximum heap size: {max}
\
nUsed: {used}M"
,
'pages.datastudio.footer.codeType'
:
"Code Type: "
,
'pages.datastudio.footer.lineSeparator'
:
"Line Separator: "
,
'pages.datastudio.footer.codeEncoding'
:
"File Encoding: "
,
'pages.datastudio.footer.codePosition'
:
"Ln {Ln}:Col {Col} "
,
};
};
dinky-web/src/locales/zh-CN/menu.ts
View file @
7f8134e2
...
@@ -86,4 +86,6 @@ export default {
...
@@ -86,4 +86,6 @@ export default {
'menu.datastudio.process'
:
'进程'
,
'menu.datastudio.process'
:
'进程'
,
'menu.datastudio.history'
:
'历史'
,
'menu.datastudio.history'
:
'历史'
,
'menu.datastudio.table-data'
:
'表数据'
,
'menu.datastudio.table-data'
:
'表数据'
,
'menu.datastudio.tool.text-comparison'
:
'文本比对'
,
};
};
dinky-web/src/locales/zh-CN/pages.ts
View file @
7f8134e2
...
@@ -981,4 +981,10 @@ export default {
...
@@ -981,4 +981,10 @@ export default {
'pages.datastudio.explain.validate.grammar.error'
:
'语法有误'
,
'pages.datastudio.explain.validate.grammar.error'
:
'语法有误'
,
'pages.datastudio.explain.validate.logic.right'
:
'逻辑正确'
,
'pages.datastudio.explain.validate.logic.right'
:
'逻辑正确'
,
'pages.datastudio.explain.validate.logic.error'
:
'逻辑有误'
,
'pages.datastudio.explain.validate.logic.error'
:
'逻辑有误'
,
'pages.datastudio.footer.memDetails'
:
"最大堆大小:{max}
\
n已使用: {used}M"
,
'pages.datastudio.footer.codeType'
:
"代码类型:"
,
'pages.datastudio.footer.lineSeparator'
:
"行分隔符:"
,
'pages.datastudio.footer.codeEncoding'
:
"文件编码:"
,
'pages.datastudio.footer.codePosition'
:
"行{Ln}:列{Col} "
,
};
};
dinky-web/src/pages/DataStudio/BottomContainer/Console/index.tsx
View file @
7f8134e2
...
@@ -9,8 +9,7 @@ const Console: React.FC= (props:any) => {
...
@@ -9,8 +9,7 @@ const Console: React.FC= (props:any) => {
},[])
},[])
return
<
CodeShow
code=
{
props
.
console
}
height=
{
(
props
.
height
-
53
)
}
theme=
{
"vs-dark"
}
language=
{
"kotlin"
}
/>
return
<
CodeShow
code=
{
props
.
console
}
height=
{
(
props
.
height
-
53
)
}
language=
{
"kotlin"
}
lineNumbers=
{
"off"
}
/>
// return <MonacoEditor width={"100%"} height={props.height-53} theme={"dark"} value={props.console} />
};
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
...
...
dinky-web/src/pages/DataStudio/FooterContainer/index.tsx
0 → 100644
View file @
7f8134e2
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
StateType
,
TabsPageType
,
VIEW
}
from
"@/pages/DataStudio/model"
;
import
{
Button
,
GlobalToken
,
Space
}
from
"antd"
;
import
{
connect
}
from
"@@/exports"
;
import
{
getCurrentTab
}
from
"@/pages/DataStudio/function"
;
import
{
getSseData
}
from
"@/services/api"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
l
}
from
"@/utils/intl"
;
export
type
FooterContainerProps
=
{
token
:
GlobalToken
}
type
ButtonRoute
=
{
text
:
React
.
ReactNode
,
title
:
string
,
onClick
?:
()
=>
void
,
isShow
?:
(
type
?:
TabsPageType
,
subType
?:
string
,
data
?:
any
)
=>
boolean
;
}
const
FooterContainer
:
React
.
FC
<
FooterContainerProps
&
StateType
>
=
(
props
)
=>
{
const
{
footContainer
,
token
,
tabs
}
=
props
;
const
eventSource
=
getSseData
(
"/api/sse/getJvmInfo"
);
const
[
memDetails
,
setMemDetails
]
=
useState
(
footContainer
.
memDetails
);
useEffect
(()
=>
{
eventSource
.
onmessage
=
(
event
)
=>
{
const
data
=
JSON
.
parse
(
event
.
data
);
setMemDetails
(
Number
(
data
[
"heapUsed"
]
/
1024
/
1024
).
toFixed
(
0
)
+
"/"
+
Number
(
data
[
"total"
]
/
1024
/
1024
).
toFixed
(
0
)
+
"M"
)
}
return
()
=>
{
eventSource
.
close
()
}
},
[])
const
currentTab
=
getCurrentTab
(
tabs
.
panes
,
tabs
.
activeKey
);
const
route
:
ButtonRoute
[]
=
[
{
text
:
<
span
style=
{
{
backgroundColor
:
token
.
colorBgBase
}
}
>
{
memDetails
}
</
span
>,
title
:
l
(
"pages.datastudio.footer.memDetails"
,
""
,
{
max
:
memDetails
.
split
(
"/"
)[
1
],
used
:
memDetails
.
split
(
"/"
)[
0
]
}),
isShow
:
()
=>
true
},
{
text
:
footContainer
.
codeType
,
title
:
l
(
"pages.datastudio.footer.codeType"
)
+
footContainer
.
codeType
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
footContainer
.
lineSeparator
,
title
:
l
(
"pages.datastudio.footer.lineSeparator"
)
+
footContainer
.
lineSeparator
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
footContainer
.
codeEncoding
,
title
:
l
(
"pages.datastudio.footer.codeEncoding"
)
+
footContainer
.
codeEncoding
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
"Space: "
+
footContainer
.
space
,
title
:
"Space: "
+
footContainer
.
space
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
footContainer
.
codePosition
[
0
]
+
":"
+
footContainer
.
codePosition
[
1
],
title
:
l
(
"pages.datastudio.footer.codePosition"
,
""
,
{
Ln
:
footContainer
.
codePosition
[
0
],
Col
:
footContainer
.
codePosition
[
1
]
}),
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
]
return
(
<
div
style=
{
{
backgroundColor
:
token
.
colorFill
,
height
:
VIEW
.
footerHeight
,
width
:
"100%"
,
display
:
"flex"
,
paddingInline
:
10
}
}
>
<
Space
style=
{
{
direction
:
"ltr"
,
width
:
"50%"
}
}
>
<
Button
size=
{
"small"
}
type=
{
"text"
}
block
style=
{
{
paddingInline
:
4
}
}
>
Welcome to Dinky !
</
Button
>
</
Space
>
<
Space
style=
{
{
direction
:
"rtl"
,
width
:
"50%"
}
}
size=
{
4
}
direction=
{
"horizontal"
}
>
{
route
.
filter
(
x
=>
{
if
(
x
.
isShow
)
{
return
x
.
isShow
(
currentTab
?.
type
,
currentTab
?.
subType
,
currentTab
?.
params
);
}
return
false
})
.
map
((
item
,
index
)
=>
{
return
<
Button
size=
{
"small"
}
type=
{
"text"
}
block
style=
{
{
paddingInline
:
4
}
}
key=
{
index
}
onClick=
{
item
.
onClick
}
title=
{
item
.
title
}
>
{
item
.
text
}
</
Button
>
})
}
</
Space
>
</
div
>
)
}
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
footContainer
:
Studio
.
footContainer
,
tabs
:
Studio
.
tabs
}))(
FooterContainer
);
dinky-web/src/pages/DataStudio/HeaderContainer/Explain/index.tsx
View file @
7f8134e2
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
{
Modal
,
Space
,
Tag
,
Typography
,}
from
'antd'
;
import
{
Space
,
Tag
,
Typography
,}
from
'antd'
;
import
{
ConsoleSqlOutlined
}
from
"@ant-design/icons"
;
import
{
ConsoleSqlOutlined
}
from
"@ant-design/icons"
;
import
ProList
from
'@ant-design/pro-list'
;
import
ProList
from
'@ant-design/pro-list'
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
...
...
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
7f8134e2
...
@@ -44,8 +44,8 @@ import {ErrorNotification, WarningMessage} from "@/utils/messages";
...
@@ -44,8 +44,8 @@ import {ErrorNotification, WarningMessage} from "@/utils/messages";
const
headerStyle
:
React
.
CSSProperties
=
{
const
headerStyle
:
React
.
CSSProperties
=
{
display
:
"inline-flex"
,
display
:
"inline-flex"
,
lineHeight
:
'32
px'
,
lineHeight
:
VIEW
.
headerHeight
+
'
px'
,
height
:
"32px"
,
height
:
VIEW
.
headerHeight
,
fontStyle
:
"normal"
,
fontStyle
:
"normal"
,
fontWeight
:
"bold"
,
fontWeight
:
"bold"
,
fontSize
:
"16px"
,
fontSize
:
"16px"
,
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
View file @
7f8134e2
...
@@ -84,12 +84,12 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
...
@@ -84,12 +84,12 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
return
<>
return
<>
<
Search
style=
{
{
margin
Bottom
:
8
}
}
placeholder=
"Search"
onChange=
{
onChangeSearch
}
allowClear=
{
true
}
/>
<
Search
style=
{
{
margin
:
"8px 0px"
}
}
placeholder=
"Search"
onChange=
{
onChangeSearch
}
allowClear=
{
true
}
/>
{
{
(
treeData
.
length
>
0
)
?
(
treeData
.
length
>
0
)
?
<
DirectoryTree
<
DirectoryTree
style=
{
{...
style
,
height
:
height
-
40
}
}
style=
{
{...
style
,
height
:
height
-
40
-
16
,
overflowY
:
'auto'
}
}
// className=
{'
treeList
'}
// className=
{'
treeList
'}
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
expandedKeys=
{
expandedKeys
}
expandedKeys=
{
expandedKeys
}
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
View file @
7f8134e2
...
@@ -37,6 +37,8 @@ const Project: React.FC = (props: connect) => {
...
@@ -37,6 +37,8 @@ const Project: React.FC = (props: connect) => {
// const queryParams =
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
// const queryParams =
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
getTaskDetails
(
taskId
).
then
(
res
=>
{
getTaskDetails
(
taskId
).
then
(
res
=>
{
path
.
pop
()
path
.
pop
()
res
[
'useResult'
]
=
true
res
[
'maxRowNum'
]
=
100
dispatch
({
dispatch
({
type
:
"Studio/addTab"
,
type
:
"Studio/addTab"
,
payload
:
{
payload
:
{
...
...
dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
View file @
7f8134e2
...
@@ -3,11 +3,16 @@ import CodeEdit from "@/components/CustomEditor/CodeEdit";
...
@@ -3,11 +3,16 @@ import CodeEdit from "@/components/CustomEditor/CodeEdit";
import
{
connect
}
from
"@@/exports"
;
import
{
connect
}
from
"@@/exports"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
getCurrentData
}
from
"@/pages/DataStudio/function"
;
import
{
getCurrentData
}
from
"@/pages/DataStudio/function"
;
import
{
convertCodeEditTheme
}
from
"@/utils/function"
;
import
{
editor
}
from
"monaco-editor"
;
import
{
Editor
}
from
"@monaco-editor/react"
;
export
type
EditorProps
=
{
export
type
EditorProps
=
{
statement
:
string
statement
:
string
}
}
const
Editor
:
React
.
FC
<
EditorProps
&
any
>
=
(
props
)
=>
{
const
{
ScrollType
}
=
editor
;
const
CodeEditor
:
React
.
FC
<
EditorProps
&
any
>
=
(
props
)
=>
{
const
{
const
{
statement
,
statement
,
tabs
:
{
panes
,
activeKey
},
tabs
:
{
panes
,
activeKey
},
...
@@ -15,21 +20,77 @@ const Editor: React.FC<EditorProps & any > = (props) => {
...
@@ -15,21 +20,77 @@ const Editor: React.FC<EditorProps & any > = (props) => {
}
=
props
}
=
props
const
current
=
getCurrentData
(
panes
,
activeKey
);
const
current
=
getCurrentData
(
panes
,
activeKey
);
return
<>
return
<>
<
CodeEdit
code=
{
statement
}
language=
{
"sql"
}
<
Editor
width=
{
"100%"
}
height=
{
"100%"
}
value=
{
statement
}
language=
{
"sql"
}
options=
{
{
scrollBeyondLastLine
:
false
,
wordWrap
:
"on"
,
autoDetectHighContrast
:
true
,
scrollbar
:
{
// Subtle shadows to the left & top. Defaults to true.
useShadows
:
false
,
// Render vertical arrows. Defaults to false.
// verticalHasArrows: true,
// Render horizontal arrows. Defaults to false.
// horizontalHasArrows: true,
// Render vertical scrollbar.
// Accepted values: 'auto', 'visible', 'hidden'.
// Defaults to 'auto'
vertical
:
"visible"
,
// Render horizontal scrollbar.
// Accepted values: 'auto', 'visible', 'hidden'.
// Defaults to 'auto'
horizontal
:
"visible"
,
verticalScrollbarSize
:
8
,
horizontalScrollbarSize
:
8
,
arrowSize
:
30
,
}
}
}
className=
{
"editor-develop"
}
onMount=
{
(
editor
:
editor
.
IStandaloneCodeEditor
)
=>
{
editor
.
layout
();
editor
.
focus
();
editor
.
onDidChangeCursorPosition
((
e
)
=>
{
props
.
footContainer
.
codePosition
=
[
e
.
position
.
lineNumber
,
e
.
position
.
column
]
dispatch
({
type
:
"Studio/saveFooterValue"
,
payload
:
{...
props
.
footContainer
},
});
});
}
}
onChange=
{
(
v
,
d
)
=>
{
onChange=
{
(
v
,
d
)
=>
{
current
.
statement
=
v
;
current
.
statement
=
v
;
dispatch
({
dispatch
({
type
:
"Studio/saveTabs"
,
type
:
"Studio/saveTabs"
,
payload
:
{...
props
.
tabs
},
payload
:
{...
props
.
tabs
},
});
});
}
}
}
}
theme=
{
"vs-dark"
}
/>
/>
{
/*<CodeEdit code={statement} language={"sql"}*/
}
{
/* onChange={(v,d) => {*/
}
{
/* current.statement = v;*/
}
{
/* dispatch({*/
}
{
/* type: "Studio/saveTabs",*/
}
{
/* payload: {...props.tabs},*/
}
{
/* });*/
}
{
/* }}*/
}
{
/*/>*/
}
</>
</>
};
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
tabs
:
Studio
.
tabs
tabs
:
Studio
.
tabs
,
}))(
Editor
);
footContainer
:
Studio
.
footContainer
}))(
CodeEditor
);
dinky-web/src/pages/DataStudio/MiddleContainer/QuickGuide/index.tsx
View file @
7f8134e2
dinky-web/src/pages/DataStudio/RightContainer/JobConfig/index.tsx
View file @
7f8134e2
dinky-web/src/pages/DataStudio/function.ts
View file @
7f8134e2
...
@@ -97,3 +97,15 @@ export const getCurrentTab = (panes: any, activeKey: string) => {
...
@@ -97,3 +97,15 @@ export const getCurrentTab = (panes: any, activeKey: string) => {
}
}
export
const
getFooterValue
=
(
panes
:
any
,
activeKey
:
string
)
=>
{
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
);
let
footerValue
:
object
=
{};
if
(
currentTab
&&
currentTab
.
type
===
"project"
)
{
footerValue
=
{
codePosition
:
[
1
,
1
],
codeType
:
(
currentTab
.
params
as
DataStudioParams
).
taskData
.
dialect
,
}
}
return
footerValue
}
dinky-web/src/pages/DataStudio/index.tsx
View file @
7f8134e2
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
{
Layout
,
Menu
,
Modal
,
theme
}
from
'antd'
;
import
{
Button
,
Layout
,
Menu
,
Modal
,
Progress
,
Space
,
theme
}
from
'antd'
;
import
{
connect
,
getDvaApp
}
from
"umi"
;
import
{
connect
,
getDvaApp
}
from
"umi"
;
import
React
,
{
Fragment
,
useCallback
,
useEffect
,
useState
}
from
"react"
;
import
React
,
{
Fragment
,
useCallback
,
useEffect
,
useState
}
from
"react"
;
import
{
DataStudioParams
,
StateType
,
TabsItemType
,
TabsPageType
,
VIEW
}
from
"@/pages/DataStudio/model"
;
import
{
DataStudioParams
,
StateType
,
TabsItemType
,
TabsPageType
,
VIEW
}
from
"@/pages/DataStudio/model"
;
...
@@ -37,10 +37,19 @@ import {
...
@@ -37,10 +37,19 @@ import {
getSessionData
getSessionData
}
from
"@/pages/DataStudio/RightContainer/JobConfig/service"
;
}
from
"@/pages/DataStudio/RightContainer/JobConfig/service"
;
import
*
as
monaco
from
"monaco-editor"
;
import
*
as
monaco
from
"monaco-editor"
;
import
{
Footer
}
from
"antd/es/layout/layout"
;
import
FooterContainer
from
"@/pages/DataStudio/FooterContainer"
;
const
{
Sider
,
Content
}
=
Layout
;
const
{
Sider
,
Content
}
=
Layout
;
const
{
useToken
}
=
theme
;
const
{
useToken
}
=
theme
;
const
format
=
(
percent
?:
number
,
successPercent
?:
number
)
=>
(
<
div
style=
{
{
position
:
'relative'
,
height
:
'100%'
}
}
>
<
div
style=
{
{
position
:
'absolute'
,
top
:
'50%'
,
left
:
'50%'
,
transform
:
'translate(-50%, -50%)'
}
}
>
{
`${percent}%`
}
</
div
>
</
div
>
);
const
DataStudio
=
(
props
:
any
)
=>
{
const
DataStudio
=
(
props
:
any
)
=>
{
const
{
const
{
bottomContainer
,
bottomContainer
,
...
@@ -276,7 +285,11 @@ const DataStudio = (props: any) => {
...
@@ -276,7 +285,11 @@ const DataStudio = (props: any) => {
/>
/>
</
Sider
>
</
Sider
>
</
Layout
>
</
Layout
>
{
/* 页脚 */
}
{
<
FooterContainer
token=
{
token
}
/>
}
</
div
>
</
div
>
</
Fragment
>
</
Fragment
>
</
PersistGate
>
</
PersistGate
>
);
);
...
...
dinky-web/src/pages/DataStudio/model.ts
View file @
7f8134e2
...
@@ -3,6 +3,7 @@ import React from "react";
...
@@ -3,6 +3,7 @@ import React from "react";
import
{
DataSources
}
from
"@/types/RegCenter/data"
;
import
{
DataSources
}
from
"@/types/RegCenter/data"
;
import
{
QueryParams
}
from
"@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data"
;
import
{
QueryParams
}
from
"@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
getCurrentTab
,
getFooterValue
}
from
"@/pages/DataStudio/function"
;
/**
/**
* 初始化布局宽高度
* 初始化布局宽高度
...
@@ -20,7 +21,7 @@ export const VIEW = {
...
@@ -20,7 +21,7 @@ export const VIEW = {
rightMargin
:
32
,
rightMargin
:
32
,
leftMargin
:
36
,
leftMargin
:
36
,
midMargin
:
44
,
midMargin
:
44
,
otherHeight
:
1
0
,
otherHeight
:
1
,
paddingInline
:
50
,
paddingInline
:
50
,
};
};
...
@@ -198,6 +199,14 @@ export type ClusterType = {
...
@@ -198,6 +199,14 @@ export type ClusterType = {
createTime
:
Date
,
createTime
:
Date
,
updateTime
:
Date
,
updateTime
:
Date
,
}
}
type
FooterType
=
{
codePosition
:
[
number
,
number
],
space
:
number
,
codeEncoding
:
string
,
lineSeparator
:
string
,
codeType
:
string
,
memDetails
:
string
,
}
export
type
StateType
=
{
export
type
StateType
=
{
isFullScreen
:
boolean
;
isFullScreen
:
boolean
;
toolContentHeight
:
number
;
toolContentHeight
:
number
;
...
@@ -222,6 +231,7 @@ export type StateType = {
...
@@ -222,6 +231,7 @@ export type StateType = {
env
:
EnvType
[];
env
:
EnvType
[];
tabs
:
TabsType
;
tabs
:
TabsType
;
bottomContainerContent
:
BottomContainerContent
;
bottomContainerContent
:
BottomContainerContent
;
footContainer
:
FooterType
;
};
};
export
type
ModelType
=
{
export
type
ModelType
=
{
namespace
:
string
;
namespace
:
string
;
...
@@ -252,6 +262,7 @@ export type ModelType = {
...
@@ -252,6 +262,7 @@ export type ModelType = {
saveSession
:
Reducer
<
StateType
>
;
saveSession
:
Reducer
<
StateType
>
;
saveClusterConfiguration
:
Reducer
<
StateType
>
;
saveClusterConfiguration
:
Reducer
<
StateType
>
;
saveEnv
:
Reducer
<
StateType
>
;
saveEnv
:
Reducer
<
StateType
>
;
saveFooterValue
:
Reducer
<
StateType
>
;
};
};
};
};
const
Model
:
ModelType
=
{
const
Model
:
ModelType
=
{
...
@@ -301,6 +312,14 @@ const Model: ModelType = {
...
@@ -301,6 +312,14 @@ const Model: ModelType = {
sessionCluster
:
[],
sessionCluster
:
[],
clusterConfiguration
:
[],
clusterConfiguration
:
[],
env
:
[],
env
:
[],
footContainer
:
{
codePosition
:
[
1
,
1
],
space
:
2
,
codeEncoding
:
"UTF-8"
,
lineSeparator
:
"LF"
,
codeType
:
""
,
memDetails
:
"100/500M"
,
}
},
},
effects
:
{},
effects
:
{},
reducers
:
{
reducers
:
{
...
@@ -475,6 +494,7 @@ const Model: ModelType = {
...
@@ -475,6 +494,7 @@ const Model: ModelType = {
updateTabsActiveKey
(
state
,
{
payload
})
{
updateTabsActiveKey
(
state
,
{
payload
})
{
const
itemTypes
=
state
.
tabs
.
panes
.
filter
(
x
=>
x
.
key
===
payload
);
const
itemTypes
=
state
.
tabs
.
panes
.
filter
(
x
=>
x
.
key
===
payload
);
if
(
itemTypes
.
length
===
1
)
{
if
(
itemTypes
.
length
===
1
)
{
let
footerValue
:
object
=
getFooterValue
(
state
.
tabs
.
panes
,
payload
);
const
itemType
=
itemTypes
[
0
];
const
itemType
=
itemTypes
[
0
];
return
{
return
{
...
state
,
...
state
,
...
@@ -483,6 +503,10 @@ const Model: ModelType = {
...
@@ -483,6 +503,10 @@ const Model: ModelType = {
activeKey
:
payload
,
activeKey
:
payload
,
activeBreadcrumbTitle
:
[
itemType
.
type
,
itemType
.
breadcrumbLabel
,
itemType
.
label
].
join
(
"/"
)
activeBreadcrumbTitle
:
[
itemType
.
type
,
itemType
.
breadcrumbLabel
,
itemType
.
label
].
join
(
"/"
)
},
},
footContainer
:{
...
state
.
footContainer
,
...
footerValue
}
};
};
}
}
return
{
return
{
...
@@ -511,18 +535,25 @@ const Model: ModelType = {
...
@@ -511,18 +535,25 @@ const Model: ModelType = {
for
(
const
[
index
,
pane
]
of
panes
.
entries
())
{
for
(
const
[
index
,
pane
]
of
panes
.
entries
())
{
if
(
pane
.
key
===
needCloseKey
)
{
if
(
pane
.
key
===
needCloseKey
)
{
const
item
=
index
+
1
>=
panes
.
length
?
index
+
1
>
1
&&
index
+
1
===
panes
.
length
?
panes
[
index
-
1
]
:
panes
[
0
]
:
panes
[
index
+
1
];
const
item
=
index
+
1
>=
panes
.
length
?
index
+
1
>
1
&&
index
+
1
===
panes
.
length
?
panes
[
index
-
1
]
:
panes
[
0
]
:
panes
[
index
+
1
];
const
newPanes
=
panes
.
filter
(
pane
=>
pane
.
key
!==
needCloseKey
);
let
footerValue
:
object
=
getFooterValue
(
panes
,
item
.
key
);
return
{
return
{
...
state
,
...
state
,
tabs
:
{
tabs
:
{
panes
:
panes
.
filter
(
pane
=>
pane
.
key
!==
needCloseKey
)
,
panes
:
newPanes
,
activeKey
:
item
.
key
,
activeKey
:
item
.
key
,
activeBreadcrumbTitle
:
panes
.
length
<
2
?
""
:
[
item
.
type
,
item
.
breadcrumbLabel
,
item
.
label
].
join
(
"/"
),
activeBreadcrumbTitle
:
panes
.
length
<
2
?
""
:
[
item
.
type
,
item
.
breadcrumbLabel
,
item
.
label
].
join
(
"/"
),
},
},
footContainer
:
{
...
state
.
footContainer
,
...
footerValue
}
};
};
}
}
}
}
}
}
const
newPanes
=
panes
.
filter
(
pane
=>
pane
.
key
!==
needCloseKey
)
const
newPanes
=
panes
.
filter
(
pane
=>
pane
.
key
!==
needCloseKey
)
let
footerValue
:
object
=
getFooterValue
(
newPanes
,
activeKey
);
return
{
return
{
...
state
,
...
state
,
tabs
:
{
tabs
:
{
...
@@ -530,6 +561,10 @@ const Model: ModelType = {
...
@@ -530,6 +561,10 @@ const Model: ModelType = {
activeKey
:
activeKey
,
activeKey
:
activeKey
,
activeBreadcrumbTitle
:
state
.
tabs
.
activeBreadcrumbTitle
,
activeBreadcrumbTitle
:
state
.
tabs
.
activeBreadcrumbTitle
,
},
},
footContainer
:{
...
state
.
footContainer
,
...
footerValue
}
};
};
},
},
/**
/**
...
@@ -542,23 +577,34 @@ const Model: ModelType = {
...
@@ -542,23 +577,34 @@ const Model: ModelType = {
const
node
=
payload
as
TabsItemType
;
const
node
=
payload
as
TabsItemType
;
for
(
const
item
of
state
.
tabs
.
panes
)
{
for
(
const
item
of
state
.
tabs
.
panes
)
{
if
(
item
.
id
===
node
.
id
)
{
if
(
item
.
id
===
node
.
id
)
{
let
footerValue
:
object
=
getFooterValue
(
state
.
tabs
.
panes
,
item
.
key
);
return
{
return
{
...
state
,
...
state
,
tabs
:
{
tabs
:
{
...
state
.
tabs
,
...
state
.
tabs
,
activeKey
:
item
.
key
activeKey
:
item
.
key
},
footContainer
:{
...
state
.
footContainer
,
...
footerValue
}
}
};
};
}
}
}
}
node
.
key
=
state
.
tabs
.
panes
.
length
===
0
?
"0"
:
(
parseInt
(
state
.
tabs
.
panes
[
state
.
tabs
.
panes
.
length
-
1
].
key
)
+
1
).
toString
();
node
.
key
=
state
.
tabs
.
panes
.
length
===
0
?
"0"
:
(
parseInt
(
state
.
tabs
.
panes
[
state
.
tabs
.
panes
.
length
-
1
].
key
)
+
1
).
toString
();
const
panes
=
[...
state
.
tabs
.
panes
,
node
];
let
footerValue
:
object
=
getFooterValue
(
panes
,
node
.
key
);
return
{
return
{
...
state
,
...
state
,
tabs
:
{
tabs
:
{
panes
:
[...
state
.
tabs
.
panes
,
node
]
,
panes
:
panes
,
activeBreadcrumbTitle
:
[
node
.
type
,
node
.
breadcrumbLabel
,
node
.
label
].
join
(
"/"
),
activeBreadcrumbTitle
:
[
node
.
type
,
node
.
breadcrumbLabel
,
node
.
label
].
join
(
"/"
),
activeKey
:
node
.
key
,
activeKey
:
node
.
key
,
},
},
footContainer
:
{
...
state
.
footContainer
,
...
footerValue
}
}
}
},
},
...
@@ -660,6 +706,12 @@ const Model: ModelType = {
...
@@ -660,6 +706,12 @@ const Model: ModelType = {
...
state
,
...
state
,
clusterConfiguration
:
payload
,
clusterConfiguration
:
payload
,
}
}
},
saveFooterValue
(
state
,
{
payload
})
{
return
{
...
state
,
footContainer
:
payload
,
}
}
}
}
}
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
7f8134e2
...
@@ -49,6 +49,7 @@ import JobInfo from "@/pages/DataStudio/RightContainer/JobInfo";
...
@@ -49,6 +49,7 @@ import JobInfo from "@/pages/DataStudio/RightContainer/JobInfo";
import
{
l
}
from
"@/utils/intl"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
TabsPageType
}
from
"@/pages/DataStudio/model"
;
import
{
TabsPageType
}
from
"@/pages/DataStudio/model"
;
import
{
CircleButtonProps
}
from
"@/components/CallBackButton/CircleBtn"
;
import
{
CircleButtonProps
}
from
"@/components/CallBackButton/CircleBtn"
;
import
{
DiffEditor
}
from
"@monaco-editor/react"
;
export
const
LeftSide
=
[
export
const
LeftSide
=
[
{
{
...
@@ -155,10 +156,24 @@ export const LeftBottomSide = [
...
@@ -155,10 +156,24 @@ export const LeftBottomSide = [
export
const
LeftBottomMoreTabs
:{[
c
:
string
]:
TabProp
[]}
=
{
export
const
LeftBottomMoreTabs
:{[
c
:
string
]:
TabProp
[]}
=
{
'menu.datastudio.tool'
:[
'menu.datastudio.tool'
:[
{
{
key
:
'menu.datastudio.tool.
datax
'
,
key
:
'menu.datastudio.tool.
text-comparison
'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
(
'menu.datastudio.tool.datax'
),
label
:
l
(
'menu.datastudio.tool.text-comparison'
),
children
:
<
div
>
datax
</
div
>
children
:
<
DiffEditor
height=
{
"100%"
}
options=
{
{
readOnly
:
false
,
originalEditable
:
true
,
selectOnLineNumbers
:
true
,
lineDecorationsWidth
:
20
,
mouseWheelZoom
:
true
,
automaticLayout
:
true
,
scrollBeyondLastLine
:
false
,
scrollbar
:
{
useShadows
:
false
,
verticalScrollbarSize
:
8
,
horizontalScrollbarSize
:
8
,
arrowSize
:
30
,
}
}
}
language=
{
"text"
}
/>
},{
},{
key
:
'menu.datastudio.tool.datax2'
,
key
:
'menu.datastudio.tool.datax2'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
...
@@ -167,10 +182,16 @@ export const LeftBottomMoreTabs:{[c:string]:TabProp[]} = {
...
@@ -167,10 +182,16 @@ export const LeftBottomMoreTabs:{[c:string]:TabProp[]} = {
},
},
]
,
'menu.datastudio.tool2'
:[
]
,
'menu.datastudio.tool2'
:[
{
{
key
:
'menu.datastudio.tool.
datax
'
,
key
:
'menu.datastudio.tool.
text-comparison
'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
(
'menu.datastudio.tool.datax'
),
label
:
(
'menu.datastudio.tool.text-comparison'
),
children
:
<
div
>
datax
</
div
>
children
:
<
DiffEditor
height=
{
"95%"
}
options=
{
{
readOnly
:
true
,
selectOnLineNumbers
:
true
,
lineDecorationsWidth
:
20
,
mouseWheelZoom
:
true
,
automaticLayout
:
true
,
}
}
language=
{
"sql"
}
original=
{
""
}
modified=
{
""
}
/>
},{
},{
key
:
'menu.datastudio.tool.datax2'
,
key
:
'menu.datastudio.tool.datax2'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
...
...
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