Skip to content

Commit 40d8160

Browse files
committed
Merge branch 'main' into 1.29-releases
2 parents c5015e4 + d4241f9 commit 40d8160

File tree

30 files changed

+2632
-1664
lines changed

30 files changed

+2632
-1664
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ chrisrichie25 <[email protected]>
5656
Le Roux Bodenstein <[email protected]>
5757
5858
Vladimir Isakov <[email protected]>
59+

THIRD-PARTY-NOTICES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **compass**.
2-
This document was automatically generated on Wed Nov 10 2021.
2+
This document was automatically generated on Thu Nov 11 2021.
33

44
## List of dependencies
55

@@ -1498,7 +1498,7 @@ Authors:
14981498

14991499
<a id="0246a09057539905cb79d6da85f9ec38a0e098bb0f85e64989fa7adffdee8a37"></a>
15001500
### [kerberos](https://www.npmjs.com/package/kerberos) (version 2.0.0-beta.0)
1501-
<!-- initially found at packages/compass/node_modules/kerberos -->
1501+
<!-- initially found at node_modules/kerberos -->
15021502
> Kerberos library for Node.js
15031503
15041504
License tags: Apache-2.0
@@ -2490,7 +2490,7 @@ Authors:
24902490

24912491
<a id="41cf4a77f0b640214c5bcc5fa57dc986f9dc30676e63e34e74f23b134fe518e0"></a>
24922492
### [node-addon-api](https://www.npmjs.com/package/node-addon-api) (version 4.2.0)
2493-
<!-- initially found at packages/compass/node_modules/kerberos/node_modules/node-addon-api -->
2493+
<!-- initially found at node_modules/kerberos/node_modules/node-addon-api -->
24942494
> Node.js API (Node-API)
24952495
24962496
License tags: MIT

package-lock.json

