diff --git a/dinky-web/public/database/clickhouse.png b/dinky-web/public/database/clickhouse.png deleted file mode 100644 index 15ed001c01..0000000000 Binary files a/dinky-web/public/database/clickhouse.png and /dev/null differ diff --git a/dinky-web/public/database/db.jpg b/dinky-web/public/database/db.jpg deleted file mode 100644 index bfe2a38643..0000000000 Binary files a/dinky-web/public/database/db.jpg and /dev/null differ diff --git a/dinky-web/public/database/doris.jpeg b/dinky-web/public/database/doris.jpeg deleted file mode 100644 index e5f2256830..0000000000 Binary files a/dinky-web/public/database/doris.jpeg and /dev/null differ diff --git a/dinky-web/public/database/hive.png b/dinky-web/public/database/hive.png deleted file mode 100644 index faa24c148e..0000000000 Binary files a/dinky-web/public/database/hive.png and /dev/null differ diff --git a/dinky-web/public/database/mysql.jpg b/dinky-web/public/database/mysql.jpg deleted file mode 100644 index e927f50710..0000000000 Binary files a/dinky-web/public/database/mysql.jpg and /dev/null differ diff --git a/dinky-web/public/database/oracle.jpg b/dinky-web/public/database/oracle.jpg deleted file mode 100644 index a1985751d1..0000000000 Binary files a/dinky-web/public/database/oracle.jpg and /dev/null differ diff --git a/dinky-web/public/database/phoenix.png b/dinky-web/public/database/phoenix.png deleted file mode 100644 index 5495793a96..0000000000 Binary files a/dinky-web/public/database/phoenix.png and /dev/null differ diff --git a/dinky-web/public/database/postgresql.jpg b/dinky-web/public/database/postgresql.jpg deleted file mode 100644 index 9b5f175c61..0000000000 Binary files a/dinky-web/public/database/postgresql.jpg and /dev/null differ diff --git a/dinky-web/public/database/presto.png b/dinky-web/public/database/presto.png deleted file mode 100644 index 15058db026..0000000000 Binary files a/dinky-web/public/database/presto.png and /dev/null differ diff --git a/dinky-web/public/database/sqlserver.jpg b/dinky-web/public/database/sqlserver.jpg deleted file mode 100644 index 339a4b3e91..0000000000 Binary files a/dinky-web/public/database/sqlserver.jpg and /dev/null differ diff --git a/dinky-web/public/database/starrocks.jpg b/dinky-web/public/database/starrocks.jpg deleted file mode 100644 index c425dd2835..0000000000 Binary files a/dinky-web/public/database/starrocks.jpg and /dev/null differ diff --git a/dinky-web/src/global.less b/dinky-web/src/global.less index ac49400114..a22b0f1737 100644 --- a/dinky-web/src/global.less +++ b/dinky-web/src/global.less @@ -199,6 +199,10 @@ ol { overflow: hidden; } +.ant-list .ant-list-pagination { + margin-block-start: 0; // 去除 分页组件和 上边表格的间距 +} + .ant-table-wrapper { overflow-y: auto; overflow-x: auto; @@ -329,6 +333,10 @@ ol { align-content: center; } +.ant-pro-checkcard-title { + overflow: unset; +} + h5 { margin-left: 0.5rem; margin-bottom: 0; diff --git a/dinky-web/src/locales/en-US/global.ts b/dinky-web/src/locales/en-US/global.ts index 52abfda482..80f2a0c863 100644 --- a/dinky-web/src/locales/en-US/global.ts +++ b/dinky-web/src/locales/en-US/global.ts @@ -147,6 +147,8 @@ export default { 'global.table.runmode.local': 'Local', 'global.table.runmode.remote': 'Remote', + 'global.search.text': 'Input Key to Search', + 'global.savepoint.strategy.disabled': 'Disabled', 'global.savepoint.strategy.latest': 'Latest', 'global.savepoint.strategy.earliest': 'Earliest', diff --git a/dinky-web/src/locales/zh-CN/global.ts b/dinky-web/src/locales/zh-CN/global.ts index 2c201d5c57..92c6f4f69e 100644 --- a/dinky-web/src/locales/zh-CN/global.ts +++ b/dinky-web/src/locales/zh-CN/global.ts @@ -145,6 +145,9 @@ export default { 'global.table.runmode.local': '本地', 'global.table.runmode.remote': '远程', + 'global.search.text': '输入关键字搜索', + + 'global.savepoint.strategy.disabled': '禁用', 'global.savepoint.strategy.latest': '最近一次', 'global.savepoint.strategy.earliest': '最早一次', diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx index 1233806c01..191a57260d 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx @@ -1,6 +1,6 @@ import {connect} from "@umijs/max"; import { StateType} from "../../model"; -import {Select, Space, Spin, Tag} from "antd"; +import {Spin, Tag} from "antd"; import React, {useEffect, useState} from "react"; import { DatabaseOutlined, ReloadOutlined, @@ -12,7 +12,6 @@ import {Key, ProForm, ProFormSelect} from "@ant-design/pro-components"; import {TagAlignLeft} from "@/components/StyledComponents"; import SchemaTree from "@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree"; import {DataSources} from "@/types/RegCenter/data"; -import ContentScroll from "@/components/Scroll/ContentScroll"; const MetaData = (props: any) => { @@ -159,7 +158,7 @@ const MetaData = (props: any) => { name={"selectDb"} placeholder={l('pages.metadata.selectDatabase')} options={getDataBaseOptions()} - fieldProps={{onSelect: (selectId) => handleSelectDataBaseId(selectId)}} + fieldProps={{onSelect: (selectId) => handleSelectDataBaseId(selectId as number)}} /> diff --git a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree/index.tsx b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree/index.tsx index 1f47c4297b..a38131fc71 100644 --- a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree/index.tsx +++ b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree/index.tsx @@ -16,10 +16,11 @@ */ -import {Empty, Input, Space, Tree} from 'antd'; +import {Empty, Input, Tree} from 'antd'; import React, {useCallback, useState} from 'react'; import {buildSchemaTree} from '@/pages/RegCenter/DataSource/components/DataSourceDetail/function'; import {Key} from '@ant-design/pro-components'; +import {l} from "@/utils/intl"; const {DirectoryTree} = Tree; /** @@ -56,7 +57,7 @@ const SchemaTree: React.FC = (props) => { (treeData.length > 0) ? <> ; - backClick: () => void; -} -const DataSourceDetail: React.FC = (props) => { +const DataSourceDetail = (props : any) => { const navigate = useNavigate(); - const {dataSource, backClick} = props; + const {dataSource, backClick , dispatch ,database: { dbData , selectDatabaseId , expandKeys, selectKeys}} = props; const [loading, setLoading] = useState(false); const [disabled, setDisabled] = useState(true); const [treeData, setTreeData] = useState[]>([]); const [tableInfo, setTableInfo] = useState>({}); const [params, setParams] = useState({id: 0, schemaName: '', tableName: ''}); + const selectDb = (dbData as DataSources.DataSource[]).filter(x=> x.id === selectDatabaseId)[0] const handleBackClick = () => { // go back @@ -81,8 +80,27 @@ const DataSourceDetail: React.FC = (props) => { /** * tree node click */ - const onSchemaTreeNodeClick = useCallback(async (info: any) => { + const onSchemaTreeNodeClick = useCallback(async (keys: Key[] ,info: any) => { const {node: {isLeaf, parentId: schemaName, name: tableName, fullInfo}} = info; + // 选中的key + dispatch({ + type: "Studio/updateDatabaseSelectKey", + payload: keys + }) + if (isLeaf) { + const queryParams = {id: selectDatabaseId , schemaName, tableName}; + dispatch({ + type: "Studio/addTab", + payload: { + icon: selectDb.type, + id: selectDatabaseId + schemaName + tableName, + breadcrumbLabel: [selectDb.type,selectDb.name].join("/"), + label: schemaName + '.' + tableName , + params:{ queryParams: queryParams, tableInfo: fullInfo}, + type: "metadata" + } + }) + } if (isLeaf) { setParams({ id: dataSource.id as number, @@ -100,6 +118,19 @@ const DataSourceDetail: React.FC = (props) => { } }, []); + + /** + * 树节点展开事件 + * @param {Key[]} expandedKeys + */ + const handleTreeExpand = (expandedKeys: Key[]) => { + dispatch({ + type: "Studio/updateDatabaseExpandKey", + payload: expandedKeys + }) + } + + /** * render back button and refresh button * @return {JSX.Element} @@ -124,7 +155,7 @@ const DataSourceDetail: React.FC = (props) => { {/* tree */} - onSchemaTreeNodeClick(info)} treeData={treeData}/> + {/* tags */} @@ -139,4 +170,6 @@ const DataSourceDetail: React.FC = (props) => { ; }; -export default DataSourceDetail; +export default connect(({Studio}: { Studio: StateType }) => ({ + database: Studio.database, +}))(DataSourceDetail); ;