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
9cb07085
Unverified
Commit
9cb07085
authored
Aug 04, 2023
by
Licho
Committed by
GitHub
Aug 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove metadata copy table cell (#2169)
* refactor: package uri wrong, and trivial optimization * feat: remove metadata table copy
parent
e12fe5b1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
43 deletions
+44
-43
index.tsx
dinky-web/src/components/Sidebar/MovableSidebar/index.tsx
+3
-2
index.tsx
...web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
+24
-26
index.tsx
dinky-web/src/pages/DataStudio/LeftContainer/index.tsx
+6
-4
model.ts
dinky-web/src/pages/DataStudio/model.ts
+10
-9
Index.tsx
...rceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx
+0
-1
index.tsx
...taSource/components/DataSourceDetail/SchemaTree/index.tsx
+1
-1
No files found.
dinky-web/src/components/Sidebar/MovableSidebar/index.tsx
View file @
9cb07085
...
...
@@ -38,6 +38,7 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
,
children
,
title
,
contentHeight
,
handlerMinimize
,
handlerMaxsize
,
tagList
}
=
props
;
const
[
showBtn
,
setShowBtn
]
=
useState
(
false
)
return
(
<
div
onMouseEnter=
{
()
=>
setShowBtn
(
true
)
}
onMouseLeave=
{
()
=>
setShowBtn
(
false
)
}
>
<
Resizable
...
...
@@ -72,7 +73,7 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
{
/*>*/
}
{
/* <div style={{height: contentHeight,marginBlock:-5,marginInline:-10}}>{children}</div>*/
}
{
/*</PageContainer>*/
}
<
Fragment
>
<>
<
div
style=
{
{
backgroundColor
:
token
.
colorBgBase
,
borderBlockColor
:
themeValue
.
borderColor
}
}
className=
{
"container-header"
}
>
<
div
>
{
title
}
</
div
>
{
/*<div style={{display:showBtn?"block":"none",animation: (showBtn?"show-anim":"hide-anim")+" 2s"}}>*/
}
...
...
@@ -84,7 +85,7 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
</
div
>
</
div
>
<
div
style=
{
{
height
:
contentHeight
,
backgroundColor
:
token
.
colorBgBase
}
}
>
{
children
}
</
div
>
</
Fragment
>
</>
</
Resizable
>
</
div
>
...
...
dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
View file @
9cb07085
...
...
@@ -17,7 +17,7 @@ const MetaData = (props: any) => {
const
{
dispatch
,
toolContentHeight
,
leftContainer
,
database
:
{
dbData
,
selectDatabaseId
,
expandKeys
,
selectKeys
}
}
=
props
;
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
[
loadingDatabase
,
set
LoadingDatabase
]
=
useState
(
false
);
const
[
isLoadingDatabase
,
setIs
LoadingDatabase
]
=
useState
(
false
);
const
selectDb
=
(
dbData
as
DataSources
.
DataSource
[]).
filter
(
x
=>
x
.
id
===
selectDatabaseId
)[
0
]
/**
...
...
@@ -26,33 +26,29 @@ const MetaData = (props: any) => {
*/
const
onRefreshTreeData
=
(
databaseId
:
number
)
=>
{
if
(
!
databaseId
)
{
setLoadingDatabase
(
false
);
set
Is
LoadingDatabase
(
false
);
return
;
}
setLoadingDatabase
(
true
);
set
Is
LoadingDatabase
(
true
);
const
res
=
showMetaDataTable
(
databaseId
);
res
.
then
((
tables
)
=>
{
setLoadingDatabase
(
false
);
if
(
tables
)
{
for
(
let
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
tables
[
i
].
title
=
tables
[
i
].
name
;
tables
[
i
].
key
=
tables
[
i
].
name
;
tables
[
i
].
icon
=
<
DatabaseOutlined
/>;
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
].
name
+
'.'
+
tables
[
i
].
children
[
j
].
name
;
tables
[
i
].
children
[
j
].
icon
=
<
TableOutlined
/>;
tables
[
i
].
children
[
j
].
isLeaf
=
true
;
tables
[
i
].
children
[
j
].
schema
=
tables
[
i
].
name
;
tables
[
i
].
children
[
j
].
table
=
tables
[
i
].
children
[
j
].
name
;
}
setIsLoadingDatabase
(
false
);
for
(
let
table
of
tables
)
{
table
.
title
=
table
.
name
;
table
.
key
=
table
.
name
;
table
.
icon
=
<
DatabaseOutlined
/>;
table
.
children
=
table
.
tables
;
for
(
let
child
of
table
.
children
)
{
child
.
title
=
child
.
name
;
child
.
key
=
table
.
name
+
'.'
+
child
.
name
;
child
.
icon
=
<
TableOutlined
/>;
child
.
isLeaf
=
true
;
child
.
schema
=
table
.
name
;
child
.
table
=
child
.
name
;
}
setTreeData
(
tables
);
}
else
{
setTreeData
([]);
}
setTreeData
(
tables
??
[]);
});
};
...
...
@@ -69,12 +65,13 @@ const MetaData = (props: any) => {
const
onChangeDataBase
=
(
value
:
number
)
=>
{
onRefreshTreeData
(
value
);
};
/**
* 刷新数据库列表
*/
const
refreshDataBase
=
()
=>
{
if
(
!
selectDatabaseId
)
return
;
setLoadingDatabase
(
true
);
set
Is
LoadingDatabase
(
true
);
clearMetaDataTable
(
selectDatabaseId
).
then
(()
=>
{
onChangeDataBase
(
selectDatabaseId
);
})
...
...
@@ -94,6 +91,7 @@ const MetaData = (props: any) => {
}
))
};
/**
* 树节点点击事件 添加tab页 并传递参数
* @param keys
...
...
@@ -106,6 +104,7 @@ const MetaData = (props: any) => {
type
:
"Studio/updateDatabaseSelectKey"
,
payload
:
keys
})
const
{
node
:
{
isLeaf
,
parentId
:
schemaName
,
name
:
tableName
,
fullInfo
}}
=
info
;
if
(
isLeaf
)
{
const
queryParams
=
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
...
...
@@ -148,12 +147,11 @@ const MetaData = (props: any) => {
return
(
<
Spin
spinning=
{
loadingDatabase
}
delay=
{
500
}
>
<
Spin
spinning=
{
isLoadingDatabase
}
delay=
{
500
}
>
<
ProForm
style=
{
{
height
:
40
}
}
initialValues=
{
{
selectDb
:
selectDatabaseId
}
}
submitter=
{
false
}
>
<
ProFormSelect
width=
{
leftContainer
.
width
-
45
}
addonAfter=
{
<
ReloadOutlined
spin=
{
l
oadingDatabase
}
title=
{
l
(
'button.refresh'
)
}
onClick=
{
()
=>
refreshDataBase
()
}
/>
}
addonAfter=
{
<
ReloadOutlined
spin=
{
isL
oadingDatabase
}
title=
{
l
(
'button.refresh'
)
}
onClick=
{
()
=>
refreshDataBase
()
}
/>
}
allowClear=
{
false
}
name=
{
"selectDb"
}
placeholder=
{
l
(
'pages.metadata.selectDatabase'
)
}
...
...
@@ -161,7 +159,7 @@ const MetaData = (props: any) => {
fieldProps=
{
{
onSelect
:
(
selectId
)
=>
handleSelectDataBaseId
(
selectId
as
number
)}
}
/>
</
ProForm
>
<
SchemaTree
selectKeys=
{
selectKeys
}
expandKeys=
{
expandKeys
}
style=
{
{
height
:
(
toolContentHeight
-
64
-
20
)}
}
onNodeClick=
{
handleTreeNodeClick
}
treeData=
{
treeData
}
onExpand=
{
handleTreeExpand
}
/>
<
SchemaTree
selectKeys=
{
selectKeys
}
expandKeys=
{
expandKeys
}
style=
{
{
height
:
(
toolContentHeight
-
64
-
20
)}
}
onNodeClick=
{
handleTreeNodeClick
}
treeData=
{
treeData
}
onExpand=
{
handleTreeExpand
}
/>
</
Spin
>
);
};
...
...
dinky-web/src/pages/DataStudio/LeftContainer/index.tsx
View file @
9cb07085
...
...
@@ -17,6 +17,8 @@ const LeftContainer:React.FC<LeftContainerProps> = (props:any) => {
const
{
toolContentHeight
,
leftContainer
,
rightContainer
}
=
props
const
MAX_WIDTH
=
size
.
width
-
2
*
VIEW
.
leftToolWidth
-
rightContainer
.
width
-
700
/**
* 侧边栏大小变化
* @param width
...
...
@@ -41,8 +43,8 @@ const LeftContainer:React.FC<LeftContainerProps> = (props:any) => {
/**
* 侧边栏最大化
*/
const
handleMaxsize
=
(
widthChangeValue
:
number
)
=>
{
handleReSizeChange
(
widthChangeValue
)
const
handleMaxsize
=
()
=>
{
handleReSizeChange
(
MAX_WIDTH
)
}
/**
...
...
@@ -54,11 +56,11 @@ const LeftContainer:React.FC<LeftContainerProps> = (props:any) => {
onResize
:
(
event
:
any
,
direction
:
any
,
elementRef
:
{
offsetWidth
:
any
;
})
=>
handleReSizeChange
(
elementRef
.
offsetWidth
),
title
:
<
Title
>
{
l
(
leftContainer
.
selectKey
)
}
</
Title
>,
handlerMinimize
:
()
=>
handleMinimize
(),
handlerMaxsize
:
()
=>
handleMaxsize
(
size
.
width
-
2
*
VIEW
.
leftToolWidth
-
rightContainer
.
width
-
700
),
handlerMaxsize
:
()
=>
handleMaxsize
(),
visible
:
leftContainer
.
selectKey
!==
""
,
defaultSize
:
{
width
:
leftContainer
.
width
,
height
:
leftContainer
.
height
},
minWidth
:
260
,
maxWidth
:
size
.
width
-
2
*
VIEW
.
leftToolWidth
-
rightContainer
.
width
-
700
,
//
maxWidth
:
MAX_WIDTH
,
//
enable
:
{
right
:
true
},
style
:{
borderInlineEnd
:
"1px solid "
+
themeValue
.
borderColor
}
}
...
...
dinky-web/src/pages/DataStudio/model.ts
View file @
9cb07085
...
...
@@ -465,7 +465,7 @@ const Model: ModelType = {
* @returns {{centerContentHeight: number, toolContentHeight: number, database: DataSources.DataSource[], tabs: {panes: TabsItemType[], activeKey: number}, isFullScreen: boolean, rightContainer: Container, leftContainer: Container, bottomContainer: Container}}
*/
addTab
(
state
,
{
payload
})
{
const
node
=
payload
as
TabsItemType
;
const
node
=
payload
as
TabsItemType
;
for
(
const
item
of
state
.
tabs
.
panes
)
{
if
(
item
.
id
===
node
.
id
)
{
return
{
...
...
@@ -477,14 +477,15 @@ const Model: ModelType = {
};
}
}
node
.
key
=
state
.
tabs
.
panes
.
length
===
0
?
"0"
:(
parseInt
(
state
.
tabs
.
panes
[
state
.
tabs
.
panes
.
length
-
1
].
key
)
+
1
).
toString
();
return
{
...
state
,
tabs
:
{
panes
:[...
state
.
tabs
.
panes
,
node
],
activeBreadcrumbTitle
:[
node
.
type
,
node
.
breadcrumbLabel
,
node
.
label
].
join
(
"/"
),
activeKey
:
node
.
key
,
},
node
.
key
=
state
.
tabs
.
panes
.
length
===
0
?
"0"
:(
parseInt
(
state
.
tabs
.
panes
[
state
.
tabs
.
panes
.
length
-
1
].
key
)
+
1
).
toString
();
return
{
...
state
,
tabs
:
{
panes
:[...
state
.
tabs
.
panes
,
node
],
activeBreadcrumbTitle
:[
node
.
type
,
node
.
breadcrumbLabel
,
node
.
label
].
join
(
"/"
),
activeKey
:
node
.
key
,
},
}
},
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx
View file @
9cb07085
...
...
@@ -41,7 +41,6 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
dataIndex
:
'name'
,
width
:
'10%'
,
ellipsis
:
true
,
copyable
:
true
,
},
{
title
:
l
(
'rc.ds.columnType'
),
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree/index.tsx
View file @
9cb07085
...
...
@@ -66,7 +66,7 @@ const SchemaTree: React.FC<SchemaTreeProps> = (props) => {
<
DirectoryTree
expandedKeys=
{
expandKeys
}
selectedKeys=
{
selectKeys
}
onExpand=
{
(
keys
)
=>
onExpand
(
keys
)
}
onExpand=
{
onExpand
}
style=
{
style
}
className=
{
'treeList'
}
onSelect=
{
onNodeClick
}
...
...
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