Lines changed: 42 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/collection-model/lib/model.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ const CollectionCollection = AmpersandCollection.extend({
7272
* @returns {Promise<void>}
7373
*/
7474
async fetch({ dataService, fetchInfo = true }) {
75-
const listCollectionsAsync = promisify(
76-
dataService.listCollections.bind(dataService)
77-
);
78-
const listCollectionsNameOnlyAsync = promisify(
79-
dataService.listCollectionsNamesOnly.bind(dataService)
80-
);
81-
8275
const databaseName = this.parent && this.parent.getId();
8376

8477
if (!databaseName) {
@@ -87,20 +80,11 @@ const CollectionCollection = AmpersandCollection.extend({
8780
);
8881
}
8982

90-
let collections = [];
91-
92-
// When trying to fetch additional information about collections during
93-
// collection list fetch we want to fallback to the nameOnly method that
94-
// requires less privileges in case user is missing some required ones
95-
if (fetchInfo) {
96-
try {
97-
collections = await listCollectionsAsync(databaseName, {});
98-
} catch (e) {
99-
collections = await listCollectionsNameOnlyAsync(databaseName);
100-
}
101-
} else {
102-
collections = await listCollectionsNameOnlyAsync(databaseName);
103-
}
83+
const collections = await dataService.listCollections(
84+
databaseName,
85+
{},
86+
{ nameOnly: !fetchInfo }
87+
);
10488

10589
this.set(
10690
collections.filter((coll) => {

packages/compass-app-stores/src/stores/instance-store.spec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ describe('InstanceStore [Store]', () => {
2424
instance() {
2525
return Promise.resolve(instanceInfo);
2626
},
27-
listDatabases(_opts, cb) {
28-
cb(null, []);
29-
return;
27+
listDatabases() {
28+
return Promise.resolve([]);
3029
},
31-
listCollections(_dbName, cb) {
32-
cb(null, []);
33-
return;
30+
listCollections() {
31+
return Promise.resolve([]);
3432
}
3533
};
3634
}

packages/compass-connect/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
"mocha": "^7.0.1",
106106
"mocha-webpack": "^2.0.0-beta.0",
107107
"moment": "^2.27.0",
108+
"mongodb-build-info": "^1.2.0",
109+
"mongodb-cloud-info": "^1.1.3",
108110
"mongodb-connection-model": "^21.8.0",
109111
"mongodb-data-service": "^21.12.0",
110112
"mongodb-runner": "^4.8.3",

packages/compass-connect/src/stores/index.js

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const StateMixin = require('reflux-state-mixin');
77
const { promisify } = require('util');
88
const { getConnectionTitle, convertConnectionModelToInfo } = require('mongodb-data-service');
99
const debug = require('debug')('compass-connect:store');
10+
const { isAtlas, isLocalhost, isDigitalOcean } = require('mongodb-build-info');
11+
const { getCloudInfo } = require('mongodb-cloud-info');
1012

1113
const Actions = require('../actions');
1214
const {
@@ -19,7 +21,7 @@ const ConnectionCollection = Connection.ConnectionCollection;
1921
const userAgent = navigator.userAgent.toLowerCase();
2022

2123
const { createLoggerAndTelemetry } = require('@mongodb-js/compass-logging');
22-
const { log, mongoLogId } = createLoggerAndTelemetry('COMPASS-CONNECT-UI');
24+
const { log, track, mongoLogId } = createLoggerAndTelemetry('COMPASS-CONNECT-UI');
2325

2426
/**
2527
* A default driverUrl.
@@ -311,6 +313,14 @@ const Store = Reflux.createStore({
311313
return;
312314
}
313315

316+
const { connectionModel } = this.state;
317+
const trackEvent = {
318+
is_favorite: connectionModel.isFavorite,
319+
is_recent: Boolean(connectionModel.lastUsed && !connectionModel.isFavorite),
320+
is_new: !connectionModel.lastUsed,
321+
};
322+
track('Connection Attempt', trackEvent);
323+
314324
this.setState({
315325
currentConnectionAttempt: createConnectionAttempt(),
316326
connectingStatusText: LOADING_CONNECTION_TEXT
@@ -682,6 +692,7 @@ const Store = Reflux.createStore({
682692

683693
/**
684694
* Resets the connection after clicking on the new connection section.
695+
*
685696
*/
686697
onResetConnectionClicked() {
687698
this.state.viewType = CONNECTION_STRING_VIEW;
@@ -960,6 +971,40 @@ const Store = Reflux.createStore({
960971
}
961972
},
962973

974+
async _trackConnectionInfo() {
975+
const { dataService } = this;
976+
const {
977+
dataLake,
978+
genuineMongoDB,
979+
host,
980+
build,
981+
} = await dataService.instance();
982+
const {
983+
hostname,
984+
authMechanism,
985+
} = this.state.connectionModel;
986+
const { isAws, isAzure, isGcp } = await getCloudInfo(hostname);
987+
const isPublicCloud = isAws || isAzure || isGcp;
988+
const publicCloudName = isAws ? 'AWS' : isAzure ? 'Azure' : isGcp ? 'GCP' : '';
989+
990+
const trackEvent = {
991+
is_localhost: isLocalhost(hostname),
992+
is_atlas: isAtlas(hostname),
993+
is_dataLake: dataLake.isDataLake,
994+
is_enterprise: build.isEnterprise,
995+
is_public_cloud: isPublicCloud,
996+
is_do: isDigitalOcean(hostname),
997+
public_cloud_name: publicCloudName,
998+
is_genuine: genuineMongoDB.isGenuine,
999+
non_genuine_server_name: genuineMongoDB.dbType,
1000+
server_version: host.kernel_version,
1001+
server_arch: host.arch,
1002+
server_os_family: host.os_family,
1003+
auth_type: authMechanism ?? '',
1004+
};
1005+
track('New Connection', trackEvent);
1006+
},
1007+
9631008
_onConnectSuccess(dataService, connectionInfo) {
9641009
const connectionModel = this.state.connectionModel;
9651010
const currentSaved = this.state.connections[connectionModel._id];
@@ -996,6 +1041,8 @@ const Store = Reflux.createStore({
9961041
// bar, which is hidden after the instance information is loaded
9971042
// in another plugin.
9981043
this.StatusActions.showIndeterminateProgressBar();
1044+
1045+
void this._trackConnectionInfo();
9991046
},
10001047

10011048
/**

0 commit comments

Comments
 (0)