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
b4e1ac13
Unverified
Commit
b4e1ac13
authored
Aug 09, 2023
by
ZackYoung
Committed by
GitHub
Aug 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spotless (#2185)
parent
74d746fb
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
389 additions
and
112 deletions
+389
-112
StudioController.java
.../src/main/java/org/dinky/controller/StudioController.java
+6
-0
StudioService.java
...-admin/src/main/java/org/dinky/service/StudioService.java
+3
-0
StudioServiceImpl.java
...c/main/java/org/dinky/service/impl/StudioServiceImpl.java
+20
-5
pages.ts
dinky-web/src/locales/en-US/pages.ts
+2
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+3
-0
function.tsx
.../src/pages/DataStudio/BottomContainer/Result/function.tsx
+4
-0
index.tsx
...web/src/pages/DataStudio/BottomContainer/Result/index.tsx
+206
-0
index.tsx
dinky-web/src/pages/DataStudio/FooterContainer/index.tsx
+110
-103
index.tsx
...web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
+1
-0
service.tsx
...b/src/pages/DataStudio/LeftContainer/MetaData/service.tsx
+2
-2
model.ts
dinky-web/src/pages/DataStudio/model.ts
+1
-0
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+2
-0
Index.tsx
...rceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx
+2
-1
constants.tsx
dinky-web/src/services/constants.tsx
+1
-0
function.tsx
dinky-web/src/utils/function.tsx
+26
-1
No files found.
dinky-admin/src/main/java/org/dinky/controller/StudioController.java
View file @
b4e1ac13
...
...
@@ -36,6 +36,7 @@ import org.dinky.data.result.SelectResult;
import
org.dinky.data.result.SqlExplainResult
;
import
org.dinky.explainer.lineage.LineageResult
;
import
org.dinky.job.JobResult
;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
org.dinky.service.StudioService
;
import
java.util.List
;
...
...
@@ -127,6 +128,11 @@ public class StudioController {
public
Result
<
SelectResult
>
getJobData
(
@RequestParam
String
jobId
)
{
return
Result
.
succeed
(
studioService
.
getJobData
(
jobId
));
}
/** 根据jobId获取数据 */
@GetMapping
(
"/getCommonSqlData"
)
public
Result
<
JdbcSelectResult
>
getJobData
(
@RequestParam
Integer
taskId
)
{
return
Result
.
succeed
(
studioService
.
getCommonSqlData
(
taskId
));
}
/** 获取单任务实例的血缘分析 */
@PostMapping
(
"/getLineage"
)
...
...
dinky-admin/src/main/java/org/dinky/service/StudioService.java
View file @
b4e1ac13
...
...
@@ -32,6 +32,7 @@ import org.dinky.data.result.SelectResult;
import
org.dinky.data.result.SqlExplainResult
;
import
org.dinky.explainer.lineage.LineageResult
;
import
org.dinky.job.JobResult
;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
java.util.List
;
...
...
@@ -57,6 +58,8 @@ public interface StudioService {
ObjectNode
getJobPlan
(
StudioExecuteDTO
studioExecuteDTO
);
JdbcSelectResult
getCommonSqlData
(
Integer
taskId
);
SelectResult
getJobData
(
String
jobId
);
LineageResult
getLineage
(
StudioCADTO
studioCADTO
);
...
...
dinky-admin/src/main/java/org/dinky/service/impl/StudioServiceImpl.java
View file @
b4e1ac13
...
...
@@ -71,6 +71,7 @@ import java.util.Collections;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -82,6 +83,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.hutool.cache.Cache
;
import
cn.hutool.cache.impl.TimedCache
;
import
lombok.RequiredArgsConstructor
;
/** StudioServiceImpl */
...
...
@@ -90,6 +93,9 @@ import lombok.RequiredArgsConstructor;
public
class
StudioServiceImpl
implements
StudioService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
StudioServiceImpl
.
class
);
/** Common sql query result cache */
private
static
final
Cache
<
Integer
,
JdbcSelectResult
>
COMMON_SQL_SEARCH_CACHE
=
new
TimedCache
<>(
TimeUnit
.
MINUTES
.
toMillis
(
10
));
private
final
ClusterInstanceService
clusterInstanceService
;
private
final
ClusterConfigurationService
clusterConfigurationService
;
...
...
@@ -165,11 +171,15 @@ public class StudioServiceImpl implements StudioService {
@Override
public
JobResult
executeSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
if
(
Dialect
.
notFlinkSql
(
studioExecuteDTO
.
getDialect
()))
{
return
executeCommonSql
(
SqlDTO
.
build
(
studioExecuteDTO
.
getStatement
(),
studioExecuteDTO
.
getDatabaseId
(),
studioExecuteDTO
.
getMaxRowNum
()));
JobResult
jobResult
=
executeCommonSql
(
SqlDTO
.
build
(
studioExecuteDTO
.
getStatement
(),
studioExecuteDTO
.
getDatabaseId
(),
studioExecuteDTO
.
getMaxRowNum
()));
COMMON_SQL_SEARCH_CACHE
.
put
(
studioExecuteDTO
.
getTaskId
(),
(
JdbcSelectResult
)
jobResult
.
getResult
());
return
jobResult
;
}
else
{
return
executeFlinkSql
(
studioExecuteDTO
);
}
...
...
@@ -344,6 +354,11 @@ public class StudioServiceImpl implements StudioService {
}
}
@Override
public
JdbcSelectResult
getCommonSqlData
(
Integer
taskId
)
{
return
COMMON_SQL_SEARCH_CACHE
.
get
(
taskId
);
}
@Override
public
SelectResult
getJobData
(
String
jobId
)
{
return
JobManager
.
getJobData
(
jobId
);
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
b4e1ac13
...
...
@@ -1008,6 +1008,8 @@ export default {
'pages.datastudio.footer.lineSeparator'
:
"Line Separator: "
,
'pages.datastudio.footer.codeEncoding'
:
"File Encoding: "
,
'pages.datastudio.footer.codePosition'
:
"Ln {Ln}:Col {Col} "
,
'pages.datastudio.label.result.query.latest.data'
:
'Get the latest data'
,
'datastudio.middle.qg'
:
'Quick Guide'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
b4e1ac13
...
...
@@ -1021,6 +1021,9 @@ export default {
'pages.datastudio.footer.codeEncoding'
:
"文件编码:"
,
'pages.datastudio.footer.codePosition'
:
"行{Ln}:列{Col} "
,
'pages.datastudio.label.result.query.latest.data'
:
'获取最新数据'
,
'datastudio.middle.qg'
:
'快捷引导'
,
'datastudio.middle.qg.clusterInstance'
:
'注册 Session 集群'
,
'datastudio.middle.qg.clusterConfiguration'
:
'注册集群配置'
,
...
...
dinky-web/src/pages/DataStudio/BottomContainer/Result/function.tsx
0 → 100644
View file @
b4e1ac13
import
{
ColumnType
}
from
"antd/es/table"
;
import
{
DataIndex
}
from
"rc-table/es/interface"
;
import
{
Input
}
from
"antd"
;
dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx
0 → 100644
View file @
b4e1ac13
import
{
connect
}
from
"umi"
;
import
{
isSql
}
from
"@/pages/DataStudio/HeaderContainer/service"
;
import
{
Button
,
Empty
,
Input
,
InputRef
,
Space
,
Table
,
Tag
}
from
"antd"
;
import
{
FireOutlined
,
SearchOutlined
}
from
"@ant-design/icons"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
getCurrentData
,
getCurrentTab
,
mapDispatchToProps
}
from
"@/pages/DataStudio/function"
;
import
{
DataStudioParams
,
StateType
,
TabsPageType
}
from
"@/pages/DataStudio/model"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
handleGetOption
}
from
"@/services/BusinessCrud"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
postAll
}
from
"@/services/api"
;
import
{
ColumnsType
,
ColumnType
}
from
"antd/es/table"
;
import
{
DataIndex
}
from
"rc-table/es/interface"
;
import
{
FilterConfirmProps
}
from
"antd/es/table/interface"
;
import
{
Highlight
}
from
"@ant-design/pro-layout/es/components/Help/Search"
;
import
{
transformTableDataToCsv
}
from
"@/utils/function"
;
type
Data
=
{
[
c
:
string
]:
any
,
columns
?:
string
[],
rowData
?:
object
[]
}
const
Result
=
(
props
:
any
)
=>
{
const
{
saveTabs
,
tabs
:
{
panes
,
activeKey
}}
=
props
;
const
[
data
,
setData
]
=
useState
<
Data
>
({})
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
true
)
const
currentTabs
=
getCurrentTab
(
panes
,
activeKey
);
const
current
=
getCurrentData
(
panes
,
activeKey
);
const
[
searchText
,
setSearchText
]
=
useState
(
''
);
const
[
searchedColumn
,
setSearchedColumn
]
=
useState
(
''
);
const
searchInput
=
useRef
<
InputRef
>
(
null
);
const
handleReset
=
(
clearFilters
:
()
=>
void
)
=>
{
clearFilters
();
setSearchText
(
''
);
};
const
handleSearch
=
(
selectedKeys
:
string
[],
confirm
:
(
param
?:
FilterConfirmProps
)
=>
void
,
dataIndex
:
DataIndex
,
)
=>
{
confirm
();
setSearchText
(
selectedKeys
[
0
]);
setSearchedColumn
(
dataIndex
.
toString
());
};
const
getColumnSearchProps
=
(
dataIndex
:
string
):
ColumnType
<
Data
>
=>
({
filterDropdown
:
({
setSelectedKeys
,
selectedKeys
,
confirm
,
clearFilters
})
=>
(
<
div
style=
{
{
padding
:
8
}
}
onKeyDown=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
Input
ref=
{
searchInput
}
placeholder=
{
`Search ${dataIndex}`
}
value=
{
selectedKeys
[
0
]
}
onChange=
{
(
e
)
=>
setSelectedKeys
(
e
.
target
.
value
?
[
e
.
target
.
value
]
:
[])
}
onPressEnter=
{
()
=>
handleSearch
(
selectedKeys
as
string
[],
confirm
,
dataIndex
)
}
style=
{
{
marginBottom
:
8
,
display
:
'block'
}
}
/>
<
Space
>
<
Button
type=
"primary"
onClick=
{
()
=>
handleSearch
(
selectedKeys
as
string
[],
confirm
,
dataIndex
)
}
icon=
{
<
SearchOutlined
/>
}
size=
"small"
style=
{
{
width
:
90
}
}
>
{
l
(
"button.search"
)
}
</
Button
>
<
Button
onClick=
{
()
=>
clearFilters
&&
handleReset
(
clearFilters
)
}
size=
"small"
style=
{
{
width
:
90
}
}
>
{
l
(
"button.reset"
)
}
</
Button
>
</
Space
>
</
div
>
),
filterIcon
:
(
filtered
:
boolean
)
=>
(
<
SearchOutlined
style=
{
{
color
:
filtered
?
'#1677ff'
:
undefined
}
}
/>
),
onFilter
:
(
value
,
record
)
=>
record
[
dataIndex
]
.
toString
()
.
toLowerCase
()
.
includes
((
value
as
string
).
toLowerCase
()),
onFilterDropdownOpenChange
:
(
visible
)
=>
{
if
(
visible
)
{
setTimeout
(()
=>
searchInput
.
current
?.
select
(),
100
);
}
},
render
:
(
text
)
=>
searchedColumn
===
dataIndex
?
(
<
Highlight
label=
{
text
?
text
.
toString
()
:
''
}
words=
{
[
searchText
]
}
/>
)
:
(
text
),
});
const
loadData
=
async
(
isRefresh
?:
boolean
)
=>
{
if
(
!
currentTabs
)
{
return
}
if
(
currentTabs
.
type
!==
TabsPageType
.
project
)
{
return
}
if
((
currentTabs
?.
params
as
DataStudioParams
).
resultData
&&
!
isRefresh
)
{
setData
((
currentTabs
?.
params
as
DataStudioParams
).
resultData
)
}
else
{
if
(
isSql
(
current
.
dialect
))
{
// common sql
const
res
=
await
handleGetOption
(
"api/studio/getCommonSqlData"
,
"Get Data"
,
{
taskId
:
(
currentTabs
?.
params
as
DataStudioParams
).
taskId
});
if
(
res
.
datas
)
{
(
currentTabs
?.
params
as
DataStudioParams
).
resultData
=
res
.
datas
saveTabs
({...
props
.
tabs
})
setData
(
res
.
datas
)
}
}
else
{
// flink sql
if
(
current
.
jobInstanceId
)
{
const
res
=
await
postAll
(
API_CONSTANTS
.
GET_JOB_BY_ID
,
{
id
:
current
.
jobInstanceId
});
const
jobData
=
res
.
datas
;
if
(
"unknown"
!==
jobData
.
status
.
toLowerCase
())
{
const
jid
=
jobData
.
jid
;
const
tableData
=
await
handleGetOption
(
"api/studio/getJobData"
,
"Get Data"
,
{
jobId
:
jid
});
const
datas
=
tableData
.
datas
;
datas
.
jid
=
jid
;
if
(
datas
.
success
)
{
(
currentTabs
?.
params
as
DataStudioParams
).
resultData
=
datas
saveTabs
({...
props
.
tabs
})
}
}
}
}
}
setLoading
(
false
)
}
useEffect
(()
=>
{
setData
({})
loadData
()
},
[
currentTabs
])
const
getColumns
=
(
columns
:
string
[])
=>
{
return
columns
?.
map
((
item
)
=>
{
return
{
title
:
item
,
dataIndex
:
item
,
sorter
:
(
a
,
b
)
=>
a
[
item
]
-
b
[
item
],
...
getColumnSearchProps
(
item
),
};
})
as
ColumnsType
<
any
>
;
};
const
showDetail
=
async
()
=>
{
setLoading
(
true
)
await
loadData
(
true
);
setLoading
(
false
)
};
const
renderFlinkSQLContent
=
()
=>
{
return
(<>
{
current
.
jobInstanceId
?
(<>
<
Space
>
<
Button
loading=
{
loading
}
type=
"primary"
onClick=
{
showDetail
}
icon=
{
<
SearchOutlined
/>
}
>
{
l
(
'pages.datastudio.label.result.query.latest.data'
)
}
</
Button
>
<
Tag
color=
"blue"
key=
{
data
.
jid
}
>
<
FireOutlined
/>
{
data
.
jid
}
</
Tag
>
</
Space
>
</>)
:
undefined
}
</>)
}
const
renderDownloadButton
=
()
=>
{
if
(
current
&&
data
.
columns
)
{
const
_utf
=
"
\
uFEFF"
;
const
csvDataBlob
=
new
Blob
([
_utf
+
transformTableDataToCsv
(
data
.
columns
!
,
data
.
rowData
!
)],
{
type
:
"text/csv"
,
});
const
url
=
URL
.
createObjectURL
(
csvDataBlob
);
return
<
Button
type=
"link"
href=
{
url
}
>
Export Csv
</
Button
>
}
return
undefined
}
return
(
<
div
style=
{
{
width
:
'100%'
}
}
>
<
div
style=
{
{
direction
:
"rtl"
}
}
>
{
renderDownloadButton
()
}
{
current
?
(
isSql
(
current
.
dialect
)
?
<></>
:
renderFlinkSQLContent
())
:
undefined
}
</
div
>
{
data
.
columns
?
<
Table
columns=
{
getColumns
(
data
.
columns
)
}
dataSource=
{
data
.
rowData
!
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
{...
item
,
key
:
index
}
})
}
loading=
{
loading
}
/>
:
(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
}
</
div
>
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
tabs
:
Studio
.
tabs
,
}),
mapDispatchToProps
)(
Result
);
dinky-web/src/pages/DataStudio/FooterContainer/index.tsx
View file @
b4e1ac13
...
...
@@ -8,123 +8,130 @@ import {l} from "@/utils/intl";
import
JobRunningModal
from
"@/pages/DataStudio/FooterContainer/JobRunningModal"
;
export
type
FooterContainerProps
=
{
token
:
GlobalToken
token
:
GlobalToken
}
type
ButtonRoute
=
{
text
:
React
.
ReactNode
,
title
:
string
,
onClick
?:
()
=>
void
,
isShow
?:
(
type
?:
TabsPageType
,
subType
?:
string
,
data
?:
any
)
=>
boolean
;
text
:
React
.
ReactNode
,
title
:
string
,
onClick
?:
()
=>
void
,
isShow
?:
(
type
?:
TabsPageType
,
subType
?:
string
,
data
?:
any
)
=>
boolean
;
}
const
FooterContainer
:
React
.
FC
<
FooterContainerProps
&
StateType
>
=
(
props
)
=>
{
const
{
footContainer
:
{
memDetails
,
codeType
,
lineSeparator
,
codeEncoding
,
space
,
codePosition
,
jobRunningMsg
,
},
token
,
tabs
}
=
props
;
const
{
footContainer
:
{
memDetails
,
codeType
,
lineSeparator
,
codeEncoding
,
space
,
codePosition
,
jobRunningMsg
,
},
token
,
tabs
}
=
props
;
const
[
viewJobRunning
,
setViewJobRunning
]
=
useState
(
false
);
const
[
viewJobRunning
,
setViewJobRunning
]
=
useState
(
false
);
const
eventSource
=
getSseData
(
"/api/sse/getJvmInfo"
);
const
[
memDetailInfo
,
setMemDetailInfo
]
=
useState
(
memDetails
);
useEffect
(()
=>
{
eventSource
.
onmessage
=
(
event
)
=>
{
const
data
=
JSON
.
parse
(
event
.
data
);
setMemDetailInfo
(
Number
(
data
[
"heapUsed"
]
/
1024
/
1024
).
toFixed
(
0
)
+
"/"
+
Number
(
data
[
"total"
]
/
1024
/
1024
).
toFixed
(
0
)
+
"M"
)
}
return
()
=>
{
eventSource
.
close
()
}
},
[]);
const
eventSource
=
getSseData
(
"/api/sse/getJvmInfo"
);
const
[
memDetailInfo
,
setMemDetailInfo
]
=
useState
(
memDetails
);
useEffect
(()
=>
{
eventSource
.
onmessage
=
(
event
)
=>
{
const
data
=
JSON
.
parse
(
event
.
data
);
setMemDetailInfo
(
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
}
}
>
{
memDetailInfo
}
</
span
>,
title
:
l
(
"pages.datastudio.footer.memDetails"
,
""
,
{
max
:
memDetailInfo
.
split
(
"/"
)[
1
],
used
:
memDetailInfo
.
split
(
"/"
)[
0
]
}),
isShow
:
()
=>
true
},
{
text
:
codeType
,
title
:
l
(
"pages.datastudio.footer.codeType"
)
+
codeType
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
lineSeparator
,
title
:
l
(
"pages.datastudio.footer.lineSeparator"
)
+
lineSeparator
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
codeEncoding
,
title
:
l
(
"pages.datastudio.footer.codeEncoding"
)
+
codeEncoding
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
"Space: "
+
space
,
title
:
"Space: "
+
space
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
codePosition
[
0
]
+
":"
+
codePosition
[
1
],
title
:
l
(
"pages.datastudio.footer.codePosition"
,
""
,
{
Ln
:
codePosition
[
0
],
Col
:
codePosition
[
1
]
}),
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
];
const
currentTab
=
getCurrentTab
(
tabs
.
panes
,
tabs
.
activeKey
);
const
route
:
ButtonRoute
[]
=
[
{
text
:
<
span
style=
{
{
backgroundColor
:
token
.
colorBgContainer
}
}
><
div
style=
{
{
width
:
(
1
-
(
parseInt
(
memDetails
.
split
(
"/"
)[
0
])
/
parseInt
(
memDetails
.
split
(
"/"
)[
1
])))
*
100
+
"%"
,
backgroundColor
:
token
.
colorFill
}
}
>
{
memDetails
}
</
div
></
span
>,
title
:
l
(
"pages.datastudio.footer.memDetails"
,
""
,
{
max
:
memDetailInfo
.
split
(
"/"
)[
1
],
used
:
memDetailInfo
.
split
(
"/"
)[
0
]
}),
isShow
:
()
=>
true
},
{
text
:
codeType
,
title
:
l
(
"pages.datastudio.footer.codeType"
)
+
codeType
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
lineSeparator
,
title
:
l
(
"pages.datastudio.footer.lineSeparator"
)
+
lineSeparator
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
codeEncoding
,
title
:
l
(
"pages.datastudio.footer.codeEncoding"
)
+
codeEncoding
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
"Space: "
+
space
,
title
:
"Space: "
+
space
,
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
{
text
:
codePosition
[
0
]
+
":"
+
codePosition
[
1
],
title
:
l
(
"pages.datastudio.footer.codePosition"
,
""
,
{
Ln
:
codePosition
[
0
],
Col
:
codePosition
[
1
]
}),
isShow
:
(
type
)
=>
TabsPageType
.
project
===
type
},
];
/**
* render footer right info
* @param {ButtonRoute[]} routes
* @returns {JSX.Element[]}
*/
const
renderFooterRightInfo
=
(
routes
:
ButtonRoute
[])
=>
{
return
routes
.
filter
(
x
=>
{
if
(
x
.
isShow
)
{
return
x
.
isShow
(
currentTab
?.
type
,
currentTab
?.
subType
,
currentTab
?.
params
);
}
return
false
})
.
map
((
item
,
index
)
=>
(
<
Button
size=
{
"small"
}
type=
{
"text"
}
block
style=
{
{
paddingInline
:
4
}
}
key=
{
index
}
onClick=
{
item
.
onClick
}
title=
{
item
.
title
}
>
{
item
.
text
}
</
Button
>
))
}
/**
* render footer right info
* @param {ButtonRoute[]} routes
* @returns {JSX.Element[]}
*/
const
renderFooterRightInfo
=
(
routes
:
ButtonRoute
[])
=>
{
return
routes
.
filter
(
x
=>
{
if
(
x
.
isShow
)
{
return
x
.
isShow
(
currentTab
?.
type
,
currentTab
?.
subType
,
currentTab
?.
params
);
}
return
false
})
.
map
((
item
,
index
)
=>
(
<
Button
size=
{
"small"
}
type=
{
"text"
}
block
style=
{
{
paddingInline
:
4
}
}
key=
{
index
}
onClick=
{
item
.
onClick
}
title=
{
item
.
title
}
>
{
item
.
text
}
</
Button
>
))
}
return
<>
<
div
style=
{
{
backgroundColor
:
token
.
colorFill
,
height
:
VIEW
.
footerHeight
,
width
:
"100%"
,
display
:
"flex"
,
paddingInline
:
10
}
}
>
<
Space
style=
{
{
direction
:
"ltr"
,
width
:
"30%%"
}
}
>
<
Button
size=
{
"small"
}
type=
{
"text"
}
block
style=
{
{
paddingInline
:
4
}
}
>
Welcome to Dinky !
</
Button
>
</
Space
>
<
Space
onClick=
{
()
=>
setViewJobRunning
(
true
)
}
style=
{
{
direction
:
'rtl'
,
width
:
"30%"
}
}
>
{
jobRunningMsg
.
jobName
}
-
{
jobRunningMsg
.
runningLog
}
</
Space
>
<
Space
style=
{
{
direction
:
"rtl"
,
width
:
"70%"
}
}
size=
{
4
}
direction=
{
"horizontal"
}
>
{
renderFooterRightInfo
(
route
)
}
</
Space
>
</
div
>
<
JobRunningModal
value=
{
jobRunningMsg
}
visible=
{
viewJobRunning
}
onCancel=
{
()
=>
setViewJobRunning
(
false
)
}
onOk=
{
()
=>
setViewJobRunning
(
false
)
}
/>
</>
return
<>
<
div
style=
{
{
backgroundColor
:
token
.
colorFill
,
height
:
VIEW
.
footerHeight
,
width
:
"100%"
,
display
:
"flex"
,
paddingInline
:
10
}
}
>
<
Space
style=
{
{
direction
:
"ltr"
,
width
:
"30%%"
}
}
>
<
Button
size=
{
"small"
}
type=
{
"text"
}
block
style=
{
{
paddingInline
:
4
}
}
>
Welcome to Dinky !
</
Button
>
</
Space
>
<
Space
onClick=
{
()
=>
setViewJobRunning
(
true
)
}
style=
{
{
direction
:
'rtl'
,
width
:
"30%"
}
}
>
{
jobRunningMsg
.
jobName
}
-
{
jobRunningMsg
.
runningLog
}
</
Space
>
<
Space
style=
{
{
direction
:
"rtl"
,
width
:
"70%"
}
}
size=
{
4
}
direction=
{
"horizontal"
}
>
{
renderFooterRightInfo
(
route
)
}
</
Space
>
</
div
>
<
JobRunningModal
value=
{
jobRunningMsg
}
visible=
{
viewJobRunning
}
onCancel=
{
()
=>
setViewJobRunning
(
false
)
}
onOk=
{
()
=>
setViewJobRunning
(
false
)
}
/>
</>
}
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
footContainer
:
Studio
.
footContainer
,
tabs
:
Studio
.
tabs
footContainer
:
Studio
.
footContainer
,
tabs
:
Studio
.
tabs
}))(
FooterContainer
);
dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
View file @
b4e1ac13
...
...
@@ -13,6 +13,7 @@ import {TagAlignLeft} from "@/components/StyledComponents";
import
SchemaTree
from
"@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree"
;
import
{
DataSources
}
from
"@/types/RegCenter/data"
;
import
{
BtnRoute
}
from
"@/pages/DataStudio/route"
;
import
{
transformTreeData
}
from
"@/utils/function"
;
const
MetaData
=
(
props
:
any
)
=>
{
...
...
dinky-web/src/pages/DataStudio/LeftContainer/MetaData/service.tsx
View file @
b4e1ac13
...
...
@@ -2,8 +2,8 @@ import {handleGetOption, handleOption, queryDataByParams} from "@/services/Busin
import
{
l
}
from
"@/utils/intl"
;
/*--- 刷新 元数据表 ---*/
export
function
showMetaDataTable
(
id
:
number
)
{
return
handleGetOption
(
'api/database/getSchemasAndTables'
,
l
(
"pages.metadata.DataSearch"
),
{
id
:
id
})
;
export
async
function
showMetaDataTable
(
id
:
number
)
{
return
(
await
handleGetOption
(
'api/database/getSchemasAndTables'
,
l
(
"pages.metadata.DataSearch"
),
{
id
:
id
})).
datas
;
}
/*--- 清理 元数据表缓存 ---*/
...
...
dinky-web/src/pages/DataStudio/model.ts
View file @
b4e1ac13
...
...
@@ -97,6 +97,7 @@ export type MetadataParams = {
export
type
DataStudioParams
=
{
taskId
:
number
;
taskData
:
Record
<
string
,
any
>
resultData
:
Record
<
string
,
any
>
}
export
enum
TabsPageType
{
None
=
""
,
metadata
=
"metadata"
,
project
=
"project"
,
flinkSql
=
"flinksql"
}
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
b4e1ac13
...
...
@@ -50,6 +50,7 @@ import {l} from "@/utils/intl";
import
{
TabsPageType
}
from
"@/pages/DataStudio/model"
;
import
{
CircleButtonProps
}
from
"@/components/CallBackButton/CircleBtn"
;
import
{
DiffEditor
}
from
"@monaco-editor/react"
;
import
Result
from
"@/pages/DataStudio/BottomContainer/Result"
;
export
const
LeftSide
=
[
{
...
...
@@ -120,6 +121,7 @@ export const LeftBottomSide = [
key
:
'menu.datastudio.result'
,
icon
:
<
MonitorOutlined
/>,
label
:
l
(
'menu.datastudio.result'
),
children
:
<
Result
/>
},
{
key
:
'menu.datastudio.bi'
,
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx
View file @
b4e1ac13
...
...
@@ -21,6 +21,7 @@ import {l} from '@/utils/intl';
import
{
CheckSquareOutlined
,
KeyOutlined
}
from
'@ant-design/icons'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProColumns
}
from
'@ant-design/pro-table/es/typing'
;
import
{
transformTreeData
}
from
"@/utils/function"
;
type
ColumnInfoProps
=
{
columnInfo
:
Partial
<
DataSources
.
Column
[]
>
;
...
...
@@ -122,7 +123,7 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
size=
{
'small'
}
bordered
columns=
{
columns
}
dataSource=
{
columnInfo
as
DataSources
.
Column
[]
}
dataSource=
{
transformTreeData
(
columnInfo
)
as
DataSources
.
Column
[]
}
/
>
</>
;
};
...
...
dinky-web/src/services/constants.tsx
View file @
b4e1ac13
...
...
@@ -199,6 +199,7 @@ export const API_CONSTANTS = {
// ---- devops
GET_JOB_LIST
:
"/api/jobInstance"
,
GET_JOB_BY_ID
:
"/api/jobInstance/getOneById"
,
GET_JOB_DETAIL
:
"/api/jobInstance/getJobInfoDetail"
,
CANCEL_JOB
:
"/api/studio/cancel"
,
OFFLINE_TASK
:
"/api/task/offLineTask"
,
...
...
dinky-web/src/utils/function.tsx
View file @
b4e1ac13
...
...
@@ -37,6 +37,7 @@ import path from 'path';
import
{
l
}
from
'@/utils/intl'
;
import
{
RightSide
}
from
"@/pages/DataStudio/route"
;
import
{
TabsItemType
}
from
"@/pages/DataStudio/model"
;
import
{
ProColumns
}
from
"@ant-design/pro-table/es/typing"
;
/**
...
...
@@ -252,7 +253,7 @@ export const getLanguage = (type: string): string => {
* @param type file type
*/
export
const
getIcon
=
(
type
:
string
)
=>
{
if
(
!
type
){
if
(
!
type
)
{
return
<
FileIcon
/>;
}
switch
(
type
.
toLowerCase
())
{
...
...
@@ -457,3 +458,27 @@ export const searchTreeNode = (originValue: string, searchValue: string): any =>
return
title
};
export
const
transformTreeData
=
<
T
,
>
(data: T[]): T[] =
>
{
return
data
.
map
((
item
:
T
,
index
)
=>
{
return
{...
item
,
key
:
index
}
});
}
export const transformTableDataToCsv =
<
T
,
>
(column: string[], data: T[]): string =
>
{
let
row
=
""
;
let
csvData
=
""
;
for
(
const
title
of
column
)
{
row
+=
'"'
+
title
+
'",'
;
}
const
delimiter
=
"
\
r
\
n"
;
csvData
+=
row
+
delimiter
;
// 添加换行符号
for
(
const
item
of
data
)
{
row
=
""
;
for
(
let
key
in
item
)
{
row
+=
'"'
+
(
item
[
key
]
??
''
)
+
'",'
;
}
csvData
+=
row
+
delimiter
;
// 添加换行符号
}
return
csvData
;
}
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