Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
4e494e0e
Commit
4e494e0e
authored
Jul 25, 2021
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
元数据表
parent
83671764
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
1 deletion
+120
-1
DataBaseController.java
...rc/main/java/com/dlink/controller/DataBaseController.java
+8
-0
DataBaseService.java
...dmin/src/main/java/com/dlink/service/DataBaseService.java
+3
-0
DataBaseServiceImpl.java
...main/java/com/dlink/service/impl/DataBaseServiceImpl.java
+10
-0
DDL.ts
dlink-web/src/components/Studio/StudioEvent/DDL.ts
+4
-0
index.tsx
...components/Studio/StudioLeftTool/StudioMetaData/index.tsx
+93
-0
index.tsx
dlink-web/src/components/Studio/StudioLeftTool/index.tsx
+2
-1
No files found.
dlink-admin/src/main/java/com/dlink/controller/DataBaseController.java
View file @
4e494e0e
...
@@ -119,4 +119,12 @@ public class DataBaseController {
...
@@ -119,4 +119,12 @@ public class DataBaseController {
databaseService
.
updateById
(
dataBase
);
databaseService
.
updateById
(
dataBase
);
return
Result
.
succeed
(
dataBase
,
"状态刷新完成"
);
return
Result
.
succeed
(
dataBase
,
"状态刷新完成"
);
}
}
/**
* 获取元数据的表
*/
@GetMapping
(
"/getSchemasAndTables"
)
public
Result
getSchemasAndTables
(
@RequestParam
Integer
id
)
{
return
Result
.
succeed
(
databaseService
.
getSchemasAndTables
(
id
),
"获取成功"
);
}
}
}
\ No newline at end of file
dlink-admin/src/main/java/com/dlink/service/DataBaseService.java
View file @
4e494e0e
...
@@ -2,6 +2,7 @@ package com.dlink.service;
...
@@ -2,6 +2,7 @@ package com.dlink.service;
import
com.dlink.db.service.ISuperService
;
import
com.dlink.db.service.ISuperService
;
import
com.dlink.model.DataBase
;
import
com.dlink.model.DataBase
;
import
com.dlink.model.Schema
;
import
java.util.List
;
import
java.util.List
;
...
@@ -18,4 +19,6 @@ public interface DataBaseService extends ISuperService<DataBase> {
...
@@ -18,4 +19,6 @@ public interface DataBaseService extends ISuperService<DataBase> {
boolean
saveOrUpdateDataBase
(
DataBase
dataBase
);
boolean
saveOrUpdateDataBase
(
DataBase
dataBase
);
List
<
DataBase
>
listEnabledAll
();
List
<
DataBase
>
listEnabledAll
();
List
<
Schema
>
getSchemasAndTables
(
Integer
id
);
}
}
dlink-admin/src/main/java/com/dlink/service/impl/DataBaseServiceImpl.java
View file @
4e494e0e
...
@@ -5,7 +5,9 @@ import com.dlink.assertion.Asserts;
...
@@ -5,7 +5,9 @@ import com.dlink.assertion.Asserts;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.mapper.DataBaseMapper
;
import
com.dlink.mapper.DataBaseMapper
;
import
com.dlink.metadata.driver.Driver
;
import
com.dlink.metadata.driver.Driver
;
import
com.dlink.metadata.driver.DriverConfig
;
import
com.dlink.model.DataBase
;
import
com.dlink.model.DataBase
;
import
com.dlink.model.Schema
;
import
com.dlink.service.DataBaseService
;
import
com.dlink.service.DataBaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -60,4 +62,12 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
...
@@ -60,4 +62,12 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
public
List
<
DataBase
>
listEnabledAll
()
{
public
List
<
DataBase
>
listEnabledAll
()
{
return
this
.
list
(
new
QueryWrapper
<
DataBase
>().
eq
(
"enabled"
,
1
));
return
this
.
list
(
new
QueryWrapper
<
DataBase
>().
eq
(
"enabled"
,
1
));
}
}
@Override
public
List
<
Schema
>
getSchemasAndTables
(
Integer
id
)
{
DataBase
dataBase
=
getById
(
id
);
Asserts
.
checkNotNull
(
dataBase
,
"该数据源不存在!"
);
Driver
driver
=
Driver
.
build
(
dataBase
.
getDriverConfig
()).
connect
();
return
driver
.
getSchemasAndTables
();
}
}
}
dlink-web/src/components/Studio/StudioEvent/DDL.ts
View file @
4e494e0e
...
@@ -120,6 +120,10 @@ export function showDataBase(dispatch: any) {
...
@@ -120,6 +120,10 @@ export function showDataBase(dispatch: any) {
});
});
});
});
}
}
/*--- 刷新 元数据表 ---*/
export
function
showMetaDataTable
(
id
:
number
)
{
return
getData
(
'api/database/getSchemasAndTables'
,{
id
:
id
});
}
/*--- 刷新 Flink Jobs ---*/
/*--- 刷新 Flink Jobs ---*/
export
function
showFlinkJobs
(
clusterId
:
number
)
{
export
function
showFlinkJobs
(
clusterId
:
number
)
{
return
getData
(
'api/studio/listJobs'
,{
clusterId
:
clusterId
});
return
getData
(
'api/studio/listJobs'
,{
clusterId
:
clusterId
});
...
...
dlink-web/src/components/Studio/StudioLeftTool/StudioMetaData/index.tsx
0 → 100644
View file @
4e494e0e
import
{
message
,
Button
,
Tree
,
Empty
,
Select
,
Tag
,
Tooltip
}
from
"antd"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
useState
}
from
"react"
;
import
styles
from
"./index.less"
;
import
{
ReloadOutlined
,
PlusOutlined
,
DownOutlined
}
from
'@ant-design/icons'
;
import
React
from
"react"
;
import
{
showMetaDataTable
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
convertToTreeData
}
from
"@/components/Studio/StudioTree/Function"
;
import
{
getCatalogueTreeData
}
from
"@/pages/FlinkSqlStudio/service"
;
const
{
DirectoryTree
}
=
Tree
;
const
{
Option
}
=
Select
;
const
StudioMetaData
=
(
props
:
any
)
=>
{
const
{
database
,
dispatch
}
=
props
;
const
[
databaseId
,
setDataBaseId
]
=
useState
<
number
>
();
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
onRefreshTreeData
=
()
=>
{
if
(
!
databaseId
)
return
;
const
res
=
showMetaDataTable
(
databaseId
);
res
.
then
((
result
)
=>
{
let
tables
=
result
.
datas
;
for
(
let
i
=
0
;
i
<
tables
.
length
;
i
++
){
tables
[
i
].
children
=
tables
[
i
].
tables
;
for
(
let
j
=
0
;
j
<
tables
[
i
].
children
.
length
;
j
++
){
tables
[
i
].
children
[
j
].
title
=
tables
[
i
].
children
[
j
].
name
;
tables
[
i
].
children
[
j
].
key
=
tables
[
i
].
children
[
j
].
name
;
}
tables
[
i
].
title
=
tables
[
i
].
name
;
tables
[
i
].
key
=
tables
[
i
].
name
;
}
setTreeData
(
result
.
datas
);
});
};
const
onChangeDataBase
=
(
value
:
number
)
=>
{
setDataBaseId
(
value
);
onRefreshTreeData
();
};
const
getDataBaseOptions
=
()
=>
{
let
itemList
=
[];
for
(
let
item
of
database
)
{
let
tag
=
(<><
Tag
color=
{
item
.
enabled
?
"processing"
:
"error"
}
>
{
item
.
type
}
</
Tag
>
{
item
.
alias
}
</>);
itemList
.
push
(<
Option
value=
{
item
.
id
}
label=
{
tag
}
>
{
tag
}
</
Option
>)
}
return
itemList
;
};
return
(
<>
<
Select
// style={{width: '100%'}}
placeholder=
"选择数据源"
optionLabelProp=
"label"
onChange=
{
onChangeDataBase
}
>
{
getDataBaseOptions
()
}
</
Select
>
<
div
style=
{
{
float
:
"right"
}
}
>
<
Tooltip
title=
"刷新元数据表"
>
<
Button
type=
"text"
icon=
{
<
ReloadOutlined
/>
}
onClick=
{
onRefreshTreeData
}
/>
</
Tooltip
>
</
div
>
<
DirectoryTree
multiple
switcherIcon=
{
<
DownOutlined
/>
}
treeData=
{
treeData
}
height=
{
400
}
/>
</>
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
database
:
Studio
.
database
,
}))(
StudioMetaData
);
dlink-web/src/components/Studio/StudioLeftTool/index.tsx
View file @
4e494e0e
...
@@ -8,6 +8,7 @@ import StudioConnector from "./StudioConnector";
...
@@ -8,6 +8,7 @@ import StudioConnector from "./StudioConnector";
import
React
from
"react"
;
import
React
from
"react"
;
import
StudioDataBase
from
"./StudioDataBase"
;
import
StudioDataBase
from
"./StudioDataBase"
;
import
StudioCluster
from
"./StudioCluster"
;
import
StudioCluster
from
"./StudioCluster"
;
import
StudioMetaData
from
"./StudioMetaData"
;
const
{
TabPane
}
=
Tabs
;
const
{
TabPane
}
=
Tabs
;
...
@@ -28,7 +29,7 @@ const StudioLeftTool = (props:any) => {
...
@@ -28,7 +29,7 @@ const StudioLeftTool = (props:any) => {
<
StudioDataBase
/>
<
StudioDataBase
/>
</
TabPane
>
</
TabPane
>
<
TabPane
tab=
{
<
span
><
AppstoreOutlined
/>
元数据
</
span
>
}
key=
"MetaData"
>
<
TabPane
tab=
{
<
span
><
AppstoreOutlined
/>
元数据
</
span
>
}
key=
"MetaData"
>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
<
StudioMetaData
/>
</
TabPane
>
</
TabPane
>
<
TabPane
tab=
{
<
span
><
FunctionOutlined
/>
函数
</
span
>
}
key=
"Function"
>
<
TabPane
tab=
{
<
span
><
FunctionOutlined
/>
函数
</
span
>
}
key=
"Function"
>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
...
...
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