Skip to content

Commit 0b137bd

Browse files
committed
Merge branch 'main' into 1.35-releases
2 parents 20f4fe8 + 9931e2e commit 0b137bd

File tree

148 files changed

+5314
-2959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+5314
-2959
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
The following third-party software is used by and included in **compass**.
2-
This document was automatically generated on Tue Dec 06 2022.
2+
This document was automatically generated on Thu Dec 15 2022.
33

44
## List of dependencies
55

66
Package|Version|License
77
-------|-------|-------
8-
**[@mongosh/node-runtime-worker-thread](#15af2bd3c4e8ac5324529caabe5d302ad7a91ec05bc5e17e7dd3e24c7152de76)**|1.6.0|Apache-2.0
8+
**[@mongosh/node-runtime-worker-thread](#55b577e859dd7306c9d9c90bfb15989f6b79a9587706cd98be99f4cd5038c19a)**|1.6.1|Apache-2.0
99
**[ansi-regex](#945d39147a145d6a28d87154006fa731c2e69d2a19e76cc7012624a1109f9317)**|2.1.1|MIT
1010
**[ansi-regex](#f4a8a360dfe3cdd0cbb8fcfa0cff23bb22eafa4225343577912ddf831d670411)**|3.0.0|MIT
1111
**[aproba](#b8b30f42274956b772cec4ea9f13cebaa5900724e514eaf0098a3ad6f1f7f16e)**|1.2.0|ISC
@@ -82,7 +82,7 @@ Package|Version|License
8282
**[simple-get](#c2c12990b6319daff653bdf953cadfa368185f0edc671124fb1028f6979df829)**|4.0.1|MIT
8383
**[simple-get](#ade55c33f4d681462bccf90b122b9e974e43632f78545b6d8dc845e7f185e5da)**|3.1.0|MIT
8484
**[smart-buffer](#bc8fbee089eb9cddf673c4c9dbc15edd13839063c27e2814009b6a0448065875)**|4.2.0|MIT
85-
**[socks](#d248334926a1dc960150cbe3b2ab15fa021e1b8b498cf04f0f32a9a876263e66)**|2.7.0|MIT
85+
**[socks](#16837d081453b731932951f203fc17778642c71f7cdc0c4557bc2dbd68a6fd1d)**|2.7.1|MIT
8686
**[string-width](#b0725207ba4a78809dec9436283671608c6a6c89b5f5cc66db6ce6da7bfb0cc0)**|1.0.2|MIT
8787
**[string-width](#e3ae6ddac7d522ef262f26fbded9f398d3642ba93321363b4634916ce1962b01)**|2.1.1|MIT
8888
**[strip-ansi](#79e4e45eb767932cbcc94ba2f18534155184857640dee665f4b43ae6d5294646)**|3.0.1|MIT
@@ -100,8 +100,8 @@ Package|Version|License
100100

101101
## Package details
102102

103-
<a id="15af2bd3c4e8ac5324529caabe5d302ad7a91ec05bc5e17e7dd3e24c7152de76"></a>
104-
### [@mongosh/node-runtime-worker-thread](https://www.npmjs.com/package/@mongosh/node-runtime-worker-thread) (version 1.6.0)
103+
<a id="55b577e859dd7306c9d9c90bfb15989f6b79a9587706cd98be99f4cd5038c19a"></a>
104+
### [@mongosh/node-runtime-worker-thread](https://www.npmjs.com/package/@mongosh/node-runtime-worker-thread) (version 1.6.1)
105105
<!-- initially found at node_modules/@mongosh/node-runtime-worker-thread -->
106106
> MongoDB shell runtime that lives in a worker thread
107107
@@ -4403,8 +4403,8 @@ Authors:
44034403
* syvita
44044404

44054405

4406-
<a id="d248334926a1dc960150cbe3b2ab15fa021e1b8b498cf04f0f32a9a876263e66"></a>
4407-
### [socks](https://www.npmjs.com/package/socks) (version 2.7.0)
4406+
<a id="16837d081453b731932951f203fc17778642c71f7cdc0c4557bc2dbd68a6fd1d"></a>
4407+
### [socks](https://www.npmjs.com/package/socks) (version 2.7.1)
44084408
<!-- initially found at node_modules/socks -->
44094409
> Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.
44104410

package-lock.json

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

packages/compass-aggregations/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ If you're interested in helping with the Aggregation Builder plugin, we'd be ove
4949
- [`<ExportToLanguage />`](https://github.com/mongodb-js/compass-export-to-language) Modal plugin that connects `<Aggregation />` to `bson-transpilers` [for actual compiling to another language](https://github.com/mongodb-js/bson-transpilers)
5050
- [`mongodb-js/stage-validator`](https://github.com/mongodb-js/stage-validator) Aggregation Pipeline Stage grammar.
5151
- [`bson-transpilers`](https://github.com/mongodb-js/bson-transpilers) Read the amazing: [Compiler in JavaScript using ANTLR](https://medium.com/dailyjs/compiler-in-javascript-using-antlr-9ec53fd2780f)
52-
- [`mongodb-js/ace-mode`](https://github.com/mongodb-js/ace-mode) MongoDB highlighting rules for ACE.
53-
- [`mongodb-js/ace-autocompleter`](https://github.com/mongodb-js/ace-autocompleter) Makes ACE autocompletion aware of MongoDB Aggregation Pipeline [operators, expressions, and fields](https://github.com/mongodb-js/ace-autocompleter/tree/master/lib/constants).
52+
- [`@mongodb-js/compass-editor`](https://github.com/mongodb-js/compass/tree/main/packages/compass-editor) Reusable Compass editor component based on ace-editor with MongoDB-specific ace modes, themes, and autocompleters.
5453

5554
## Usage
5655

packages/compass-aggregations/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"@types/lodash": "^4.14.188",
6666
"@types/semver": "^7.3.9",
6767
"chai": "^4.3.6",
68-
"classnames": "^2.2.6",
6968
"debug": "^4.2.0",
7069
"decomment": "^0.9.2",
7170
"depcheck": "^1.4.1",
@@ -74,10 +73,9 @@
7473
"enzyme": "^3.11.0",
7574
"eslint": "^7.25.0",
7675
"hadron-app-registry": "^9.0.2",
77-
"is-electron-renderer": "^2.0.1",
7876
"lodash": "^4.17.21",
7977
"mocha": "^8.4.0",
80-
"mongodb": "^4.10.0",
78+
"mongodb": "^4.12.1",
8179
"mongodb-data-service": "^22.3.0",
8280
"mongodb-ns": "^2.4.0",
8381
"mongodb-query-parser": "^2.4.6",

packages/compass-aggregations/src/components/add-stage/add-stage.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
44

5-
import { Button, Icon, css, spacing } from '@mongodb-js/compass-components';
5+
import { Button, Icon, css, spacing, Link } from '@mongodb-js/compass-components';
66

77
import { addStage } from '../../modules/pipeline-builder/stage-editor';
88

@@ -13,6 +13,12 @@ const containerStyles = css({
1313
marginBottom: spacing[3]
1414
});
1515

16+
const linkContainerStyles = css({
17+
textAlign: 'center',
18+
marginTop: spacing[3],
19+
marginBottom: spacing[3],
20+
});
21+
1622
export class AddStage extends PureComponent {
1723
static displayName = 'AddStageComponent';
1824

@@ -35,6 +41,10 @@ export class AddStage extends PureComponent {
3541
<Button data-testid="add-stage" onClick={this.onClick} variant="primary" leftGlyph={<Icon glyph="Plus"></Icon>}>
3642
Add Stage
3743
</Button>
44+
45+
<div className={linkContainerStyles}>
46+
<Link href='https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/'>Learn more about aggregation pipeline stages</Link>
47+
</div>
3848
</div>
3949
);
4050
}

packages/compass-aggregations/src/components/aggregations/aggregations.jsx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
import React, { Component } from 'react';
22
import { connect } from 'react-redux';
33
import Pipeline from '../pipeline';
4-
import { maxTimeMSChanged } from '../../modules/max-time-ms';
5-
import { collationStringChanged } from '../../modules/collation-string';
6-
import { toggleAutoPreview } from '../../modules/auto-preview';
7-
import { exportToLanguage } from '../../modules/export-to-language';
8-
import { openLink } from '../../modules/link';
94
import { clonePipeline } from "../../modules/clone-pipeline";
105
import {
116
saveCurrentPipeline,
12-
savedPipelineAdd,
13-
getSavedPipelines,
147
} from '../../modules/saved-pipeline';
15-
import {
16-
newPipeline,
17-
newPipelineFromText,
18-
closeImport,
19-
confirmNew
20-
} from '../../modules/import-pipeline';
21-
import { setIsNewPipelineConfirm } from '../../modules/is-new-pipeline-confirm';
228
import {
239
toggleSettingsIsExpanded,
2410
toggleSettingsIsCommentMode,
@@ -34,7 +20,6 @@ import {
3420
} from '../../modules/saving-pipeline';
3521
import {
3622
dismissViewError,
37-
updateView
3823
} from '../../modules/update-view';
3924

4025
import styles from './aggregations.module.less';
@@ -73,14 +58,11 @@ const mapStateToProps = (state) => ({
7358
isCommenting: state.comments,
7459
isAtlasDeployed: state.isAtlasDeployed,
7560
isAutoPreviewing: state.autoPreview,
76-
isImportConfirmationNeeded: state.importPipeline.isConfirmationNeeded,
7761
settings: state.settings,
7862
limit: state.limit,
7963
largeLimit: state.largeLimit,
8064
maxTimeMS: state.maxTimeMS,
8165
savingPipeline: state.savingPipeline,
82-
isNewPipelineConfirm: state.isNewPipelineConfirm,
83-
setIsNewPipelineConfirm: state.setIsNewPipelineConfirm,
8466
updateViewError: state.updateViewError,
8567
workspace: state.workspace,
8668
});
@@ -92,30 +74,17 @@ const mapStateToProps = (state) => ({
9274
const MappedAggregations = connect(
9375
mapStateToProps,
9476
{
95-
collationStringChanged,
96-
toggleAutoPreview,
9777
toggleSettingsIsExpanded,
9878
toggleSettingsIsCommentMode,
9979
setSettingsSampleSize,
10080
setSettingsLimit,
101-
exportToLanguage,
10281
saveCurrentPipeline,
103-
savedPipelineAdd,
104-
getSavedPipelines,
105-
newPipeline,
106-
newPipelineFromText,
107-
closeImport,
10882
clonePipeline,
109-
confirmNew,
110-
openLink,
11183
applySettings,
112-
maxTimeMSChanged,
11384
savingPipelineNameChanged,
11485
savingPipelineApply,
11586
savingPipelineCancel,
11687
savingPipelineOpen,
117-
updateView,
118-
setIsNewPipelineConfirm,
11988
dismissViewError
12089
}
12190
)(Aggregations);

packages/compass-aggregations/src/components/atlas-stage-preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const atlasTextStyles = css({
2525
maxWidth: '400px',
2626
});
2727

28-
export const AtlastStagePreivew = ({
28+
export const AtlasStagePreview = ({
2929
stageOperator,
3030
}: {
3131
stageOperator: string;

packages/compass-aggregations/src/components/pipeline-builder-input-documents.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import LoadingOverlay from './loading-overlay';
1010

1111
const cardStyles = css({
1212
margin: `0 ${spacing[3]}px`,
13-
marginBottom: spacing[3]
1413
});
1514

1615
const headerStyles = css({
@@ -42,10 +41,10 @@ const bodyStylesDark = css({
4241

4342
const documentsContainerStyles = css({
4443
marginTop: spacing[2],
44+
paddingBottom: spacing[2],
4545
display: 'flex',
4646
overflowX: 'scroll',
4747
gap: spacing[2],
48-
paddingBottom: spacing[2]
4948
});
5049

5150
const documentContainerStyles = css({
@@ -78,13 +77,15 @@ function PipelineBuilderInputDocuments({
7877
toggleInputDocumentsCollapsed(!isExpanded);
7978
};
8079

80+
const expandTooltipText = isExpanded ? 'Collapse' : 'Expand';
81+
8182
return (<KeylineCard className={cardStyles}>
8283
<div className={headerStyles}>
83-
<IconButton onClick={toggleExpanded} aria-label={isExpanded ? 'Collapse' : 'Expand'}>
84+
<IconButton onClick={toggleExpanded} title={expandTooltipText} aria-label={expandTooltipText}>
8485
<Icon glyph={isExpanded ? 'ChevronDown' : 'ChevronRight'} size="small"></Icon>
8586
</IconButton>
8687
<Body className={headerTextStyles}><b>{count} Document{count === 1 ? '' : 's'}</b> in the collection</Body>
87-
<IconButton onClick={refreshInputDocuments} aria-label="Refresh">
88+
<IconButton onClick={refreshInputDocuments} aria-label="Refresh" title="Refresh">
8889
<Icon glyph="Refresh" size="small" />
8990
</IconButton>
9091
</div>

packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/pipeline-preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { PipelineOutputOptionsMenu } from '../../pipeline-output-options-menu';
1717
import type { PipelineOutputOption } from '../../pipeline-output-options-menu';
1818
import { getPipelineStageOperatorsFromBuilderState } from '../../../modules/pipeline-builder/builder-helpers';
1919
import { OutputStageBanner } from './pipeline-stages-preview';
20-
import { AtlastStagePreivew } from './../../atlas-stage-preview';
20+
import { AtlasStagePreview } from './../../atlas-stage-preview';
2121
import {
2222
isMissingAtlasStageSupport,
2323
findAtlasOperator,
@@ -114,7 +114,7 @@ const PreviewResults = ({
114114
if (isMissingAtlasSupport) {
115115
return (
116116
<div className={centerStyles}>
117-
<AtlastStagePreivew stageOperator={atlasOperator} />
117+
<AtlasStagePreview stageOperator={atlasOperator} />
118118
</div>
119119
);
120120
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import React from 'react';
2+
import type { ComponentProps } from 'react';
3+
import { render, screen, within } from '@testing-library/react';
4+
import userEvent from '@testing-library/user-event';
5+
import sinon from 'sinon';
6+
import { expect } from 'chai';
7+
8+
import { PipelineConfirmModal } from './pipeline-confirm-modal';
9+
10+
const renderPipelineConfirmModal = (
11+
props: Partial<ComponentProps<typeof PipelineConfirmModal>> = {}
12+
) => {
13+
render(
14+
<PipelineConfirmModal
15+
isModalOpen={true}
16+
onConfirmNewPipeline={() => {}}
17+
onCloseModal={() => {}}
18+
{...props}
19+
/>
20+
);
21+
};
22+
23+
describe('PipelineConfirmModal [Component]', function() {
24+
it('renders correct text', function() {
25+
renderPipelineConfirmModal();
26+
expect(screen.findByText('Are you sure you want to create a new pipeline?')).to.exist;
27+
expect(screen.findByText('Creating this pipeline will abandon unsaved changes to the current pipeline.')).to.exist;
28+
});
29+
30+
it('calls onCancel when clicking the cancel button', function() {
31+
const onCancelSpy = sinon.spy();
32+
renderPipelineConfirmModal({
33+
onCloseModal: onCancelSpy,
34+
});
35+
const modal = screen.getByTestId('confirm-new-pipeline-modal');
36+
expect(onCancelSpy.callCount).to.equal(0);
37+
38+
userEvent.click(within(modal).getByText(/cancel/gi), undefined, {
39+
skipPointerEventsCheck: true,
40+
});
41+
expect(onCancelSpy.callCount).to.equal(1);
42+
});
43+
44+
it('calls onConfirmNewPipeline when clicking the confirm button', function() {
45+
const onConfirmNewPipelineSpy = sinon.spy();
46+
renderPipelineConfirmModal({
47+
onConfirmNewPipeline: onConfirmNewPipelineSpy,
48+
});
49+
const modal = screen.getByTestId('confirm-new-pipeline-modal');
50+
expect(onConfirmNewPipelineSpy.callCount).to.equal(0);
51+
52+
userEvent.click(within(modal).getByText(/confirm/gi), undefined, {
53+
skipPointerEventsCheck: true,
54+
});
55+
expect(onConfirmNewPipelineSpy.callCount).to.equal(1);
56+
});
57+
});

0 commit comments

Comments
 (0)