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
e740150e
Unverified
Commit
e740150e
authored
Nov 13, 2022
by
高岩
Committed by
GitHub
Nov 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataStudio metadata add refesh button (#1253)
Co-authored-by: steve <woai1998>
parent
df106ae6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
14 deletions
+45
-14
index.tsx
...components/Studio/StudioLeftTool/StudioMetaData/index.tsx
+45
-14
No files found.
dlink-web/src/components/Studio/StudioLeftTool/StudioMetaData/index.tsx
View file @
e740150e
...
@@ -18,12 +18,19 @@
...
@@ -18,12 +18,19 @@
*/
*/
import
{
Button
,
Empty
,
Modal
,
Select
,
Tabs
,
Tag
,
Tree
}
from
"antd"
;
import
{
Button
,
Col
,
Empty
,
Modal
,
Row
,
Select
,
Spin
,
Tabs
,
Tag
,
Tree
}
from
"antd"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
useState
}
from
"react"
;
import
{
CodepenOutlined
,
DatabaseOutlined
,
DownOutlined
,
OrderedListOutlined
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
import
{
showMetaDataTable
}
from
"@/components/Studio/StudioEvent/DDL"
;
CodepenOutlined
,
DatabaseOutlined
,
DownOutlined
,
OrderedListOutlined
,
PoweroffOutlined
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
clearMetaDataTable
,
showMetaDataTable
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
import
Columns
from
"@/pages/DataBase/Columns"
;
import
Columns
from
"@/pages/DataBase/Columns"
;
import
Tables
from
"@/pages/DataBase/Tables"
;
import
Tables
from
"@/pages/DataBase/Tables"
;
...
@@ -42,12 +49,19 @@ const StudioMetaData = (props: any) => {
...
@@ -42,12 +49,19 @@ const StudioMetaData = (props: any) => {
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
[
modalVisit
,
setModalVisit
]
=
useState
(
false
);
const
[
modalVisit
,
setModalVisit
]
=
useState
(
false
);
const
[
row
,
setRow
]
=
useState
<
TreeDataNode
>
();
const
[
row
,
setRow
]
=
useState
<
TreeDataNode
>
();
const
[
loadingDatabase
,
setloadingDatabase
]
=
useState
(
false
);
const
onRefreshTreeData
=
(
databaseId
:
number
)
=>
{
const
onRefreshTreeData
=
(
databaseId
:
number
)
=>
{
if
(
!
databaseId
)
return
;
if
(
!
databaseId
)
{
setloadingDatabase
(
false
);
return
;
}
setloadingDatabase
(
true
);
setDatabaseId
(
databaseId
);
setDatabaseId
(
databaseId
);
const
res
=
showMetaDataTable
(
databaseId
);
const
res
=
showMetaDataTable
(
databaseId
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
setloadingDatabase
(
false
);
let
tables
=
result
.
datas
;
let
tables
=
result
.
datas
;
if
(
tables
)
{
if
(
tables
)
{
for
(
let
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
...
@@ -95,17 +109,34 @@ const StudioMetaData = (props: any) => {
...
@@ -95,17 +109,34 @@ const StudioMetaData = (props: any) => {
setRow
(
undefined
);
setRow
(
undefined
);
setModalVisit
(
false
);
setModalVisit
(
false
);
}
}
const
refeshDataBase
=
(
value
:
number
)
=>
{
if
(
!
databaseId
)
return
;
setloadingDatabase
(
true
);
clearMetaDataTable
(
databaseId
).
then
(
result
=>
{
onChangeDataBase
(
databaseId
);
})
};
return
(
return
(
<>
<
Spin
spinning=
{
loadingDatabase
}
delay=
{
500
}
>
<
Select
<
Row
>
style=
{
{
width
:
'90%'
}
}
<
Col
span=
{
18
}
>
placeholder=
"选择数据源"
<
Select
optionLabelProp=
"label"
style=
{
{
width
:
'90%'
}
}
onChange=
{
onChangeDataBase
}
placeholder=
"选择数据源"
>
optionLabelProp=
"label"
{
getDataBaseOptions
()
}
onChange=
{
onChangeDataBase
}
</
Select
>
>
{
getDataBaseOptions
()
}
</
Select
>
</
Col
>
<
Col
span=
{
1
}
>
<
Button
type=
"link"
onClick=
{
()
=>
{
refeshDataBase
(
databaseId
)}
}
>
{
l
(
'button.refresh'
)
}
</
Button
>
</
Col
>
</
Row
>
<
Scrollbars
style=
{
{
height
:
(
toolHeight
-
32
)}
}
>
<
Scrollbars
style=
{
{
height
:
(
toolHeight
-
32
)}
}
>
{
treeData
.
length
>
0
?
(
{
treeData
.
length
>
0
?
(
<
DirectoryTree
<
DirectoryTree
...
@@ -170,7 +201,7 @@ const StudioMetaData = (props: any) => {
...
@@ -170,7 +201,7 @@ const StudioMetaData = (props: any) => {
</
TabPane
>
</
TabPane
>
</
Tabs
>
</
Tabs
>
</
Modal
>
</
Modal
>
</>
</
Spin
>
);
);
};
};
...
...
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