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
d89485df
Unverified
Commit
d89485df
authored
Oct 30, 2023
by
aiwenmo
Committed by
GitHub
Oct 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimization-2460][studio] Optimize task preview result (#2461)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
d72dd525
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
22 additions
and
73 deletions
+22
-73
DebugDTO.java
dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java
+0
-7
Job2MysqlHandler.java
...y-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java
+2
-1
TaskServiceImpl.java
...src/main/java/org/dinky/service/impl/TaskServiceImpl.java
+2
-6
VariableManager.java
...tor/src/main/java/org/dinky/executor/VariableManager.java
+0
-8
pages.ts
dinky-web/src/locales/en-US/pages.ts
+0
-3
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+0
-2
index.tsx
...web/src/pages/DataStudio/BottomContainer/Result/index.tsx
+7
-7
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+1
-0
index.tsx
.../pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
+4
-3
function.tsx
...b/src/pages/DataStudio/LeftContainer/Project/function.tsx
+1
-21
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
+3
-1
index.tsx
...ataStudio/RightContainer/ExecuteConfig/FlinkSql/index.tsx
+2
-12
model.ts
dinky-web/src/pages/DataStudio/model.ts
+0
-2
No files found.
dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java
View file @
d89485df
...
...
@@ -39,13 +39,6 @@ public class DebugDTO {
notes
=
"The ID of Task which is debugged"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"Use Result"
,
dataType
=
"boolean"
,
example
=
"true"
,
notes
=
"Flag indicating whether to preview table result"
)
private
boolean
useResult
=
true
;
@ApiModelProperty
(
value
=
"Use ChangeLog"
,
dataType
=
"boolean"
,
...
...
dinky-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java
View file @
d89485df
...
...
@@ -145,7 +145,8 @@ public class Job2MysqlHandler implements JobHandler {
clusterId
=
clusterInstance
.
getId
();
}
}
else
if
(
GatewayType
.
LOCAL
.
equalsValue
(
job
.
getJobConfig
().
getType
())
&&
Asserts
.
isNotNullString
(
job
.
getJobManagerAddress
()))
{
&&
Asserts
.
isNotNullString
(
job
.
getJobManagerAddress
())
&&
Asserts
.
isNotNullString
(
job
.
getJobId
()))
{
clusterInstance
=
clusterInstanceService
.
registersCluster
(
ClusterInstanceDTO
.
autoRegistersClusterDTO
(
job
.
getJobManagerAddress
(),
job
.
getJobId
(),
...
...
dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java
View file @
d89485df
...
...
@@ -266,8 +266,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
// 注解自调用会失效,这里通过获取对象方法绕过此限制
TaskServiceImpl
taskServiceBean
=
applicationContext
.
getBean
(
TaskServiceImpl
.
class
);
taskServiceBean
.
preCheckTask
(
taskDTO
);
JobResult
jobResult
=
taskServiceBean
.
executeJob
(
taskDTO
);
if
(
Job
.
JobStatus
.
SUCCESS
==
jobResult
.
getStatus
())
{
...
...
@@ -288,16 +286,14 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
initTenantByTaskId
(
debugDTO
.
getId
());
TaskDTO
taskDTO
=
this
.
getTaskInfoById
(
debugDTO
.
getId
());
taskDTO
.
setUseResult
(
debugDTO
.
isUseResult
());
// Debug mode need return result
taskDTO
.
setUseResult
(
true
);
taskDTO
.
setUseChangeLog
(
debugDTO
.
isUseChangeLog
());
taskDTO
.
setUseAutoCancel
(
debugDTO
.
isUseAutoCancel
());
taskDTO
.
setMaxRowNum
(
debugDTO
.
getMaxRowNum
());
// 注解自调用会失效,这里通过获取对象方法绕过此限制
TaskServiceImpl
taskServiceBean
=
applicationContext
.
getBean
(
TaskServiceImpl
.
class
);
taskServiceBean
.
preCheckTask
(
taskDTO
);
JobResult
jobResult
=
taskServiceBean
.
executeJob
(
taskDTO
);
if
(
Job
.
JobStatus
.
SUCCESS
==
jobResult
.
getStatus
())
{
log
.
info
(
"Job debug success"
);
Task
task
=
new
Task
(
debugDTO
.
getId
(),
jobResult
.
getJobInstanceId
());
...
...
dinky-executor/src/main/java/org/dinky/executor/VariableManager.java
View file @
d89485df
...
...
@@ -53,7 +53,6 @@ import cn.hutool.extra.expression.engine.jexl.JexlEngine;
* @since 2021/6/7 22:06
*/
public
final
class
VariableManager
{
public
static
final
String
VARIABLE
=
"variable"
;
static
final
String
SHOW_VARIABLES
=
"SHOW VARIABLES"
;
private
final
Map
<
String
,
String
>
variables
;
...
...
@@ -92,17 +91,10 @@ public final class VariableManager {
*
* @param variableName name under which to register the given sql variable
* @param variable a variable of sql to register
* @throws CatalogException if the registration of the sql variable under the given name failed.
* But at the moment, with CatalogException, not SqlException
*/
public
void
registerVariable
(
String
variableName
,
String
variable
)
{
checkArgument
(!
StringUtils
.
isNullOrWhitespaceOnly
(
variableName
),
"sql variable name cannot be null or empty."
);
checkNotNull
(
variable
,
"sql variable cannot be null"
);
if
(
variables
.
containsKey
(
variableName
))
{
throw
new
CatalogException
(
format
(
"The variable of sql %s already exists."
,
variableName
));
}
variables
.
put
(
variableName
,
variable
);
}
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
d89485df
...
...
@@ -361,9 +361,6 @@ export default {
'pages.datastudio.label.execConfig.selectDatabase.tip'
:
'Select the database to be used'
,
'pages.datastudio.label.execConfig.maxrow'
:
'Maximum number of rows'
,
'pages.datastudio.label.execConfig.maxrow.tip'
:
'The maximum number of rows of preview data'
,
'pages.datastudio.label.execConfig.preview.result'
:
'Preview Result'
,
'pages.datastudio.label.execConfig.preview.result.tip'
:
'Open the preview result, it will run synchronously and return the data result'
,
'pages.datastudio.label.jobConfig'
:
'Job Config'
,
'pages.datastudio.label.jobConfig.addConfig'
:
'Add Config item'
,
'pages.datastudio.label.jobConfig.addConfig.params'
:
'parameters'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
d89485df
...
...
@@ -349,8 +349,6 @@ export default {
'pages.datastudio.label.execConfig.selectDatabase.tip'
:
'选择 Sql 语句执行的数据源'
,
'pages.datastudio.label.execConfig.maxrow'
:
'最大行数'
,
'pages.datastudio.label.execConfig.maxrow.tip'
:
'预览数据的最大行数'
,
'pages.datastudio.label.execConfig.preview.result'
:
'预览结果'
,
'pages.datastudio.label.execConfig.preview.result.tip'
:
'开启预览结果,将同步运行并返回数据结果'
,
'pages.datastudio.label.jobConfig'
:
'作业配置'
,
'pages.datastudio.label.jobConfig.addConfig'
:
'添加配置项'
,
'pages.datastudio.label.jobConfig.addConfig.params'
:
'参数'
,
...
...
dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx
View file @
d89485df
...
...
@@ -126,8 +126,9 @@ const Result = (props: any) => {
}
const
params
=
currentTabs
.
params
;
if
(
params
.
resultData
&&
!
isRefresh
)
{
setData
(
params
.
resultData
);
const
consoleData
=
currentTabs
.
console
;
if
(
consoleData
.
result
&&
!
isRefresh
)
{
setData
(
consoleData
.
result
);
}
else
{
if
(
isSql
(
current
.
dialect
))
{
// common sql
...
...
@@ -135,13 +136,12 @@ const Result = (props: any) => {
taskId
:
params
.
taskId
});
if
(
res
.
datas
)
{
params
.
resultData
=
res
.
datas
;
consoleData
.
result
=
res
.
datas
;
setData
(
res
.
datas
);
}
}
else
{
// flink sql
// to do: get job data by history id list, not flink jid
console
.
log
(
current
);
if
(
current
.
id
)
{
const
res
=
await
handleGetOptionWithoutMsg
(
API_CONSTANTS
.
GET_LATEST_HISTORY_BY_ID
,
{
id
:
current
.
id
...
...
@@ -154,10 +154,10 @@ const Result = (props: any) => {
});
const
datas
=
tableData
.
datas
;
if
(
datas
.
success
)
{
params
.
resultData
=
datas
;
consoleData
.
result
=
datas
;
setData
(
datas
);
}
else
{
params
.
resultData
=
{};
consoleData
.
result
=
{};
setData
({});
}
}
...
...
@@ -170,7 +170,7 @@ const Result = (props: any) => {
useEffect
(()
=>
{
setData
({});
loadData
();
},
[
currentTabs
]);
},
[
currentTabs
,
currentTabs
?.
console
.
result
]);
const
getColumns
=
(
columns
:
string
[])
=>
{
return
columns
?.
map
((
item
)
=>
{
...
...
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
d89485df
...
...
@@ -152,6 +152,7 @@ const HeaderContainer = (props: any) => {
});
messageApi
.
success
(
l
(
'pages.datastudio.editor.debug.success'
));
currentData
.
status
=
JOB_STATUS
.
RUNNING
;
if
(
currentTab
)
currentTab
.
console
.
result
=
res
.
datas
.
result
;
saveTabs
({
...
props
.
tabs
});
};
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
View file @
d89485df
...
...
@@ -43,6 +43,7 @@ type TreeProps = {
onRightClick
:
(
info
:
any
)
=>
void
;
style
?:
React
.
CSSProperties
;
selectedKeys
:
Key
[];
selectKeyChange
:
(
keys
:
Key
[])
=>
void
;
};
const
JobTree
:
React
.
FC
<
TreeProps
&
connect
>
=
(
props
)
=>
{
...
...
@@ -52,7 +53,8 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
style
,
height
,
onRightClick
,
selectedKeys
:
selectedKey
selectKeyChange
,
selectedKeys
}
=
props
;
const
[
searchValue
,
setSearchValueValue
]
=
useState
(
''
);
...
...
@@ -64,7 +66,6 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
<
Key
[]
>
();
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
true
);
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
(
selectedKey
);
const
onChangeSearch
=
(
e
:
any
)
=>
{
let
{
value
}
=
e
.
target
;
if
(
!
value
)
{
...
...
@@ -110,7 +111,7 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
.
filter
((
item
:
any
,
i
:
number
,
self
:
any
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
setExpandedKeys
(
expandedKeys
);
setAutoExpandParent
(
true
);
se
tSelectedKeys
([
treeKey
]);
se
lectKeyChange
([
treeKey
])
}
};
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx
View file @
d89485df
...
...
@@ -83,25 +83,6 @@ export const buildProjectTree = (
const
currentPath
=
path
?
[...
path
,
item
.
name
]
:
[
item
.
name
];
// 构造生命周期的值
const
stepValue
=
buildStepValue
(
item
.
task
?.
step
);
// 渲染生命周期的徽标
const
renderStepBadge
=
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
(
<>
<
Badge
.
Ribbon
style=
{
{
top
:
-
14
,
left
:
-
57
,
width
:
'56px'
,
height
:
'18px'
,
fontSize
:
'6px'
,
lineHeight
:
'18px'
}
}
key=
{
item
.
id
}
placement=
{
'start'
}
text=
{
stepValue
.
title
}
color=
{
stepValue
.
color
}
/>
</>
);
// 渲染生命周期的 标记点
const
renderPreFixState
=
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
(
<>
...
...
@@ -116,7 +97,6 @@ export const buildProjectTree = (
const
renderTitle
=
(
<>
<
Space
align=
{
'baseline'
}
size=
{
2
}
>
{
renderStepBadge
}
{
searchTreeNode
(
item
.
name
,
searchValue
)
}
</
Space
>
</>
...
...
@@ -138,7 +118,7 @@ export const buildProjectTree = (
type
:
item
.
type
,
title
:
(
<>
{
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
<>
{
'
\
u00A0'
.
repeat
(
16
)
}
</>
}
{
renderTitle
}
{
item
.
isLeaf
&&
showBadge
(
item
.
type
)
&&
<>
{
'
\
u00A0'
.
repeat
(
2
)
}
</>
}
{
renderTitle
}
</>
),
fullInfo
:
item
,
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
View file @
d89485df
...
...
@@ -39,7 +39,7 @@ import { ProjectState } from '@/types/Studio/state.d';
import
{
l
}
from
'@/utils/intl'
;
import
{
Modal
,
Typography
}
from
'antd'
;
import
{
MenuInfo
}
from
'rc-menu/es/interface'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
Key
,
useEffect
,
useState
}
from
'react'
;
import
{
connect
}
from
'umi'
;
const
{
Text
}
=
Typography
;
...
...
@@ -120,6 +120,7 @@ const Project: React.FC = (props: connect) => {
taskId
:
taskId
},
type
:
'project'
,
console
:
{},
subType
:
type
}
});
...
...
@@ -353,6 +354,7 @@ const Project: React.FC = (props: connect) => {
return
(
<
div
style=
{
{
paddingInline
:
5
}
}
>
<
JobTree
selectKeyChange=
{
(
keys
:
Key
[])
=>
setProjectState
((
prevState
)
=>
({
...
prevState
,
selectedKeys
:
keys
}))
}
selectedKeys=
{
projectState
.
selectedKeys
}
onRightClick=
{
handleRightClick
}
onNodeClick=
{
(
info
:
any
)
=>
onNodeClick
(
info
)
}
...
...
dinky-web/src/pages/DataStudio/RightContainer/ExecuteConfig/FlinkSql/index.tsx
View file @
d89485df
...
...
@@ -63,16 +63,6 @@ const ExecuteConfigFlinkSql = (props: any) => {
onValuesChange=
{
onValuesChange
}
>
<
ProFormGroup
>
<
ProFormSwitch
label=
{
l
(
'pages.datastudio.label.execConfig.preview.result'
)
}
name=
'useResult'
tooltip=
{
{
title
:
l
(
'pages.datastudio.label.execConfig.preview.result.tip'
),
icon
:
<
InfoCircleOutlined
/>
}
}
{
...
SWITCH_OPTIONS
()}
/>
<
ProFormSwitch
label=
{
l
(
'pages.datastudio.label.execConfig.changelog'
)
}
name=
'useChangeLog'
...
...
@@ -82,8 +72,6 @@ const ExecuteConfigFlinkSql = (props: any) => {
}
}
{
...
SWITCH_OPTIONS
()}
/>
</
ProFormGroup
>
<
ProFormGroup
>
<
ProFormSwitch
label=
{
l
(
'pages.datastudio.label.execConfig.autostop'
)
}
name=
'useAutoCancel'
...
...
@@ -93,6 +81,8 @@ const ExecuteConfigFlinkSql = (props: any) => {
}
}
{
...
SWITCH_OPTIONS
()}
/>
</
ProFormGroup
>
<
ProFormGroup
>
<
ProFormDigit
width=
{
'xs'
}
label=
{
l
(
'pages.datastudio.label.execConfig.maxrow'
)
}
...
...
dinky-web/src/pages/DataStudio/model.ts
View file @
d89485df
...
...
@@ -101,7 +101,6 @@ export type TaskType = {
session
:
string
;
maxRowNum
:
number
;
jobName
:
string
;
useResult
:
boolean
;
useChangeLog
:
boolean
;
useAutoCancel
:
boolean
;
};
...
...
@@ -133,7 +132,6 @@ export type TaskDataType = TaskDataBaseType & Record<string, any>;
export
type
DataStudioParams
=
{
taskId
:
number
;
taskData
:
TaskDataType
;
resultData
:
Record
<
string
,
any
>
;
};
export
enum
TabsPageType
{
...
...
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