@@ -20,7 +20,7 @@ const MAX_CONNECTION_NAME_LENGTH = 512;
20
20
21
21
export enum DataServiceEventTypes {
22
22
CONNECTIONS_DID_CHANGE = 'CONNECTIONS_DID_CHANGE' ,
23
- ACTIVE_CONNECTION_CHANGED = 'ACTIVE_CONNECTION_CHANGED' ,
23
+ ACTIVE_CONNECTION_CHANGED = 'ACTIVE_CONNECTION_CHANGED'
24
24
}
25
25
26
26
export enum ConnectionTypes {
@@ -31,7 +31,6 @@ export enum ConnectionTypes {
31
31
32
32
export type SavedConnectionInformation = {
33
33
connectionModel : ConnectionModelType ;
34
- driverUrl : string ;
35
34
} ;
36
35
37
36
// A loaded connection contains connection information.
@@ -114,7 +113,6 @@ export default class ConnectionController {
114
113
115
114
loadedSavedConnection = {
116
115
id : connectionId ,
117
- driverUrl : connectionInformation . driverUrl ,
118
116
name : savedConnection . name ,
119
117
connectionModel : connectionInformation . connectionModel ,
120
118
storageLocation : savedConnection . storageLocation
@@ -125,7 +123,10 @@ export default class ConnectionController {
125
123
return Promise . resolve ( ) ;
126
124
}
127
125
128
- this . _connections [ connectionId ] = loadedSavedConnection ;
126
+ this . _connections [ connectionId ] = {
127
+ ...loadedSavedConnection ,
128
+ connectionModel : new Connection ( loadedSavedConnection . connectionModel )
129
+ } ;
129
130
this . eventEmitter . emit ( DataServiceEventTypes . CONNECTIONS_DID_CHANGE ) ;
130
131
131
132
Promise . resolve ( ) ;
@@ -271,8 +272,7 @@ export default class ConnectionController {
271
272
} ) ;
272
273
const connectionId = uuidv4 ( ) ;
273
274
const connectionInformation : SavedConnectionInformation = {
274
- connectionModel,
275
- driverUrl
275
+ connectionModel
276
276
} ;
277
277
const connectionName =
278
278
sshTunnelOptions . host && sshTunnelOptions . port
@@ -551,13 +551,13 @@ export default class ConnectionController {
551
551
const connectionNameToRemove :
552
552
| string
553
553
| undefined = await vscode . window . showQuickPick (
554
- connectionIds . map (
555
- ( id , index ) => `${ index + 1 } : ${ this . _connections [ id ] . name } `
556
- ) ,
557
- {
558
- placeHolder : 'Choose a connection to remove...'
559
- }
560
- ) ;
554
+ connectionIds . map (
555
+ ( id , index ) => `${ index + 1 } : ${ this . _connections [ id ] . name } `
556
+ ) ,
557
+ {
558
+ placeHolder : 'Choose a connection to remove...'
559
+ }
560
+ ) ;
561
561
562
562
if ( ! connectionNameToRemove ) {
563
563
return Promise . resolve ( false ) ;
@@ -641,7 +641,8 @@ export default class ConnectionController {
641
641
return null ;
642
642
}
643
643
644
- return this . _connections [ this . _currentConnectionId ] . driverUrl ;
644
+ return this . _connections [ this . _currentConnectionId ] . connectionModel
645
+ . driverUrl ;
645
646
}
646
647
647
648
public addEventListener (
@@ -694,7 +695,7 @@ export default class ConnectionController {
694
695
}
695
696
696
697
public getConnectionStringFromConnectionId ( connectionId : string ) : string {
697
- return this . _connections [ connectionId ] . driverUrl ;
698
+ return this . _connections [ connectionId ] . connectionModel . driverUrlWithSsh ;
698
699
}
699
700
700
701
public isCurrentlyConnected ( ) : boolean {
@@ -726,9 +727,7 @@ export default class ConnectionController {
726
727
}
727
728
728
729
public getConnectionStatusStringForConnection ( connectionId : string ) : string {
729
- if (
730
- this . getActiveConnectionId ( ) === connectionId
731
- ) {
730
+ if ( this . getActiveConnectionId ( ) === connectionId ) {
732
731
if ( this . isDisconnecting ( ) ) {
733
732
return 'disconnecting...' ;
734
733
}
@@ -738,8 +737,7 @@ export default class ConnectionController {
738
737
739
738
if (
740
739
this . isConnecting ( ) &&
741
- this . getConnectingConnectionId ( ) ===
742
- connectionId
740
+ this . getConnectingConnectionId ( ) === connectionId
743
741
) {
744
742
return 'connecting...' ;
745
743
}
0 commit comments