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
f1ef316e
Unverified
Commit
f1ef316e
authored
Dec 18, 2023
by
ZackYoung
Committed by
GitHub
Dec 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize_container_left_top_button (#2678)
parent
6edf22b0
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
189 additions
and
83 deletions
+189
-83
index.tsx
...b/src/pages/DataStudio/LeftContainer/BtnContext/index.tsx
+127
-0
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx
+11
-3
index.tsx
...b/src/pages/DataStudio/LeftContainer/DataSource/index.tsx
+12
-3
index.tsx
.../pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
+13
-5
index.tsx
...s/DataStudio/LeftContainer/Project/ProjectTitle/index.tsx
+10
-3
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
+3
-0
index.tsx
dinky-web/src/pages/DataStudio/LeftContainer/index.tsx
+6
-4
index.tsx
dinky-web/src/pages/DataStudio/index.tsx
+6
-2
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+1
-63
No files found.
dinky-web/src/pages/DataStudio/LeftContainer/BtnContext/index.tsx
0 → 100644
View file @
f1ef316e
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
CircleDataStudioButtonProps
}
from
"@/components/CallBackButton/CircleBtn"
;
import
{
ArrowsAltOutlined
,
EnvironmentOutlined
,
PlusCircleOutlined
,
PlusOutlined
,
ReloadOutlined
,
ShrinkOutlined
}
from
"@ant-design/icons"
;
import
{
l
}
from
"@/utils/intl"
;
import
React
,
{
createContext
,
useContext
,
useReducer
}
from
"react"
;
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
'menu.datastudio.datasource'
:
[
{
icon
:
<
PlusOutlined
/>,
title
:
l
(
'button.create'
),
onClick
:
()
=>
{
}
},
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{
}
}
],
'menu.datastudio.catalog'
:
[
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{
}
}
],
'menu.datastudio.project'
:
[
{
icon
:
<
PlusCircleOutlined
/>,
title
:
l
(
'right.menu.createRoot'
),
key
:
'right.menu.createRoot'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
ArrowsAltOutlined
/>,
title
:
l
(
'button.expand-all'
),
key
:
'button.expand-all'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
ShrinkOutlined
/>,
title
:
l
(
'button.collapse-all'
),
key
:
'button.collapse-all'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
EnvironmentOutlined
/>,
title
:
l
(
'button.position'
),
key
:
'button.position'
,
onClick
:
()
=>
{
}
}
]
};
type
BtnAction
=
{
type
:
'change'
,
selectKey
:
string
,
payload
:
CircleDataStudioButtonProps
[]
}
export
const
BtnContext
=
createContext
(
BtnRoute
);
const
BtnDispatchContext
=
createContext
((
params
:
BtnAction
)
=>
{
});
export
function
useTasksDispatch
()
{
return
useContext
(
BtnDispatchContext
);
}
function
BtnReducer
(
state
=
BtnRoute
,
action
:
BtnAction
)
{
switch
(
action
.
type
)
{
case
'change'
:
{
return
{...
state
,
[
action
.
selectKey
]:
action
.
payload
}
}
default
:
return
{...
state
}
}
}
// @ts-ignore
export
function
BtnProvider
({
children
})
{
const
[
btn
,
dispatch
]
=
useReducer
(
BtnReducer
,
BtnRoute
);
return
(
<
BtnContext
.
Provider
value=
{
btn
}
>
<
BtnDispatchContext
.
Provider
value=
{
dispatch
}
>
{
children
}
</
BtnDispatchContext
.
Provider
>
</
BtnContext
.
Provider
>
);
}
\ No newline at end of file
dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx
View file @
f1ef316e
...
@@ -21,7 +21,6 @@ import { getCurrentData } from '@/pages/DataStudio/function';
...
@@ -21,7 +21,6 @@ import { getCurrentData } from '@/pages/DataStudio/function';
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
TableDataNode
}
from
'@/pages/DataStudio/LeftContainer/Catalog/data'
;
import
{
TableDataNode
}
from
'@/pages/DataStudio/LeftContainer/Catalog/data'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
...
@@ -39,8 +38,9 @@ import { Button, Col, Empty, Modal, Row, Select, Spin, Tabs } from 'antd';
...
@@ -39,8 +38,9 @@ import { Button, Col, Empty, Modal, Row, Select, Spin, Tabs } from 'antd';
import
{
DataNode
}
from
'antd/es/tree'
;
import
{
DataNode
}
from
'antd/es/tree'
;
import
DirectoryTree
from
'antd/es/tree/DirectoryTree'
;
import
DirectoryTree
from
'antd/es/tree/DirectoryTree'
;
import
{
DefaultOptionType
}
from
'rc-select/lib/Select'
;
import
{
DefaultOptionType
}
from
'rc-select/lib/Select'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
getMSCatalogs
,
getMSColumns
,
getMSSchemaInfo
}
from
'./service'
;
import
{
getMSCatalogs
,
getMSColumns
,
getMSSchemaInfo
}
from
'./service'
;
import
{
BtnRoute
,
useTasksDispatch
}
from
"@/pages/DataStudio/LeftContainer/BtnContext"
;
const
Catalog
:
React
.
FC
=
(
props
:
connect
)
=>
{
const
Catalog
:
React
.
FC
=
(
props
:
connect
)
=>
{
const
{
tabs
}
=
props
;
const
{
tabs
}
=
props
;
...
@@ -75,10 +75,18 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -75,10 +75,18 @@ const Catalog: React.FC = (props: connect) => {
const
[
row
,
setRow
]
=
useState
<
TableDataNode
>
();
const
[
row
,
setRow
]
=
useState
<
TableDataNode
>
();
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
columnData
,
setColumnData
]
=
useState
([]);
const
[
columnData
,
setColumnData
]
=
useState
([]);
const
btnDispatch
=
useTasksDispatch
();
const
currentTabName
=
'menu.datastudio.catalog'
;
const
btnEvent
=
[...
BtnRoute
[
currentTabName
]];
BtnRoute
[
'menu.datastudio.catalog'
]
[
0
].
onClick
=
()
=>
{
btnEvent
[
0
].
onClick
=
()
=>
{
refreshMetaStoreTables
();
refreshMetaStoreTables
();
};
};
btnDispatch
({
type
:
'change'
,
selectKey
:
currentTabName
,
payload
:
btnEvent
})
useEffect
(()
=>
{
useEffect
(()
=>
{
getCatalogs
();
getCatalogs
();
...
...
dinky-web/src/pages/DataStudio/LeftContainer/DataSource/index.tsx
View file @
f1ef316e
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
*/
*/
import
{
TagAlignLeft
}
from
'@/components/StyledComponents'
;
import
{
TagAlignLeft
}
from
'@/components/StyledComponents'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
SchemaTree
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree'
;
import
SchemaTree
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree'
;
import
DataSourceModal
from
'@/pages/RegCenter/DataSource/components/DataSourceModal'
;
import
DataSourceModal
from
'@/pages/RegCenter/DataSource/components/DataSourceModal'
;
import
{
handleTest
,
saveOrUpdateHandle
}
from
'@/pages/RegCenter/DataSource/service'
;
import
{
handleTest
,
saveOrUpdateHandle
}
from
'@/pages/RegCenter/DataSource/service'
;
...
@@ -31,6 +30,7 @@ import { Spin, Tag } from 'antd';
...
@@ -31,6 +30,7 @@ import { Spin, Tag } from 'antd';
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
import
{
clearDataSourceTable
,
getDataSourceList
,
showDataSourceTable
}
from
'./service'
;
import
{
clearDataSourceTable
,
getDataSourceList
,
showDataSourceTable
}
from
'./service'
;
import
{
BtnRoute
,
useTasksDispatch
}
from
"@/pages/DataStudio/LeftContainer/BtnContext"
;
const
DataSource
=
(
props
:
any
)
=>
{
const
DataSource
=
(
props
:
any
)
=>
{
const
{
const
{
...
@@ -42,6 +42,7 @@ const DataSource = (props: any) => {
...
@@ -42,6 +42,7 @@ const DataSource = (props: any) => {
const
[
isLoadingDatabase
,
setIsLoadingDatabase
]
=
useState
(
false
);
const
[
isLoadingDatabase
,
setIsLoadingDatabase
]
=
useState
(
false
);
const
[
showCreate
,
setShowCreate
]
=
useState
(
false
);
const
[
showCreate
,
setShowCreate
]
=
useState
(
false
);
const
selectDb
=
(
dbData
as
DataSources
.
DataSource
[]).
filter
((
x
)
=>
x
.
id
===
selectDatabaseId
)[
0
];
const
selectDb
=
(
dbData
as
DataSources
.
DataSource
[]).
filter
((
x
)
=>
x
.
id
===
selectDatabaseId
)[
0
];
const
btnDispatch
=
useTasksDispatch
();
/**
/**
* @description: 刷新树数据
* @description: 刷新树数据
...
@@ -87,17 +88,25 @@ const DataSource = (props: any) => {
...
@@ -87,17 +88,25 @@ const DataSource = (props: any) => {
const
onChangeDataBase
=
(
value
:
number
)
=>
{
const
onChangeDataBase
=
(
value
:
number
)
=>
{
onRefreshTreeData
(
value
);
onRefreshTreeData
(
value
);
};
};
const
currentTabName
=
'menu.datastudio.datasource'
;
BtnRoute
[
'menu.datastudio.datasource'
][
0
].
onClick
=
()
=>
{
const
btnEvent
=
[...
BtnRoute
[
currentTabName
]];
btnEvent
[
0
].
onClick
=
()
=>
{
setShowCreate
(
true
);
setShowCreate
(
true
);
};
};
BtnRoute
[
'menu.datastudio.datasource'
]
[
1
].
onClick
=
()
=>
{
btnEvent
[
1
].
onClick
=
()
=>
{
if
(
!
selectDatabaseId
)
return
;
if
(
!
selectDatabaseId
)
return
;
setIsLoadingDatabase
(
true
);
setIsLoadingDatabase
(
true
);
clearDataSourceTable
(
selectDatabaseId
).
then
(()
=>
{
clearDataSourceTable
(
selectDatabaseId
).
then
(()
=>
{
onChangeDataBase
(
selectDatabaseId
);
onChangeDataBase
(
selectDatabaseId
);
});
});
};
};
btnDispatch
({
type
:
'change'
,
selectKey
:
currentTabName
,
payload
:
btnEvent
})
/**
/**
* 构建数据库列表 下拉框
* 构建数据库列表 下拉框
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
View file @
f1ef316e
...
@@ -25,13 +25,13 @@ import {
...
@@ -25,13 +25,13 @@ import {
getParentKey
getParentKey
}
from
'@/pages/DataStudio/LeftContainer/Project/function'
;
}
from
'@/pages/DataStudio/LeftContainer/Project/function'
;
import
{
StateType
,
STUDIO_MODEL
,
TabsItemType
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
,
STUDIO_MODEL
,
TabsItemType
}
from
'@/pages/DataStudio/model'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
connect
}
from
'@@/exports'
;
import
{
connect
}
from
'@@/exports'
;
import
{
Key
}
from
'@ant-design/pro-components'
;
import
{
Key
}
from
'@ant-design/pro-components'
;
import
{
Empty
,
Tree
}
from
'antd'
;
import
{
Empty
,
Tree
}
from
'antd'
;
import
Search
from
'antd/es/input/Search'
;
import
Search
from
'antd/es/input/Search'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
BtnRoute
,
useTasksDispatch
}
from
'../../BtnContext'
;
const
{
DirectoryTree
}
=
Tree
;
const
{
DirectoryTree
}
=
Tree
;
...
@@ -60,6 +60,8 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
...
@@ -60,6 +60,8 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
const
[
searchValue
,
setSearchValueValue
]
=
useState
(
''
);
const
[
searchValue
,
setSearchValueValue
]
=
useState
(
''
);
const
[
data
,
setData
]
=
useState
<
any
[]
>
(
buildProjectTree
(
projectData
,
searchValue
));
const
[
data
,
setData
]
=
useState
<
any
[]
>
(
buildProjectTree
(
projectData
,
searchValue
));
const
btnDispatch
=
useTasksDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
setData
(
buildProjectTree
(
projectData
,
searchValue
));
setData
(
buildProjectTree
(
projectData
,
searchValue
));
...
@@ -101,7 +103,8 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
...
@@ -101,7 +103,8 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
});
});
};
};
const
btn
=
BtnRoute
[
'menu.datastudio.project'
];
const
currentTabName
=
'menu.datastudio.project'
;
const
btnEvent
=
[...
BtnRoute
[
currentTabName
]];
const
positionKey
=
(
panes
:
TabsItemType
[],
activeKey
:
string
)
=>
{
const
positionKey
=
(
panes
:
TabsItemType
[],
activeKey
:
string
)
=>
{
const
treeKey
=
getCurrentTab
(
panes
,
activeKey
)?.
treeKey
;
const
treeKey
=
getCurrentTab
(
panes
,
activeKey
)?.
treeKey
;
if
(
treeKey
)
{
if
(
treeKey
)
{
...
@@ -123,14 +126,19 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
...
@@ -123,14 +126,19 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
}
}
};
};
btn
[
1
].
onClick
=
expandAll
;
btn
Event
[
1
].
onClick
=
expandAll
;
btn
[
2
].
onClick
=
()
=>
btn
Event
[
2
].
onClick
=
()
=>
dispatch
({
dispatch
({
type
:
STUDIO_MODEL
.
updateProjectExpandKey
,
type
:
STUDIO_MODEL
.
updateProjectExpandKey
,
payload
:
[]
payload
:
[]
});
});
btn
[
3
].
onClick
=
positionKey
;
btnEvent
[
3
].
onClick
=
positionKey
;
btnDispatch
({
type
:
'change'
,
selectKey
:
currentTabName
,
payload
:
btnEvent
})
return
(
return
(
<>
<>
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/ProjectTitle/index.tsx
View file @
f1ef316e
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
import
Title
from
'@/components/Front/Title'
;
import
Title
from
'@/components/Front/Title'
;
import
FolderModal
from
'@/pages/DataStudio/LeftContainer/Project/FolderModal'
;
import
FolderModal
from
'@/pages/DataStudio/LeftContainer/Project/FolderModal'
;
import
{
StateType
,
STUDIO_MODEL_ASYNC
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
,
STUDIO_MODEL_ASYNC
}
from
'@/pages/DataStudio/model'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
{
handleAddOrUpdate
}
from
'@/services/BusinessCrud'
;
import
{
handleAddOrUpdate
}
from
'@/services/BusinessCrud'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Catalogue
}
from
'@/types/Studio/data'
;
import
{
Catalogue
}
from
'@/types/Studio/data'
;
...
@@ -28,6 +27,7 @@ import { l } from '@/utils/intl';
...
@@ -28,6 +27,7 @@ import { l } from '@/utils/intl';
import
{
connect
}
from
'@umijs/max'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Space
}
from
'antd'
;
import
{
Space
}
from
'antd'
;
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
BtnRoute
,
useTasksDispatch
}
from
"@/pages/DataStudio/LeftContainer/BtnContext"
;
const
ProjectTitle
:
React
.
FC
<
StateType
&
connect
>
=
(
props
)
=>
{
const
ProjectTitle
:
React
.
FC
<
StateType
&
connect
>
=
(
props
)
=>
{
const
{
const
{
...
@@ -36,6 +36,7 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
...
@@ -36,6 +36,7 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
}
=
props
;
}
=
props
;
const
[
createModalVisible
,
handleModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
createModalVisible
,
handleModalVisible
]
=
useState
<
boolean
>
(
false
);
const
btnDispatch
=
useTasksDispatch
();
const
handleCancelCreate
=
async
()
=>
{
const
handleCancelCreate
=
async
()
=>
{
handleModalVisible
(
false
);
handleModalVisible
(
false
);
...
@@ -66,15 +67,21 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
...
@@ -66,15 +67,21 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
);
);
};
};
const
btn
=
BtnRoute
[
'menu.datastudio.project'
];
const
currentTabName
=
'menu.datastudio.project'
;
const
btn
=
BtnRoute
[
currentTabName
];
btn
[
0
].
onClick
=
()
=>
handleCreateClick
();
btn
[
0
].
onClick
=
()
=>
handleCreateClick
();
btnDispatch
({
type
:
'change'
,
selectKey
:
currentTabName
,
payload
:
btn
})
/**
/**
* 渲染侧边栏标题
* 渲染侧边栏标题
* @returns {JSX.Element}
* @returns {JSX.Element}
*/
*/
const
renderTitle
=
()
=>
{
const
renderTitle
=
()
=>
{
if
(
selectKey
&&
selectKey
===
'menu.datastudio.project'
)
{
if
(
selectKey
&&
selectKey
===
currentTabName
)
{
return
(
return
(
<
Space
>
<
Space
>
<
Title
>
{
l
(
selectKey
)
}
</
Title
>
<
Title
>
{
l
(
selectKey
)
}
</
Title
>
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx
View file @
f1ef316e
...
@@ -53,6 +53,7 @@ import { Modal, Typography } from 'antd';
...
@@ -53,6 +53,7 @@ import { Modal, Typography } from 'antd';
import
{
MenuInfo
}
from
'rc-menu/es/interface'
;
import
{
MenuInfo
}
from
'rc-menu/es/interface'
;
import
React
,
{
Key
,
useEffect
,
useState
}
from
'react'
;
import
React
,
{
Key
,
useEffect
,
useState
}
from
'react'
;
import
{
connect
}
from
'umi'
;
import
{
connect
}
from
'umi'
;
import
{
useTasksDispatch
}
from
"@/pages/DataStudio/LeftContainer/BtnContext"
;
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
...
@@ -64,6 +65,8 @@ const Project: React.FC = (props: connect) => {
...
@@ -64,6 +65,8 @@ const Project: React.FC = (props: connect) => {
}
=
props
;
}
=
props
;
const
[
projectState
,
setProjectState
]
=
useState
<
ProjectState
>
(
InitProjectState
);
const
[
projectState
,
setProjectState
]
=
useState
<
ProjectState
>
(
InitProjectState
);
const
btnDispatch
=
useTasksDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
setProjectState
((
prevState
)
=>
({
setProjectState
((
prevState
)
=>
({
...
...
dinky-web/src/pages/DataStudio/LeftContainer/index.tsx
View file @
f1ef316e
...
@@ -22,10 +22,11 @@ import MovableSidebar, { MovableSidebarProps } from '@/components/Sidebar/Movabl
...
@@ -22,10 +22,11 @@ import MovableSidebar, { MovableSidebarProps } from '@/components/Sidebar/Movabl
import
useThemeValue
from
'@/hooks/useThemeValue'
;
import
useThemeValue
from
'@/hooks/useThemeValue'
;
import
ProjectTitle
from
'@/pages/DataStudio/LeftContainer/Project/ProjectTitle'
;
import
ProjectTitle
from
'@/pages/DataStudio/LeftContainer/Project/ProjectTitle'
;
import
{
StateType
,
STUDIO_MODEL
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
,
STUDIO_MODEL
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
{
BtnRoute
,
LeftSide
}
from
'@/pages/DataStudio/route'
;
import
{
LeftSide
}
from
'@/pages/DataStudio/route'
;
import
{
connect
}
from
'@@/exports'
;
import
{
connect
}
from
'@@/exports'
;
import
{
Tabs
}
from
'antd'
;
import
{
Tabs
}
from
'antd'
;
import
React
from
'react'
;
import
React
,
{
useContext
}
from
'react'
;
import
{
BtnContext
}
from
"@/pages/DataStudio/LeftContainer/BtnContext"
;
export
type
LeftContainerProps
=
{
export
type
LeftContainerProps
=
{
size
:
number
;
size
:
number
;
...
@@ -41,6 +42,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
...
@@ -41,6 +42,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
rightContainer
,
rightContainer
,
tabs
:
{
panes
,
activeKey
}
tabs
:
{
panes
,
activeKey
}
}
=
props
;
}
=
props
;
const
btn
=
useContext
(
BtnContext
);
const
themeValue
=
useThemeValue
();
const
themeValue
=
useThemeValue
();
const
MAX_WIDTH
=
size
.
width
-
2
*
VIEW
.
leftToolWidth
-
rightContainer
.
width
-
700
;
const
MAX_WIDTH
=
size
.
width
-
2
*
VIEW
.
leftToolWidth
-
rightContainer
.
width
-
700
;
/**
/**
...
@@ -87,8 +89,8 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
...
@@ -87,8 +89,8 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
minWidth
:
160
,
minWidth
:
160
,
maxWidth
:
MAX_WIDTH
,
maxWidth
:
MAX_WIDTH
,
enable
:
{
right
:
true
},
enable
:
{
right
:
true
},
btnGroup
:
BtnRoute
[
leftContainer
.
selectKey
]
btnGroup
:
btn
[
leftContainer
.
selectKey
]
?
BtnRoute
[
leftContainer
.
selectKey
].
map
((
item
:
CircleDataStudioButtonProps
)
=>
(
?
btn
[
leftContainer
.
selectKey
].
map
((
item
:
CircleDataStudioButtonProps
)
=>
(
<
CircleBtn
<
CircleBtn
title=
{
item
.
title
}
title=
{
item
.
title
}
icon=
{
item
.
icon
}
icon=
{
item
.
icon
}
...
...
dinky-web/src/pages/DataStudio/index.tsx
View file @
f1ef316e
...
@@ -48,6 +48,8 @@ import { Layout, Menu, theme } from 'antd';
...
@@ -48,6 +48,8 @@ import { Layout, Menu, theme } from 'antd';
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
PersistGate
}
from
'redux-persist/integration/react'
;
import
{
PersistGate
}
from
'redux-persist/integration/react'
;
import
{
connect
,
getDvaApp
}
from
'umi'
;
import
{
connect
,
getDvaApp
}
from
'umi'
;
import
{
BtnProvider
}
from
"@/pages/DataStudio/LeftContainer/BtnContext"
;
import
{
useAsyncEffect
}
from
"ahooks"
;
const
{
Sider
,
Content
}
=
Layout
;
const
{
Sider
,
Content
}
=
Layout
;
...
@@ -138,8 +140,8 @@ const DataStudio = (props: any) => {
...
@@ -138,8 +140,8 @@ const DataStudio = (props: any) => {
updateToolContentHeight
(
centerContentHeight
-
VIEW
.
leftMargin
);
updateToolContentHeight
(
centerContentHeight
-
VIEW
.
leftMargin
);
},
[
activeKey
,
panes
]);
},
[
activeKey
,
panes
]);
use
Effect
(
()
=>
{
use
AsyncEffect
(
async
()
=>
{
loadData
();
await
loadData
();
},
[]);
},
[]);
const
access
=
useAccess
();
const
access
=
useAccess
();
...
@@ -277,11 +279,13 @@ const DataStudio = (props: any) => {
...
@@ -277,11 +279,13 @@ const DataStudio = (props: any) => {
<
Content
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
minWidth
:
0
}
}
>
<
Content
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
minWidth
:
0
}
}
>
<
div
style=
{
{
display
:
'flex'
}
}
>
<
div
style=
{
{
display
:
'flex'
}
}
>
<
BtnProvider
>
<
LeftContainer
<
LeftContainer
size=
{
size
}
size=
{
size
}
leftContainer=
{
leftContainer
}
leftContainer=
{
leftContainer
}
rightContainer=
{
rightContainer
}
rightContainer=
{
rightContainer
}
/>
/>
</
BtnProvider
>
<
Content
<
Content
style=
{
{
style=
{
{
width
:
width
:
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
f1ef316e
...
@@ -18,8 +18,7 @@
...
@@ -18,8 +18,7 @@
*/
*/
import
{
import
{
CircleBottomButtonProps
,
CircleBottomButtonProps
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
}
from
'@/components/CallBackButton/CircleBtn'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
JobExecHistory
from
'@/pages/DataStudio/BottomContainer/JobExecHistory'
;
import
JobExecHistory
from
'@/pages/DataStudio/BottomContainer/JobExecHistory'
;
...
@@ -43,23 +42,17 @@ import {DIALECT} from '@/services/constants';
...
@@ -43,23 +42,17 @@ import {DIALECT} from '@/services/constants';
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
import
{
ApartmentOutlined
,
ApartmentOutlined
,
ArrowsAltOutlined
,
ConsoleSqlOutlined
,
ConsoleSqlOutlined
,
DatabaseOutlined
,
DatabaseOutlined
,
EnvironmentOutlined
,
FolderOutlined
,
FolderOutlined
,
FunctionOutlined
,
FunctionOutlined
,
HistoryOutlined
,
HistoryOutlined
,
InfoCircleOutlined
,
InfoCircleOutlined
,
InsertRowRightOutlined
,
InsertRowRightOutlined
,
MonitorOutlined
,
MonitorOutlined
,
PlusCircleOutlined
,
PlusOutlined
,
ReloadOutlined
,
RightSquareOutlined
,
RightSquareOutlined
,
RotateRightOutlined
,
RotateRightOutlined
,
SettingOutlined
,
SettingOutlined
,
ShrinkOutlined
,
TableOutlined
,
TableOutlined
,
ToolOutlined
ToolOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
...
@@ -250,61 +243,6 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
...
@@ -250,61 +243,6 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
]
]
};
};
// btn route
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
'menu.datastudio.datasource'
:
[
{
icon
:
<
PlusOutlined
/>,
title
:
l
(
'button.create'
),
onClick
:
()
=>
{
}
},
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{
}
}
],
'menu.datastudio.catalog'
:
[
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{
}
}
],
'menu.datastudio.project'
:
[
{
icon
:
<
PlusCircleOutlined
/>,
title
:
l
(
'right.menu.createRoot'
),
key
:
'right.menu.createRoot'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
ArrowsAltOutlined
/>,
title
:
l
(
'button.expand-all'
),
key
:
'button.expand-all'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
ShrinkOutlined
/>,
title
:
l
(
'button.collapse-all'
),
key
:
'button.collapse-all'
,
onClick
:
()
=>
{
}
},
{
icon
:
<
EnvironmentOutlined
/>,
title
:
l
(
'button.position'
),
key
:
'button.position'
,
onClick
:
()
=>
{
}
}
]
};
export
const
BottomBtnRoute
:
{
[
c
:
string
]:
CircleBottomButtonProps
[]
}
=
{
export
const
BottomBtnRoute
:
{
[
c
:
string
]:
CircleBottomButtonProps
[]
}
=
{
// todo 右边按钮功能有待完善
// todo 右边按钮功能有待完善
// [LeftBottomKey.TABLE_DATA_KEY]: [
// [LeftBottomKey.TABLE_DATA_KEY]: [
...
...
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