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
7fc72f60
Unverified
Commit
7fc72f60
authored
Jul 06, 2022
by
xiaoguaiguai
Committed by
GitHub
Jul 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature-692][web] Add history version comparison in data development (#693)
* add DataDev's historyVersion diff * feat DataDev's historyVersion diff
parent
cf25986b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
12 deletions
+69
-12
data.d.ts
...components/Studio/StudioRightTool/StudioHistory/data.d.ts
+1
-0
index.tsx
...components/Studio/StudioRightTool/StudioHistory/index.tsx
+68
-12
No files found.
dlink-web/src/components/Studio/StudioRightTool/StudioHistory/data.d.ts
View file @
7fc72f60
export
type
TaskHistoryTableListItem
=
{
export
type
TaskHistoryTableListItem
=
{
id
:
number
,
id
:
number
,
versionId
:
number
,
versionId
:
number
,
statement
:
string
,
createTime
:
Date
,
createTime
:
Date
,
};
};
...
...
dlink-web/src/components/Studio/StudioRightTool/StudioHistory/index.tsx
View file @
7fc72f60
import
{
useRef
,
useState
}
from
"react"
;
import
React
,
{
useRef
,
useState
}
from
"react"
;
import
{
MinusSquareOutlined
}
from
'@ant-design/icons'
;
import
{
MinusSquareOutlined
,
RocketOutlined
,
SyncOutlined
}
from
'@ant-design/icons'
;
import
ProTable
,
{
ActionType
,
ProColumns
}
from
"@ant-design/pro-table"
;
import
ProTable
,
{
ActionType
,
ProColumns
}
from
"@ant-design/pro-table"
;
import
{
Button
,
Col
,
Drawer
,
Modal
,
Row
,
Space
,
Tooltip
}
from
'antd'
;
import
{
Button
,
Col
,
Drawer
,
Modal
,
Row
,
Tag
,
Tooltip
}
from
'antd'
;
import
ProDescriptions
from
'@ant-design/pro-descriptions'
;
import
ProDescriptions
from
'@ant-design/pro-descriptions'
;
import
{
queryData
,
handleOption
}
from
"@/components/Common/crud"
;
import
{
handleOption
,
queryData
}
from
"@/components/Common/crud"
;
import
{
import
{
Scrollbars
}
from
"react-custom-scrollbars"
;
TaskHistoryTableListItem
import
{
TaskHistoryTableListItem
}
from
"@/components/Studio/StudioRightTool/StudioHistory/data"
;
}
from
"@/components/Studio/StudioRightTool/StudioHistory/data"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
import
moment
from
"moment"
;
import
{
MonacoDiffEditor
}
from
"react-monaco-editor"
;
const
url
=
'/api/task/version'
;
const
url
=
'/api/task/version'
;
const
StudioHistory
=
(
props
:
any
)
=>
{
const
StudioHistory
=
(
props
:
any
)
=>
{
const
{
current
,
toolHeight
,
dispatch
}
=
props
;
const
{
current
,
toolHeight
}
=
props
;
const
[
row
,
setRow
]
=
useState
<
TaskHistoryTableListItem
>
();
const
[
row
,
setRow
]
=
useState
<
TaskHistoryTableListItem
>
();
const
actionRef
=
useRef
<
ActionType
>
();
const
actionRef
=
useRef
<
ActionType
>
();
const
[
versionDiffVisible
,
setVersionDiffVisible
]
=
useState
<
boolean
>
(
false
);
const
[
versionDiffRow
,
setVersionDiffRow
]
=
useState
<
TaskHistoryTableListItem
>
();
if
(
current
.
key
)
{
if
(
current
.
key
)
{
actionRef
.
current
?.
reloadAndRest
?.();
actionRef
.
current
?.
reloadAndRest
?.();
}
}
const
cancelHandle
=
()
=>
{
setVersionDiffVisible
(
false
);
}
const
VersionDiffForm
=
()
=>
{
let
leftTitle
=
"Version:【"
+
versionDiffRow
?.
versionId
+
"】 创建时间: 【"
+
(
moment
(
versionDiffRow
?.
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
))
+
"】"
;
let
rightTitle
=
"Version:【当前编辑版本】 创建时间: 【"
+
(
moment
(
current
?.
task
?.
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
))
+
"】 最后更新时间: 【"
+
(
moment
(
current
?.
task
?.
updateTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
))
+
"】"
let
originalValue
=
versionDiffRow
?.
statement
;
let
currentValue
=
current
?.
task
?.
statement
;
return
(
<>
<
Modal
title=
{
"Version Diff"
}
visible=
{
versionDiffVisible
}
destroyOnClose=
{
true
}
width=
{
"85%"
}
bodyStyle=
{
{
height
:
"700px"
}
}
onCancel=
{
()
=>
{
cancelHandle
();
}
}
footer=
{
[
<
Button
key=
"back"
onClick=
{
()
=>
{
cancelHandle
();
}
}
>
关闭
</
Button
>,
]
}
>
<
div
style=
{
{
display
:
"flex"
,
flexDirection
:
"row"
,
justifyContent
:
"space-between"
}
}
>
<
Tag
color=
"green"
style=
{
{
height
:
"20px"
}
}
>
<
RocketOutlined
/>
{
leftTitle
}
</
Tag
>
<
Tag
color=
"blue"
style=
{
{
height
:
"20px"
}
}
>
<
SyncOutlined
spin
/>
{
rightTitle
}
</
Tag
>
</
div
><
br
/>
<
Scrollbars
style=
{
{
height
:
"98%"
}
}
>
<
React
.
StrictMode
>
<
MonacoDiffEditor
language=
{
"sql"
}
theme=
{
"vs-dark"
}
original=
{
originalValue
}
value=
{
currentValue
}
/>
</
React
.
StrictMode
>
</
Scrollbars
>
</
Modal
>
</>
)
}
const
columns
:
ProColumns
<
TaskHistoryTableListItem
>
[]
=
[
const
columns
:
ProColumns
<
TaskHistoryTableListItem
>
[]
=
[
// {
// {
// title: 'id',
// title: 'id',
...
@@ -51,9 +101,14 @@ const StudioHistory = (props: any) => {
...
@@ -51,9 +101,14 @@ const StudioHistory = (props: any) => {
valueType
:
'option'
,
valueType
:
'option'
,
align
:
"center"
,
align
:
"center"
,
render
:
(
text
,
record
,
index
)
=>
(
render
:
(
text
,
record
,
index
)
=>
(
<
Space
size=
"middle"
>
<>
<
Button
type=
"link"
onClick=
{
()
=>
onRollBackVersion
(
record
)
}
>
回滚
</
Button
>
<
Button
type=
"link"
onClick=
{
()
=>
onRollBackVersion
(
record
)
}
>
回滚
</
Button
>
</
Space
>
<
Button
type=
"link"
title=
{
"只和当前编辑器内的内容对比"
}
onClick=
{
()
=>
{
setVersionDiffRow
(
record
)
setVersionDiffVisible
(
true
)
}
}
>
版本对比
</
Button
>
</>
)
)
},
},
];
];
...
@@ -62,7 +117,7 @@ const StudioHistory = (props: any) => {
...
@@ -62,7 +117,7 @@ const StudioHistory = (props: any) => {
const
onRollBackVersion
=
(
row
:
TaskHistoryTableListItem
)
=>
{
const
onRollBackVersion
=
(
row
:
TaskHistoryTableListItem
)
=>
{
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'回滚Flink SQL版本'
,
title
:
'回滚Flink SQL版本'
,
content
:
`确定回滚Flink SQL版本至【
${
row
.
versionId
===
""
?
row
.
versionId
:
row
.
versionId
}
】吗?`
,
content
:
`确定回滚Flink SQL版本至【
${
row
.
versionId
}
】吗?`
,
okText
:
'确认'
,
okText
:
'确认'
,
cancelText
:
'取消'
,
cancelText
:
'取消'
,
onOk
:
async
()
=>
{
onOk
:
async
()
=>
{
...
@@ -120,6 +175,7 @@ const StudioHistory = (props: any) => {
...
@@ -120,6 +175,7 @@ const StudioHistory = (props: any) => {
)
}
)
}
</
Drawer
>
</
Drawer
>
</
Scrollbars
>
</
Scrollbars
>
{
VersionDiffForm
()
}
</>
</>
);
);
};
};
...
...
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