@@ -743,7 +743,15 @@ export default class ConnectionController {
743743 async onRemoveMongoDBConnection ( ) : Promise < boolean > {
744744 log . info ( 'mdb.removeConnection command called' ) ;
745745
746- const connectionIds = Object . keys ( this . _connections ) ;
746+ const connectionIds = Object . entries ( this . _connections )
747+ . map ( ( [ id , connection ] ) => {
748+ return { id, connection } ;
749+ } )
750+ . filter (
751+ ( { connection } ) =>
752+ connection . source !== 'globalSettings' &&
753+ connection . source !== 'workspaceSettings'
754+ ) ;
747755
748756 if ( connectionIds . length === 0 ) {
749757 // No active connection(s) to remove.
@@ -753,15 +761,15 @@ export default class ConnectionController {
753761 }
754762
755763 if ( connectionIds . length === 1 ) {
756- return this . removeMongoDBConnection ( connectionIds [ 0 ] ) ;
764+ return this . removeMongoDBConnection ( connectionIds [ 0 ] . id ) ;
757765 }
758766
759767 // There is more than 1 possible connection to remove.
760768 // We attach the index of the connection so that we can infer their pick.
761769 const connectionNameToRemove : string | undefined =
762770 await vscode . window . showQuickPick (
763771 connectionIds . map (
764- ( id , index ) => `${ index + 1 } : ${ this . _connections [ id ] . name } `
772+ ( { connection } , index ) => `${ index + 1 } : ${ connection . name } `
765773 ) ,
766774 {
767775 placeHolder : 'Choose a connection to remove...' ,
@@ -775,7 +783,7 @@ export default class ConnectionController {
775783 // We attach the index of the connection so that we can infer their pick.
776784 const connectionIndexToRemove =
777785 Number ( connectionNameToRemove . split ( ':' , 1 ) [ 0 ] ) - 1 ;
778- const connectionIdToRemove = connectionIds [ connectionIndexToRemove ] ;
786+ const connectionIdToRemove = connectionIds [ connectionIndexToRemove ] . id ;
779787
780788 return this . removeMongoDBConnection ( connectionIdToRemove ) ;
781789 }
0 commit comments