@@ -4,9 +4,7 @@ import i18n from '@/i18n';
44import CreateConnection from '@/components/CreateConnection' ;
55import Iconfont from '@/components/Iconfont' ;
66import connectionService from '@/service/connection' ;
7-
87import { DatabaseTypeCode , databaseMap , databaseTypeList } from '@/constants' ;
9-
108import { IDatabase , IConnectionDetails } from '@/typings' ;
119import { Button , Dropdown , Modal } from 'antd' ;
1210import { MoreOutlined } from '@ant-design/icons' ;
@@ -62,17 +60,17 @@ function Connections(props: IProps) {
6260 [ connectionList ] ,
6361 ) ;
6462
65- const menuItemDoubleClick = ( t : any ) => {
63+ const handleMenuItemDoubleClick = ( t ? : any ) => {
6664 dispatch ( {
6765 type : 'connection/setCurConnection' ,
6866 payload : t . meta ,
6967 } ) ;
7068
7169 dispatch ( {
7270 type : 'mainPage/updateCurPage' ,
73- payload : 'workspace'
74- } )
75- }
71+ payload : 'workspace' ,
72+ } ) ;
73+ } ;
7674
7775 const renderMenu = ( ) => {
7876 return (
@@ -85,7 +83,7 @@ function Connections(props: IProps) {
8583 className = { classnames ( styles . menuItem , {
8684 [ styles . menuItemActive ] : curConnection . id === key ,
8785 } ) }
88- onDoubleClick = { menuItemDoubleClick . bind ( null , t ) }
86+ onDoubleClick = { handleMenuItemDoubleClick . bind ( null , t ) }
8987 onClick = { ( ) => {
9088 setCurConnection ( t . meta ) ;
9189 } }
@@ -97,6 +95,13 @@ function Connections(props: IProps) {
9795 < Dropdown
9896 menu = { {
9997 items : [
98+ {
99+ key : 'EnterWorkSpace' ,
100+ label : i18n ( 'connection.button.connect' ) ,
101+ onClick : ( ) => {
102+ handleMenuItemDoubleClick ( t ) ;
103+ } ,
104+ } ,
100105 {
101106 key : 'Delete' ,
102107 label : i18n ( 'common.button.delete' ) ,
@@ -180,7 +185,9 @@ function Connections(props: IProps) {
180185 ) ;
181186}
182187
183- export default connect ( ( { connection, workspace } : { connection : IConnectionModelType ; workspace : IWorkspaceModelType } ) => ( {
184- connectionModel : connection ,
185- workspaceModel : workspace ,
186- } ) ) ( Connections ) ;
188+ export default connect (
189+ ( { connection, workspace } : { connection : IConnectionModelType ; workspace : IWorkspaceModelType } ) => ( {
190+ connectionModel : connection ,
191+ workspaceModel : workspace ,
192+ } ) ,
193+ ) ( Connections ) ;
0 commit comments