Skip to content

Commit 966717d

Browse files
Merge remote-tracking branch 'origin/main' into beta-releases
2 parents 7bb6601 + c6b74bc commit 966717d

File tree

8 files changed

+204
-31
lines changed

8 files changed

+204
-31
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **Mongodb Compass**.
2-
This document was automatically generated on Sun May 26 2024.
2+
This document was automatically generated on Sun Jun 02 2024.
33

44
## List of dependencies
55

packages/compass-aggregations/src/components/stage-toolbar/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ const toolbarStyles = css({
3838
flexDirection: 'row',
3939
justifyContent: 'space-between',
4040
cursor: 'grab',
41+
'&:active': {
42+
cursor: 'grabbing',
43+
},
4144
});
4245

4346
const collapsedToolbarStyles = css({

packages/compass-crud/src/utils/cancellable-queries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export async function fetchShardingKeys(
8383
'config.collections',
8484
{
8585
_id: ns as any,
86-
// unsplittable introduced in PM-3364 to mark unsharded collections
86+
// unsplittable introduced in SPM-3364 to mark unsharded collections
8787
// that are still being tracked in the catalog
8888
unsplittable: { $ne: true },
8989
},

packages/compass-e2e-tests/tests/read-only.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('readOnly: true / Read-Only Edition', function () {
182182
await settingsModal.waitForDisplayed({ reverse: true });
183183

184184
databaseCreateCollectionButton = await browser.$(
185-
Selectors.SidebarCreateDatabaseButton
185+
Selectors.DatabaseCreateCollectionButton
186186
);
187187
isDatabaseCreateCollectionButtonExisting =
188188
await databaseCreateCollectionButton.isExisting();
@@ -218,7 +218,7 @@ describe('readOnly: true / Read-Only Edition', function () {
218218
// wait for the modal to go away
219219
await settingsModal.waitForDisplayed({ reverse: true });
220220

221-
addDataButton = await browser.$(Selectors.SidebarCreateDatabaseButton);
221+
addDataButton = await browser.$(Selectors.AddDataButton);
222222
isAddDataButtonExisting = await addDataButton.isExisting();
223223
expect(isAddDataButtonExisting).to.be.equal(false);
224224
} finally {

packages/compass/src/main/menu.spec.ts

Lines changed: 151 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ describe('CompassMenu', function () {
289289
}
290290
});
291291

292-
it('should generate a menu template for darwin', function () {
292+
it('[single-connection] should generate a menu template for darwin', function () {
293293
sinon.stub(process, 'platform').value('darwin');
294294
expect(serializable(CompassMenu.getTemplate(0))).to.deep.equal([
295295
{
@@ -373,8 +373,93 @@ describe('CompassMenu', function () {
373373
]);
374374
});
375375

376+
it('[multiple-connection] should generate a menu template for darwin', async function () {
377+
await App.preferences.savePreferences({
378+
enableNewMultipleConnectionSystem: true,
379+
});
380+
sinon.stub(process, 'platform').value('darwin');
381+
expect(serializable(CompassMenu.getTemplate(0))).to.deep.equal([
382+
{
383+
label: app.getName(),
384+
submenu: [
385+
{ label: `About ${app.getName()}`, role: 'about' },
386+
{ label: 'Check for updates…' },
387+
{ type: 'separator' },
388+
{ label: '&Settings', accelerator: 'CmdOrCtrl+,' },
389+
{ type: 'separator' },
390+
{ label: 'Hide', accelerator: 'Command+H', role: 'hide' },
391+
{
392+
label: 'Hide Others',
393+
accelerator: 'Command+Shift+H',
394+
role: 'hideOthers',
395+
},
396+
{ label: 'Show All', role: 'unhide' },
397+
{ type: 'separator' },
398+
{ label: 'Quit', accelerator: 'CmdOrCtrl+Q' },
399+
],
400+
},
401+
{
402+
label: '&Connect',
403+
submenu: [
404+
{ label: '&Import Saved Connections' },
405+
{ label: '&Export Saved Connections' },
406+
],
407+
},
408+
{
409+
label: 'Edit',
410+
submenu: [
411+
{ label: 'Undo', accelerator: 'Command+Z', role: 'undo' },
412+
{ label: 'Redo', accelerator: 'Shift+Command+Z', role: 'redo' },
413+
{ type: 'separator' },
414+
{ label: 'Cut', accelerator: 'Command+X', role: 'cut' },
415+
{ label: 'Copy', accelerator: 'Command+C', role: 'copy' },
416+
{ label: 'Paste', accelerator: 'Command+V', role: 'paste' },
417+
{
418+
label: 'Select All',
419+
accelerator: 'Command+A',
420+
role: 'selectAll',
421+
},
422+
{ type: 'separator' },
423+
{ label: 'Find', accelerator: 'CmdOrCtrl+F' },
424+
],
425+
},
426+
{
427+
label: '&View',
428+
submenu: [
429+
{ label: '&Reload', accelerator: 'CmdOrCtrl+Shift+R' },
430+
{ label: '&Reload Data', accelerator: 'CmdOrCtrl+R' },
431+
{ type: 'separator' },
432+
{ label: 'Actual Size', accelerator: 'CmdOrCtrl+0' },
433+
{ label: 'Zoom In', accelerator: 'CmdOrCtrl+=' },
434+
{ label: 'Zoom Out', accelerator: 'CmdOrCtrl+-' },
435+
],
436+
},
437+
{
438+
label: 'Window',
439+
submenu: [
440+
{ label: 'New &Window', accelerator: 'CmdOrCtrl+N' },
441+
{ label: 'Minimize', accelerator: 'Command+M', role: 'minimize' },
442+
{ label: 'Close', accelerator: 'Command+Shift+W', role: 'close' },
443+
{ type: 'separator' },
444+
{ label: 'Bring All to Front', role: 'front' },
445+
],
446+
},
447+
{
448+
label: '&Help',
449+
submenu: [
450+
{ label: `&Online ${app.getName()} Help`, accelerator: 'F1' },
451+
{ label: '&License' },
452+
{ label: `&View Source Code on GitHub` },
453+
{ label: `&Suggest a Feature` },
454+
{ label: `&Report a Bug` },
455+
{ label: '&Open Log File' },
456+
],
457+
},
458+
]);
459+
});
460+
376461
['linux', 'win32'].forEach((platform) => {
377-
it(`should generate a menu template for ${platform}`, function () {
462+
it(`[single-connection] should generate a menu template for ${platform}`, function () {
378463
sinon.stub(process, 'platform').value(platform);
379464

380465
expect(serializable(CompassMenu.getTemplate(0))).to.deep.equal([
@@ -437,6 +522,70 @@ describe('CompassMenu', function () {
437522
},
438523
]);
439524
});
525+
526+
it(`[multiple-connection] should generate a menu template for ${platform}`, async function () {
527+
await App.preferences.savePreferences({
528+
enableNewMultipleConnectionSystem: true,
529+
});
530+
sinon.stub(process, 'platform').value(platform);
531+
532+
expect(serializable(CompassMenu.getTemplate(0))).to.deep.equal([
533+
{
534+
label: '&Connect',
535+
submenu: [
536+
{ label: '&Import Saved Connections' },
537+
{ label: '&Export Saved Connections' },
538+
{ type: 'separator' },
539+
{ label: 'E&xit', accelerator: 'CmdOrCtrl+Q' },
540+
],
541+
},
542+
{
543+
label: 'Edit',
544+
submenu: [
545+
{ label: 'Undo', accelerator: 'Command+Z', role: 'undo' },
546+
{ label: 'Redo', accelerator: 'Shift+Command+Z', role: 'redo' },
547+
{ type: 'separator' },
548+
{ label: 'Cut', accelerator: 'Command+X', role: 'cut' },
549+
{ label: 'Copy', accelerator: 'Command+C', role: 'copy' },
550+
{ label: 'Paste', accelerator: 'Command+V', role: 'paste' },
551+
{
552+
label: 'Select All',
553+
accelerator: 'Command+A',
554+
role: 'selectAll',
555+
},
556+
{ type: 'separator' },
557+
{ label: 'Find', accelerator: 'CmdOrCtrl+F' },
558+
{ type: 'separator' },
559+
{ label: '&Settings', accelerator: 'CmdOrCtrl+,' },
560+
],
561+
},
562+
{
563+
label: '&View',
564+
submenu: [
565+
{ label: '&Reload', accelerator: 'CmdOrCtrl+Shift+R' },
566+
{ label: '&Reload Data', accelerator: 'CmdOrCtrl+R' },
567+
{ type: 'separator' },
568+
{ label: 'Actual Size', accelerator: 'CmdOrCtrl+0' },
569+
{ label: 'Zoom In', accelerator: 'CmdOrCtrl+=' },
570+
{ label: 'Zoom Out', accelerator: 'CmdOrCtrl+-' },
571+
],
572+
},
573+
{
574+
label: '&Help',
575+
submenu: [
576+
{ label: `&Online ${app.getName()} Help`, accelerator: 'F1' },
577+
{ label: '&License' },
578+
{ label: `&View Source Code on GitHub` },
579+
{ label: `&Suggest a Feature` },
580+
{ label: `&Report a Bug` },
581+
{ label: '&Open Log File' },
582+
{ type: 'separator' },
583+
{ label: `&About ${app.getName()}` },
584+
{ label: 'Check for updates…' },
585+
],
586+
},
587+
]);
588+
});
440589
});
441590

442591
it('should generate a menu template without collection submenu if `showCollection` is `false`', function () {

packages/compass/src/main/menu.ts

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function darwinCompassSubMenu(
103103
};
104104
}
105105

106-
function connectItem(
106+
function newWindowItem(
107107
app: typeof CompassApplication
108108
): MenuItemConstructorOptions {
109109
return {
@@ -128,10 +128,17 @@ function connectSubMenu(
128128
nonDarwin: boolean,
129129
app: typeof CompassApplication
130130
): MenuItemConstructorOptions {
131-
const subMenu: MenuTemplate = [
132-
connectItem(app),
131+
const { enableNewMultipleConnectionSystem: isMultiConnectionsEnabled } =
132+
app.preferences.getPreferences();
133+
134+
const singleConnectionItems: MenuTemplate = [
135+
newWindowItem(app),
133136
disconnectItem(),
134137
separator(),
138+
];
139+
140+
const subMenu: MenuTemplate = [
141+
...(!isMultiConnectionsEnabled ? singleConnectionItems : []),
135142
{
136143
label: '&Import Saved Connections',
137144
click() {
@@ -407,26 +414,35 @@ function viewSubMenu(
407414
};
408415
}
409416

410-
function windowSubMenu(): MenuItemConstructorOptions {
417+
function windowSubMenu(
418+
app: typeof CompassApplication
419+
): MenuItemConstructorOptions {
420+
const { enableNewMultipleConnectionSystem: isMultiConnectionsEnabled } =
421+
app.preferences.getPreferences();
422+
423+
const submenu: MenuTemplate = [
424+
{
425+
label: 'Minimize',
426+
accelerator: 'Command+M',
427+
role: 'minimize' as const,
428+
},
429+
{
430+
label: 'Close',
431+
accelerator: 'Command+Shift+W',
432+
role: 'close' as const,
433+
},
434+
separator(),
435+
{
436+
label: 'Bring All to Front',
437+
role: 'front',
438+
},
439+
];
440+
441+
if (isMultiConnectionsEnabled) submenu.unshift(newWindowItem(app));
442+
411443
return {
412444
label: 'Window',
413-
submenu: [
414-
{
415-
label: 'Minimize',
416-
accelerator: 'Command+M',
417-
role: 'minimize' as const,
418-
},
419-
{
420-
label: 'Close',
421-
accelerator: 'Command+Shift+W',
422-
role: 'close' as const,
423-
},
424-
separator(),
425-
{
426-
label: 'Bring All to Front',
427-
role: 'front',
428-
},
429-
],
445+
submenu,
430446
};
431447
}
432448

@@ -445,7 +461,7 @@ function darwinMenu(
445461
menu.push(collectionSubMenu(menuState.isReadOnly, app));
446462
}
447463

448-
menu.push(windowSubMenu());
464+
menu.push(windowSubMenu(app));
449465
menu.push(helpSubMenu(menuState, app));
450466

451467
return menu;

packages/databases-collections/src/components/collections.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from 'react';
1+
import React, { useCallback, useMemo } from 'react';
22
import { connect } from 'react-redux';
33
import { CollectionsList } from '@mongodb-js/databases-collections-list';
44
import {
@@ -19,6 +19,7 @@ import toNS from 'mongodb-ns';
1919
import { useOpenWorkspace } from '@mongodb-js/compass-workspaces/provider';
2020
import { useConnectionInfo } from '@mongodb-js/compass-connections/provider';
2121
import { getConnectionTitle } from '@mongodb-js/connection-info';
22+
import { usePreference } from 'compass-preferences-model/provider';
2223

2324
const ERROR_WARNING = 'An error occurred while loading collections';
2425

@@ -42,11 +43,15 @@ const Collections: React.FunctionComponent<CollectionsListProps> = ({
4243
collections,
4344
collectionsLoadingStatus,
4445
collectionsLoadingError,
45-
isEditable,
46+
isEditable: isInstanceWritable,
4647
onDeleteCollectionClick: _onDeleteCollectionClick,
4748
onCreateCollectionClick: _onCreateCollectionClick,
4849
onRefreshClick,
4950
}) => {
51+
const isCompassInWritableMode = !usePreference('readOnly');
52+
const isEditable = useMemo(() => {
53+
return isCompassInWritableMode && isInstanceWritable;
54+
}, [isCompassInWritableMode, isInstanceWritable]);
5055
const connectionInfo = useConnectionInfo();
5156
const { id: connectionId } = connectionInfo;
5257
const { openDatabasesWorkspace, openCollectionWorkspace } =

packages/hadron-document/src/object-generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export class ObjectGenerator {
480480
*
481481
* NOTE: `alwaysIncludeKeys` is currently used for sharding, since
482482
* updates on sharded setups need to include the shard key in their
483-
* find part. https://jira.mongodb.org/browse/PM-1632 will make
483+
* find part. https://jira.mongodb.org/browse/SPM-1632 will make
484484
* this requirement go away for future MongoDB versions!
485485
*
486486
* @param target The target (sub-)document.

0 commit comments

Comments
 (0)