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
6c82d4a6
Unverified
Commit
6c82d4a6
authored
Nov 30, 2023
by
aiwenmo
Committed by
GitHub
Nov 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimization-2583][studio] Optimize project and data source switching (#2584)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
ccf84ae5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
26 deletions
+53
-26
index.tsx
...web/src/pages/DataStudio/BottomContainer/Result/index.tsx
+1
-1
index.tsx
dinky-web/src/pages/DataStudio/BottomContainer/index.tsx
+17
-12
function.ts
dinky-web/src/pages/DataStudio/function.ts
+13
-0
index.tsx
dinky-web/src/pages/DataStudio/index.tsx
+17
-9
index.tsx
...nents/DataSourceDetail/RightTagsRouter/SQLQuery/index.tsx
+2
-2
index.tsx
...nts/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
+2
-2
index.tsx
...rce/components/DataSourceDetail/RightTagsRouter/index.tsx
+1
-0
No files found.
dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx
View file @
6c82d4a6
...
...
@@ -170,7 +170,7 @@ const Result = (props: any) => {
useEffect
(()
=>
{
setData
({});
loadData
();
},
[
currentTabs
,
currentTabs
?.
console
.
result
]);
},
[
currentTabs
,
currentTabs
?.
console
?
.
result
]);
const
getColumns
=
(
columns
:
string
[])
=>
{
return
columns
?.
map
((
item
)
=>
{
...
...
dinky-web/src/pages/DataStudio/BottomContainer/index.tsx
View file @
6c82d4a6
...
...
@@ -28,14 +28,16 @@ import { connect } from '@@/exports';
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ConfigProvider
,
Space
,
Tabs
}
from
'antd'
;
import
React
from
'react'
;
import
{
isProjectTabs
}
from
"@/pages/DataStudio/function"
;
export
type
BottomContainerProps
=
{
size
:
number
;
height
:
number
|
string
;
};
const
BottomContainer
:
React
.
FC
<
BottomContainerProps
>
=
(
props
:
any
)
=>
{
const
{
dispatch
,
size
,
bottomContainer
,
height
}
=
props
;
const
{
dispatch
,
size
,
bottomContainer
,
height
,
tabs
:
{
panes
,
activeKey
},
}
=
props
;
const
width
=
document
.
documentElement
.
clientWidth
-
VIEW
.
sideWidth
*
2
;
const
isProject
=
isProjectTabs
(
panes
,
activeKey
);
/**
* 侧边栏最小化
...
...
@@ -200,7 +202,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
marginTop
:
0
,
backgroundColor
:
'#fff'
,
position
:
'fixed'
,
bottom
:
VIEW
.
footerHeight
//
bottom: VIEW.footerHeight
}
}
defaultSize=
{
{
width
:
'100%'
,
height
:
height
}
}
minHeight=
{
VIEW
.
midMargin
}
...
...
@@ -217,21 +219,24 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
handlerMinimize=
{
handleMinimize
}
maxWidth=
{
width
}
>
<
Tabs
{
!
isProject
&&
<
Tabs
activeKey=
{
bottomContainer
.
selectKey
+
'/'
+
(
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
?
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
:
''
)
}
bottomContainer
.
selectKey
+
'/'
+
(
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
?
bottomContainer
.
selectSubKey
[
bottomContainer
.
selectKey
]
:
''
)
}
items=
{
renderItems
()
}
tabBarStyle=
{
{
display
:
'none'
}
}
/>
tabBarStyle=
{
{
display
:
'none'
}
}
/>
}
</
MovableSidebar
>
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
bottomContainer
:
Studio
.
bottomContainer
bottomContainer
:
Studio
.
bottomContainer
,
tabs
:
Studio
.
tabs
}))(
BottomContainer
);
dinky-web/src/pages/DataStudio/function.ts
View file @
6c82d4a6
...
...
@@ -152,6 +152,19 @@ export function getCurrentTab(
}
}
export
function
isProjectTabs
(
panes
:
TabsItemType
[],
activeKey
:
string
):
boolean
{
const
item
=
panes
.
find
((
item
)
=>
item
.
key
===
activeKey
);
switch
(
item
?.
type
)
{
case
'project'
:
return
true
;
default
:
return
false
;
}
}
export
function
getTabByTaskId
(
panes
:
TabsItemType
[],
id
:
number
...
...
dinky-web/src/pages/DataStudio/index.tsx
View file @
6c82d4a6
...
...
@@ -22,13 +22,13 @@ import { useEditor } from '@/hooks/useEditor';
import
useThemeValue
from
'@/hooks/useThemeValue'
;
import
BottomContainer
from
'@/pages/DataStudio/BottomContainer'
;
import
FooterContainer
from
'@/pages/DataStudio/FooterContainer'
;
import
{
mapDispatchToProps
}
from
'@/pages/DataStudio/function'
;
import
{
isProjectTabs
,
mapDispatchToProps
}
from
'@/pages/DataStudio/function'
;
import
SecondHeaderContainer
from
'@/pages/DataStudio/HeaderContainer'
;
import
LeftContainer
from
'@/pages/DataStudio/LeftContainer'
;
import
{
getDataSourceList
}
from
'@/pages/DataStudio/LeftContainer/DataSource/service'
;
import
{
getTaskData
}
from
'@/pages/DataStudio/LeftContainer/Project/service'
;
import
MiddleContainer
from
'@/pages/DataStudio/MiddleContainer'
;
import
{
StateType
,
TabsItemType
,
TabsPageType
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
,
STUDIO_MODEL
,
TabsItemType
,
TabsPageType
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
RightContainer
from
'@/pages/DataStudio/RightContainer'
;
import
{
getClusterConfigurationData
,
...
...
@@ -54,6 +54,7 @@ const DataStudio = (props: any) => {
saveDataBase
,
saveProject
,
updateToolContentHeight
,
updateBottomHeight
,
saveSession
,
saveEnv
,
updateCenterContentHeight
,
...
...
@@ -63,14 +64,14 @@ const DataStudio = (props: any) => {
saveClusterConfiguration
,
activeBreadcrumbTitle
,
updateSelectBottomSubKey
,
tabs
tabs
:
{
panes
,
activeKey
},
}
=
props
;
const
isProject
=
isProjectTabs
(
panes
,
activeKey
);
const
{
token
}
=
useToken
();
const
themeValue
=
useThemeValue
();
const
app
=
getDvaApp
();
// 获取dva的实例
const
persist
=
app
.
_store
.
persist
;
const
bottomHeight
=
bottomContainer
.
selectKey
===
''
?
0
:
bottomContainer
.
height
;
let
bottomHeight
=
!
isProject
?
0
:
bottomContainer
.
selectKey
===
''
?
0
:
bottomContainer
.
height
;
const
{
fullscreen
}
=
useEditor
();
const
getClientSize
=
()
=>
({
...
...
@@ -115,6 +116,13 @@ const DataStudio = (props: any) => {
});
};
useEffect
(()
=>
{
bottomHeight
=
!
isProject
?
0
:
bottomContainer
.
selectKey
===
''
?
0
:
bottomContainer
.
height
;
const
centerContentHeight
=
size
.
contentHeight
-
bottomHeight
;
updateCenterContentHeight
(
centerContentHeight
);
updateToolContentHeight
(
centerContentHeight
-
VIEW
.
leftMargin
);
},
[
activeKey
]);
useEffect
(()
=>
{
loadData
();
},
[]);
...
...
@@ -185,10 +193,10 @@ const DataStudio = (props: any) => {
if
(
!
x
.
isShow
)
{
return
true
;
}
if
(
parseInt
(
tabs
.
activeKey
)
<
0
)
{
if
(
parseInt
(
activeKey
)
<
0
)
{
return
TabsPageType
.
None
;
}
const
v
=
(
tabs
.
panes
as
TabsItemType
[]).
find
((
item
)
=>
item
.
key
===
tabs
.
activeKey
);
const
v
=
(
panes
as
TabsItemType
[]).
find
((
item
)
=>
item
.
key
===
activeKey
);
return
x
.
isShow
(
v
?.
type
??
TabsPageType
.
None
,
v
?.
subType
);
})
.
map
((
x
)
=>
{
...
...
@@ -218,7 +226,7 @@ const DataStudio = (props: any) => {
<
Sider
collapsed
collapsedWidth=
{
40
}
>
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
height
:
'100%'
}
}
>
{
LeftTopMenu
}
{
LeftBottomMenu
}
{
isProject
&&
LeftBottomMenu
}
</
div
>
</
Sider
>
...
...
@@ -239,7 +247,7 @@ const DataStudio = (props: any) => {
</
Content
>
<
RightContainer
size=
{
size
}
bottomHeight=
{
bottomHeight
}
/>
</
div
>
{
<
BottomContainer
size=
{
size
}
height=
{
bottomHeight
}
/>
}
{
isProject
&&
<
BottomContainer
size=
{
size
}
height=
{
bottomHeight
}
/>
}
</
Content
>
<
Sider
collapsed
collapsedWidth=
{
40
}
>
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery/index.tsx
View file @
6c82d4a6
...
...
@@ -140,7 +140,7 @@ const SQLQuery: React.FC<SQLQueryProps> = (props) => {
* render
*/
return
(
<
Height80VHDiv
>
<>
{
dbId
&&
tableName
&&
schemaName
?
(
<
ProTable
bordered
...
...
@@ -166,7 +166,7 @@ const SQLQuery: React.FC<SQLQueryProps> = (props) => {
)
:
(
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
)
}
</
Height80VHDiv
>
</>
);
};
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
View file @
6c82d4a6
...
...
@@ -34,7 +34,7 @@ const SchemaDesc: React.FC<SchemaDescProps> = (props) => {
const
{
tableInfo
,
tableColumns
}
=
props
;
return
(
<
Height80VHDiv
>
<>
{
!
(
Object
.
keys
(
tableInfo
).
length
===
0
&&
tableColumns
.
length
===
0
)
?
(
<>
<
TableInfo
tableInfo=
{
tableInfo
}
/>
...
...
@@ -43,7 +43,7 @@ const SchemaDesc: React.FC<SchemaDescProps> = (props) => {
)
:
(
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
)
}
</
Height80VHDiv
>
</>
);
};
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/index.tsx
View file @
6c82d4a6
...
...
@@ -104,6 +104,7 @@ const RightTagsRouter: React.FC<RightTagsRouterProps> = (props) => {
{
l
(
'rc.ds.detail.tag.console'
)
}
</
Space
>
),
disabled
:
true
,
children
:
<
SQLConsole
/>
}
];
...
...
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