Skip to content

Commit 7d24dd3

Browse files
committed
COMPASS-2583: Adding metrics for import/export finished. (#1394)
* COMPASS-2583: Add import/export completed metrics * Dont provide import menu on readonly build * Bump latest import/export plugin for cancel fix
1 parent bc3bf84 commit 7d24dd3

File tree

4 files changed

+104
-84
lines changed

4 files changed

+104
-84
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
"@mongodb-js/compass-deployment-awareness": "^5.1.1",
216216
"@mongodb-js/compass-document-validation": "^7.2.1",
217217
"@mongodb-js/compass-instance": "^0.0.2",
218-
"@mongodb-js/compass-import-export": "^0.0.10",
218+
"@mongodb-js/compass-import-export": "^0.0.12",
219219
"@mongodb-js/compass-license": "^0.1.1",
220220
"@mongodb-js/compass-query-history": "^2.2.2",
221221
"@mongodb-js/compass-security": "^0.1.0",

src/internal-plugins/metrics/lib/rules.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,27 @@ module.exports = [
159159
condition: () => true,
160160
metadata: () => ({})
161161
},
162+
{
163+
registryEvent: 'export-finished',
164+
resource: 'Export',
165+
action: 'completed',
166+
condition: () => true,
167+
metadata: () => ({})
168+
},
162169
{
163170
registryEvent: 'open-import',
164171
resource: 'Import',
165172
action: 'opened',
166173
condition: () => true,
167174
metadata: () => ({})
168175
},
176+
{
177+
registryEvent: 'import-finished',
178+
resource: 'Import',
179+
action: 'completed',
180+
condition: () => true,
181+
metadata: () => ({})
182+
},
169183
{
170184
registryEvent: 'document-deleted',
171185
resource: 'Document',

src/main/menu.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ var debug = require('debug')('mongodb-compass:menu');
1313

1414
const COMPASS_HELP = 'https://docs.mongodb.com/compass/';
1515

16+
function isReadonlyDistro() {
17+
return process.env.HADRON_READONLY === 'true';
18+
}
19+
1620
// submenu related
1721
function separator() {
1822
return {
@@ -204,30 +208,32 @@ function helpSubMenu() {
204208
}
205209

206210
function collectionSubMenu() {
211+
var subMenu = [];
212+
subMenu.push({
213+
label: '&Share Schema as JSON',
214+
accelerator: 'Alt+CmdOrCtrl+S',
215+
click: function() {
216+
ipc.broadcast('window:menu-share-schema-json');
217+
}
218+
});
219+
subMenu.push(separator());
220+
if (!isReadonlyDistro()) {
221+
subMenu.push({
222+
label: '&Import Data',
223+
click: function() {
224+
ipc.broadcast('compass:open-import');
225+
}
226+
});
227+
}
228+
subMenu.push({
229+
label: '&Export Collection',
230+
click: function() {
231+
ipc.broadcast('compass:open-export');
232+
}
233+
});
207234
return {
208235
label: '&Collection',
209-
submenu: [
210-
{
211-
label: '&Share Schema as JSON',
212-
accelerator: 'Alt+CmdOrCtrl+S',
213-
click: function() {
214-
ipc.broadcast('window:menu-share-schema-json');
215-
}
216-
},
217-
separator(),
218-
{
219-
label: '&Import Data',
220-
click: function() {
221-
ipc.broadcast('compass:open-import');
222-
}
223-
},
224-
{
225-
label: '&Export Collection',
226-
click: function() {
227-
ipc.broadcast('compass:open-export');
228-
}
229-
}
230-
]
236+
submenu: subMenu
231237
};
232238
}
233239

0 commit comments

Comments
 (0)