Skip to content

Commit d70ad8d

Browse files
committed
Pass state through connection info
1 parent adfd307 commit d70ad8d

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

packages/compass-connections/src/stores/connections-store-redux.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ const connectWithOptions = (
18011801
await dataService.getUpdatedSecrets(),
18021802
}
18031803
: {}),
1804+
isGenuineMongoDB: instanceInfo.genuineMongoDB.isGenuine,
18041805
}
18051806
)
18061807
)
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useConnectionIds } from '@mongodb-js/compass-connections/provider';
2-
import { getGenuineMongoDB } from 'mongodb-build-info';
32
import React from 'react';
43
import { CompassAssistantDrawer } from '@mongodb-js/compass-assistant';
54

@@ -12,15 +11,14 @@ export function CompassAssistantDrawerWithConnections({
1211
appName: string;
1312
}) {
1413
// Check for non-genuine connections
15-
const activeConnectionIds = useConnectionIds(
14+
const activeNonGenuineConnectionIds = useConnectionIds(
1615
(conn) =>
17-
getGenuineMongoDB(conn.info.connectionOptions.connectionString)
18-
.isGenuine === false && conn.status === 'connected'
16+
conn.info.isGenuineMongoDB === false && conn.status === 'connected'
1917
);
2018
return (
2119
<CompassAssistantDrawer
2220
appName={appName}
23-
hasNonGenuineConnections={activeConnectionIds.length > 0}
21+
hasNonGenuineConnections={activeNonGenuineConnectionIds.length > 0}
2422
/>
2523
);
2624
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useConnectionIds } from '@mongodb-js/compass-connections/provider';
2-
import { getGenuineMongoDB } from 'mongodb-build-info';
32
import React from 'react';
43
import { CompassAssistantDrawer } from '@mongodb-js/compass-assistant';
54

@@ -12,15 +11,14 @@ export function CompassAssistantDrawerWithConnections({
1211
appName: string;
1312
}) {
1413
// Check for non-genuine connections
15-
const activeConnectionIds = useConnectionIds(
14+
const activeNonGenuineConnectionIds = useConnectionIds(
1615
(conn) =>
17-
getGenuineMongoDB(conn.info.connectionOptions.connectionString)
18-
.isGenuine === false && conn.status === 'connected'
16+
conn.info.isGenuineMongoDB === false && conn.status === 'connected'
1917
);
2018
return (
2119
<CompassAssistantDrawer
2220
appName={appName}
23-
hasNonGenuineConnections={activeConnectionIds.length > 0}
21+
hasNonGenuineConnections={activeNonGenuineConnectionIds.length > 0}
2422
/>
2523
);
2624
}

packages/connection-info/src/connection-info.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ export interface ConnectionInfo {
145145
* The metadata for the Atlas cluster. Set from Atlas control plane when using compass-web.
146146
*/
147147
atlasMetadata?: AtlasClusterMetadata;
148+
149+
/**
150+
* Indicates whether this connection is to a genuine MongoDB server.
151+
*/
152+
isGenuineMongoDB?: boolean;
148153
}
149154

150155
export interface ConnectionFavoriteOptions {

0 commit comments

Comments
 (0)