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
89c35c9e
Unverified
Commit
89c35c9e
authored
Dec 17, 2023
by
ZackYoung
Committed by
GitHub
Dec 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize_table_data (#2674)
parent
9b4bd242
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
163 additions
and
129 deletions
+163
-129
SystemInit.java
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
+1
-1
JobInstanceServiceImpl.java
...n/java/org/dinky/service/impl/JobInstanceServiceImpl.java
+8
-6
RunTimeUtil.java
dinky-common/src/main/java/org/dinky/utils/RunTimeUtil.java
+3
-2
ProjectClient.java
...c/main/java/org/dinky/scheduler/client/ProjectClient.java
+20
-8
CircleBtn.tsx
dinky-web/src/components/CallBackButton/CircleBtn.tsx
+33
-24
index.tsx
.../src/pages/DataStudio/BottomContainer/TableData/index.tsx
+56
-88
index.tsx
dinky-web/src/pages/DataStudio/BottomContainer/index.tsx
+0
-0
TabRoute.tsx
dinky-web/src/pages/DataStudio/TabRoute.tsx
+42
-0
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+0
-0
No files found.
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
View file @
89c35c9e
...
...
@@ -247,7 +247,7 @@ public class SystemInit implements ApplicationRunner {
}
try
{
project
=
projectClient
.
getDinkyProject
();
if
(
Asserts
.
isNull
(
project
)
)
{
if
(
project
==
null
)
{
project
=
projectClient
.
createDinkyProject
();
}
}
catch
(
Exception
e
)
{
...
...
dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java
View file @
89c35c9e
...
...
@@ -160,12 +160,14 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
jobInfoDetail
.
setClusterInstance
(
clusterInstance
);
History
history
=
historyService
.
getById
(
jobInstance
.
getHistoryId
());
history
.
setConfigJson
(
history
.
getConfigJson
());
jobInfoDetail
.
setHistory
(
history
);
if
(
Asserts
.
isNotNull
(
history
.
getClusterConfigurationId
()))
{
ClusterConfiguration
clusterConfig
=
clusterConfigurationService
.
getClusterConfigById
(
history
.
getClusterConfigurationId
());
jobInfoDetail
.
setClusterConfiguration
(
ClusterConfigurationDTO
.
fromBean
(
clusterConfig
));
if
(
history
!=
null
)
{
history
.
setConfigJson
(
history
.
getConfigJson
());
jobInfoDetail
.
setHistory
(
history
);
if
(
Asserts
.
isNotNull
(
history
.
getClusterConfigurationId
()))
{
ClusterConfiguration
clusterConfig
=
clusterConfigurationService
.
getClusterConfigById
(
history
.
getClusterConfigurationId
());
jobInfoDetail
.
setClusterConfiguration
(
ClusterConfigurationDTO
.
fromBean
(
clusterConfig
));
}
}
JobDataDto
jobDataDto
=
jobHistoryService
.
getJobHistoryDto
(
jobInstance
.
getId
());
...
...
dinky-common/src/main/java/org/dinky/utils/RunTimeUtil.java
View file @
89c35c9e
...
...
@@ -39,6 +39,7 @@ public class RunTimeUtil {
obj
=
null
;
System
.
gc
();
}
/**
* 处理命令,多行命令原样返回,单行命令拆分处理
*
...
...
@@ -47,14 +48,14 @@ public class RunTimeUtil {
*/
public
static
String
[]
handleCmds
(
String
...
cmds
)
{
if
(
ArrayUtil
.
isEmpty
(
cmds
))
{
throw
new
NullPointerException
(
"Command is empty !"
)
;
return
new
String
[]
{}
;
}
// 单条命令的情况
if
(
1
==
cmds
.
length
)
{
final
String
cmd
=
cmds
[
0
];
if
(
StrUtil
.
isBlank
(
cmd
))
{
throw
new
NullPointerException
(
"Command is blank !"
)
;
return
new
String
[]
{}
;
}
cmds
=
cmdSplit
(
cmd
);
}
...
...
dinky-scheduler/src/main/java/org/dinky/scheduler/client/ProjectClient.java
View file @
89c35c9e
...
...
@@ -35,8 +35,11 @@ import org.springframework.stereotype.Component;
import
cn.hutool.core.lang.TypeReference
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
/** 项目 */
/**
* 项目
*/
@Component
public
class
ProjectClient
{
...
...
@@ -55,8 +58,7 @@ public class ProjectClient {
.
getDolphinschedulerProjectName
()
.
getValue
());
map
.
put
(
"description"
,
"自动创建"
);
String
content
=
HttpRequest
.
post
(
SystemConfiguration
.
getInstances
()
HttpResponse
httpResponse
=
HttpRequest
.
post
(
SystemConfiguration
.
getInstances
()
.
getDolphinschedulerUrl
()
.
getValue
()
+
"/projects"
)
...
...
@@ -67,8 +69,13 @@ public class ProjectClient {
.
getValue
())
.
form
(
map
)
.
timeout
(
5000
)
.
execute
()
.
body
();
.
execute
();
if
(
httpResponse
.
getStatus
()
!=
200
)
{
SystemConfiguration
.
getInstances
().
getDolphinschedulerEnable
().
setValue
(
false
);
logger
.
error
(
"DolphInScheduler connection failed, Reason: {}"
,
httpResponse
.
getStatus
());
return
null
;
}
String
content
=
httpResponse
.
body
();
return
MyJSONUtil
.
verifyResult
(
MyJSONUtil
.
toBean
(
content
,
new
TypeReference
<
Result
<
Project
>>()
{}));
}
...
...
@@ -79,7 +86,7 @@ public class ProjectClient {
*/
public
Project
getDinkyProject
()
{
String
content
=
HttpRequest
.
get
(
SystemConfiguration
.
getInstances
()
HttpResponse
httpResponse
=
HttpRequest
.
get
(
SystemConfiguration
.
getInstances
()
.
getDolphinschedulerUrl
()
.
getValue
()
+
"/projects"
)
...
...
@@ -92,9 +99,14 @@ public class ProjectClient {
.
getDolphinschedulerProjectName
()
.
getValue
()))
.
timeout
(
5000
)
.
execute
()
.
body
();
.
execute
();
if
(
httpResponse
.
getStatus
()
!=
200
)
{
SystemConfiguration
.
getInstances
().
getDolphinschedulerEnable
().
setValue
(
false
);
logger
.
error
(
"DolphInScheduler connection failed, Reason: {}"
,
httpResponse
.
getStatus
());
return
null
;
}
String
content
=
httpResponse
.
body
();
try
{
return
MyJSONUtil
.
toPageBeanAndFindByName
(
content
,
...
...
dinky-web/src/components/CallBackButton/CircleBtn.tsx
View file @
89c35c9e
...
...
@@ -17,37 +17,46 @@
*
*/
import
{
TabsItemType
}
from
'@/pages/DataStudio/model'
;
import
{
Button
}
from
'antd'
;
import
{
TabsItemType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
Button
}
from
'antd'
;
import
React
from
'react'
;
import
{
Tab
}
from
'@/pages/DataStudio/route'
;
export
type
CircleButtonProps
=
{
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
onClick
?:
()
=>
void
;
title
?:
string
;
key
?:
string
;
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
onClick
?:
()
=>
void
;
title
?:
string
;
key
?:
string
;
};
export
type
CircleBottomButtonProps
=
{
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
onClick
?:
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
refresh
:
any
)
=>
Promise
<
void
>
;
title
?:
string
;
key
?:
string
;
};
export
type
CircleDataStudioButtonProps
=
{
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
onClick
?:
(
panes
:
TabsItemType
[],
activeKey
:
string
)
=>
void
;
title
?:
string
;
key
?:
string
;
icon
:
React
.
ReactNode
;
loading
?:
boolean
;
onClick
?:
(
panes
:
TabsItemType
[],
activeKey
:
string
)
=>
void
;
title
?:
string
;
key
?:
string
;
isShow
?:
boolean
;
};
export
const
CircleBtn
:
React
.
FC
<
CircleButtonProps
>
=
(
props
)
=>
{
const
{
onClick
,
title
,
icon
,
loading
}
=
props
;
const
{
onClick
,
title
,
icon
,
loading
}
=
props
;
return
(
<
Button
title=
{
title
}
loading=
{
loading
}
icon=
{
icon
}
block
type=
{
'text'
}
shape=
{
'circle'
}
onClick=
{
onClick
}
/>
);
return
(
<
Button
title=
{
title
}
loading=
{
loading
}
icon=
{
icon
}
block
type=
{
'text'
}
shape=
{
'circle'
}
onClick=
{
onClick
}
/>
);
};
dinky-web/src/pages/DataStudio/BottomContainer/TableData/index.tsx
View file @
89c35c9e
...
...
@@ -17,112 +17,79 @@
*
*/
import
{
SseData
}
from
'@/models/Sse'
;
import
{
getCurrentData
}
from
'@/pages/DataStudio/function'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
{
SSE_TOPIC
}
from
'@/pages/DevOps/constants'
;
import
{
getData
,
postAll
}
from
'@/services/api'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
connect
,
useModel
}
from
'@@/exports'
;
import
{
Modal
,
Select
,
Tabs
}
from
'antd'
;
import
{
SseData
}
from
'@/models/Sse'
;
import
{
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
SSE_TOPIC
}
from
'@/pages/DevOps/constants'
;
import
{
postAll
}
from
'@/services/api'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
useModel
}
from
'@@/exports'
;
import
{
Modal
,
Select
}
from
'antd'
;
import
TextArea
from
'antd/es/input/TextArea'
;
import
{
Tab
}
from
'rc-tabs/lib/interface.d'
;
import
{
Tab
}
from
'rc-tabs/lib/interface.d'
;
import
*
as
React
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
export
async
function
getPrintTables
(
statement
:
string
)
{
return
postAll
(
'api/printTable/getPrintTables'
,
{
statement
});
return
postAll
(
'api/printTable/getPrintTables'
,
{
statement
});
}
/*--- Clear Console ---*/
export
function
clearConsole
()
{
return
getData
(
'api/process/clearConsole'
,
{});
}
export
type
PrintTable
=
{
tableName
:
string
;
fullTableName
:
string
;
tableName
:
string
;
fullTableName
:
string
;
};
const
DataPage
=
(
props
:
any
)
=>
{
const
{
style
,
title
}
=
props
;
const
[
consoleInfo
,
setConsoleInfo
]
=
useState
<
string
>
(
''
);
const
{
subscribeTopic
}
=
useModel
(
'Sse'
,
(
model
:
any
)
=>
({
subscribeTopic
:
model
.
subscribeTopic
}));
const
[
tableName
,
setTableName
]
=
useState
<
string
>
(
''
);
export
const
DataPage
=
(
props
:
any
)
=>
{
const
{
style
,
title
}
=
props
;
const
[
consoleInfo
,
setConsoleInfo
]
=
useState
<
string
>
(
''
);
const
{
subscribeTopic
}
=
useModel
(
'Sse'
,
(
model
:
any
)
=>
({
subscribeTopic
:
model
.
subscribeTopic
}));
const
[
tableName
,
setTableName
]
=
useState
<
string
>
(
''
);
useEffect
(()
=>
{
if
(
title
)
{
setTableName
(
title
.
tableName
);
const
topic
=
`
${
SSE_TOPIC
.
PRINT_TABLE
}
/
${
title
.
fullTableName
}
`
;
return
subscribeTopic
([
topic
],
(
data
:
SseData
)
=>
{
setConsoleInfo
((
preConsoleInfo
)
=>
preConsoleInfo
+
'
\
n'
+
data
.
data
);
});
}
},
[]);
useEffect
(()
=>
{
if
(
title
)
{
setTableName
(
title
.
tableName
);
const
topic
=
`
${
SSE_TOPIC
.
PRINT_TABLE
}
/
${
title
.
fullTableName
}
`
;
return
subscribeTopic
([
topic
],
(
data
:
SseData
)
=>
{
setConsoleInfo
((
preConsoleInfo
)
=>
preConsoleInfo
+
'
\
n'
+
data
.
data
);
});
}
},
[]);
return
<
TextArea
value=
{
consoleInfo
}
style=
{
{
width
:
style
.
width
,
height
:
style
.
height
}
}
/>;
return
<
TextArea
value=
{
consoleInfo
}
style=
{
{
width
:
style
.
width
,
height
:
style
.
height
}
}
/>;
};
const
TableData
=
(
props
:
any
)
=>
{
const
{
statement
,
height
}
=
props
;
const
[
panes
,
setPanes
]
=
useState
<
Tab
[]
>
([]);
function
onOk
(
title
:
PrintTable
)
{
const
activeKey
=
`
${
panes
.
length
+
1
}
`
;
const
newPanes
=
[...
panes
];
newPanes
.
push
({
label
:
title
.
tableName
,
children
:
<
DataPage
title=
{
title
}
style=
{
{
width
:
'100%'
,
height
:
height
-
63
}
}
/>,
key
:
activeKey
});
setPanes
(
newPanes
);
}
export
const
onAdd
=
async
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
refresh
:
any
)
=>
{
const
statement
=
data
?.
statement
;
const
addTab
=
async
()
=>
{
if
(
!
statement
)
return
;
const
tabNames
=
tabs
.
map
((
tab
)
=>
tab
.
label
);
const
result
=
await
getPrintTables
(
statement
);
const
tables
:
PrintTable
[]
=
result
.
data
;
const
tables
:
PrintTable
[]
=
result
.
data
.
filter
((
table
:
PrintTable
)
=>
!
tabNames
.
includes
(
table
.
tableName
))
;
let
selectTable
:
PrintTable
;
Modal
.
confirm
({
title
:
l
(
'pages.datastudio.print.table.inputTableName'
),
content
:
(
<
Select
defaultValue=
''
style=
{
{
width
:
'90%'
}
}
onChange=
{
(
e
,
t
:
any
)
=>
{
selectTable
=
{
tableName
:
t
.
label
,
fullTableName
:
t
.
value
};
}
}
options=
{
tables
.
map
((
table
)
=>
({
label
:
table
.
tableName
,
value
:
table
.
fullTableName
}))
}
/>
),
onOk
()
{
onOk
(
selectTable
);
},
zIndex
:
1000
title
:
l
(
'pages.datastudio.print.table.inputTableName'
),
content
:
(
<
Select
defaultValue=
''
style=
{
{
width
:
'90%'
}
}
onChange=
{
(
e
,
t
:
any
)
=>
{
selectTable
=
{
tableName
:
t
.
label
,
fullTableName
:
t
.
value
};
}
}
options=
{
tables
.
map
((
table
)
=>
({
label
:
table
.
tableName
,
value
:
table
.
fullTableName
}))
}
/>
),
onOk
()
{
tabs
.
push
({
key
:
key
+
"/"
+
selectTable
.
tableName
,
label
:
selectTable
.
tableName
,
children
:
<
DataPage
title=
{
selectTable
}
style=
{
{
width
:
'100%'
,
height
:
'100%'
}
}
/>
});
refresh
()
// onOk(selectTable);
},
zIndex
:
1000
});
};
const
onEdit
=
(
targetKey
:
React
.
MouseEvent
|
React
.
KeyboardEvent
|
string
,
action
:
'add'
|
'remove'
)
=>
{
switch
(
action
)
{
case
'add'
:
addTab
();
break
;
case
'remove'
:
const
newPanes
=
panes
.
filter
((
pane
)
=>
pane
.
key
!==
targetKey
);
setPanes
(
newPanes
);
break
;
}
};
return
<
Tabs
type=
'editable-card'
onEdit=
{
onEdit
}
items=
{
panes
}
/>;
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
height
:
Studio
.
bottomContainer
.
height
,
statement
:
getCurrentData
(
Studio
.
tabs
.
panes
,
Studio
.
tabs
.
activeKey
)?.
statement
}))(
TableData
);
}
\ No newline at end of file
dinky-web/src/pages/DataStudio/BottomContainer/index.tsx
View file @
89c35c9e
This diff is collapsed.
Click to expand it.
dinky-web/src/pages/DataStudio/TabRoute.tsx
0 → 100644
View file @
89c35c9e
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
from
"react"
;
import
{
Tab
}
from
"@/pages/DataStudio/route"
;
import
{
TaskDataType
}
from
"@/pages/DataStudio/model"
;
import
{
LeftBottomKey
}
from
"@/pages/DataStudio/data.d"
;
import
{
onAdd
}
from
"@/pages/DataStudio/BottomContainer/TableData"
;
export
type
BottomTabProps
=
{
icon
?:
React
.
ReactNode
;
onAdd
:
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
operator
:
any
)
=>
Promise
<
void
>
;
onRemove
?:
(
tabs
:
Tab
[],
key
:
string
,
data
:
TaskDataType
|
undefined
,
tabKey
:
string
,
refresh
:
any
)
=>
Promise
<
void
>
;
key
:
string
;
};
export
const
BottomTabRoute
:
{
[
c
:
string
]:
BottomTabProps
}
=
{
[
LeftBottomKey
.
TABLE_DATA_KEY
]:
{
key
:
'add table data'
,
onAdd
:
async
(
tabs
,
key
,
data
,
operator
)
=>
{
await
onAdd
(
tabs
,
key
,
data
,
operator
);
}
}
}
\ No newline at end of file
dinky-web/src/pages/DataStudio/route.tsx
View file @
89c35c9e
This diff is collapsed.
Click to expand it.
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