Skip to content

Commit 6849e08

Browse files
committed
Merge branch 'main' into 1.32-releases
2 parents 75de964 + 75feb61 commit 6849e08

File tree

58 files changed

+367
-211
lines changed

Some content is hidden

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

58 files changed

+367
-211
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 **compass**.
2-
This document was automatically generated on Mon Jul 18 2022.
2+
This document was automatically generated on Sun Jul 24 2022.
33

44
## List of dependencies
55

package-lock.json

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

packages/compass-aggregations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"webpack": "webpack-compass",
2121
"start": "npm run webpack serve -- --mode development",
2222
"analyze": "npm run webpack -- --mode production --analyze",
23-
"typecheck": "tsc --noEmit",
23+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
2424
"depcheck": "compass-scripts check-peer-deps && depcheck",
2525
"eslint": "eslint",
2626
"lint": "npm run eslint .",

packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-builder-workspace.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class PipelineWorkspace extends PureComponent {
5555
isOverviewOn: PropTypes.bool.isRequired,
5656
projections: PropTypes.array.isRequired,
5757
projectionsChanged: PropTypes.func.isRequired,
58-
newPipelineFromPaste: PropTypes.func.isRequired
58+
newPipelineFromPaste: PropTypes.func.isRequired,
59+
isAtlasDeployed: PropTypes.bool
5960
};
6061

6162
/**
@@ -132,6 +133,7 @@ class PipelineWorkspace extends PureComponent {
132133
projections={this.props.projections}
133134
projectionsChanged={this.props.projectionsChanged}
134135
newPipelineFromPaste={this.props.newPipelineFromPaste}
136+
isAtlasDeployed={this.props.isAtlasDeployed}
135137
/>);
136138
}
137139

packages/compass-aggregations/src/components/pipeline-explain/index.spec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const renderPipelineExplain = (
1616
isModalOpen={true}
1717
onCancelExplain={() => {}}
1818
onCloseModal={() => {}}
19-
onRunExplain={() => {}}
2019
{...props}
2120
/>
2221
);
@@ -33,7 +32,7 @@ describe('PipelineExplain', function () {
3332
expect(within(modal).getByTestId('pipeline-explain-cancel')).to.exist;
3433
expect(onCancelExplainSpy.callCount).to.equal(0);
3534

36-
userEvent.click(within(modal).getByText(/cancel/gi), null, {
35+
userEvent.click(within(modal).getByText(/cancel/gi), undefined, {
3736
skipPointerEventsCheck: true,
3837
});
3938
expect(onCancelExplainSpy.callCount).to.equal(1);

packages/compass-aggregations/src/components/pipeline-toolbar/index.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('PipelineToolbar', function () {
7878
expect(
7979
within(settings)
8080
.getByTestId('pipeline-name')
81-
.textContent.trim()
81+
?.textContent?.trim()
8282
.toLowerCase(),
8383
'shows untitled as default name'
8484
).to.equal('untitled');

packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('PipelineActions', function () {
6868
it('calls onToggleOptions on click', function () {
6969
const button = screen.getByTestId('pipeline-toolbar-options-button');
7070
expect(button).to.exist;
71-
expect(button.textContent.toLowerCase().trim()).to.equal('less options');
71+
expect(button?.textContent?.toLowerCase().trim()).to.equal('less options');
7272
expect(within(button).getByLabelText('Caret Down Icon')).to.exist;
7373

7474
userEvent.click(button);
@@ -101,7 +101,7 @@ describe('PipelineActions', function () {
101101
it('toggle options action button', function () {
102102
const button = screen.getByTestId('pipeline-toolbar-options-button');
103103
expect(button).to.exist;
104-
expect(button.textContent.toLowerCase().trim()).to.equal('more options');
104+
expect(button?.textContent?.toLowerCase().trim()).to.equal('more options');
105105
expect(within(button).getByLabelText('Caret Right Icon')).to.exist;
106106

107107
userEvent.click(button);

packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-name.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PipelineName } from './pipeline-name';
77
describe('PipelineName', function () {
88
it('renders Untitled as default name', function () {
99
render(<PipelineName name={''} isModified={false} />);
10-
expect(screen.getByTestId('pipeline-name').textContent.trim()).to.equal(
10+
expect(screen.getByTestId('pipeline-name')?.textContent?.trim()).to.equal(
1111
'Untitled'
1212
);
1313
});
@@ -17,14 +17,14 @@ describe('PipelineName', function () {
1717
expect(
1818
screen
1919
.getByTestId('pipeline-name')
20-
.textContent.trim()
20+
?.textContent?.trim()
2121
.replace(/\u00a0/g, ' ')
2222
).to.equal('Untitled – modified');
2323
});
2424

2525
it('renders pipeline name', function () {
2626
render(<PipelineName name={'Hello'} isModified={false} />);
27-
expect(screen.getByTestId('pipeline-name').textContent.trim()).to.equal(
27+
expect(screen.getByTestId('pipeline-name')?.textContent?.trim()).to.equal(
2828
'Hello'
2929
);
3030
});
@@ -34,7 +34,7 @@ describe('PipelineName', function () {
3434
expect(
3535
screen
3636
.getByTestId('pipeline-name')
37-
.textContent.trim()
37+
?.textContent?.trim()
3838
.replace(/\u00a0/g, ' ')
3939
).to.equal('Name changed – modified');
4040
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ class Pipeline extends PureComponent {
230230
projections={this.props.projections}
231231
projectionsChanged={this.props.projectionsChanged}
232232
newPipelineFromPaste={this.props.newPipelineFromPaste}
233+
isAtlasDeployed={this.props.isAtlasDeployed}
233234
/>
234235
);
235236
}

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

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { AtlasLogoMark, Body, Link } from '@mongodb-js/compass-components';
1+
import { AtlasLogoMark, Body, Link, Button } from '@mongodb-js/compass-components';
22
import React, { Component } from 'react';
33
import PropTypes from 'prop-types';
44
import { Document } from '@mongodb-js/compass-crud';
5-
import { TextButton } from 'hadron-react-buttons';
65
import LoadingOverlay from '../loading-overlay';
76
import { OUT, MERGE } from '../../modules/pipeline';
87
import decomment from 'decomment';
@@ -29,10 +28,10 @@ class StagePreview extends Component {
2928
isComplete: PropTypes.bool.isRequired,
3029
// Can be undefined on the initial render
3130
isMissingAtlasOnlyStageSupport: PropTypes.bool,
32-
openLink: PropTypes.func.isRequired,
3331
index: PropTypes.number.isRequired,
3432
stageOperator: PropTypes.string,
35-
stage: PropTypes.string
33+
stage: PropTypes.string,
34+
isAtlasDeployed: PropTypes.bool
3635
}
3736

3837
/**
@@ -57,14 +56,6 @@ class StagePreview extends Component {
5756
this.props.runOutStage(this.props.index);
5857
}
5958

60-
/**
61-
* Called when the Atlas Signup CTA link is clicked.
62-
*/
63-
onAtlasSignupCtaClicked = () => {
64-
track('Atlas Link Clicked', { screen: 'agg_builder' });
65-
this.props.openLink('https://www.mongodb.com/cloud/atlas/lp/search-1?utm_campaign=atlas_search&utm_source=compass&utm_medium=product&utm_content=v1');
66-
}
67-
6859
/**
6960
* If the stage operator is $merge we have special behaviour.
7061
*
@@ -98,6 +89,15 @@ class StagePreview extends Component {
9889
The $merge operator will cause the pipeline to persist the results to
9990
the specified location.
10091
</div>
92+
{this.props.isAtlasDeployed && (
93+
<Button
94+
variant="primary"
95+
data-testid="save-merge-documents"
96+
onClick={this.onSaveDocuments}
97+
>
98+
Merge documents
99+
</Button>
100+
)}
101101
</div>
102102
);
103103
}
@@ -136,6 +136,15 @@ class StagePreview extends Component {
136136
the specified location (collection, S3, or Atlas). If the collection
137137
exists it will be replaced.
138138
</div>
139+
{this.props.isAtlasDeployed && (
140+
<Button
141+
variant="primary"
142+
data-testid="save-out-documents"
143+
onClick={this.onSaveDocuments}
144+
>
145+
Save documents
146+
</Button>
147+
)}
139148
</Body>
140149
);
141150
}
@@ -149,17 +158,29 @@ class StagePreview extends Component {
149158
renderAtlasOnlyStagePreviewSection() {
150159
return (
151160
<div className={styles['stage-preview-missing-search-support']}>
152-
<AtlasLogoMark size={30} className={styles['stage-preview-missing-search-support-icon']} />
153-
<div data-test-id="stage-preview-missing-search-support" className={styles['stage-preview-missing-search-support-text']}>
154-
This stage is only available with MongoDB Atlas.
155-
156-
Create a free cluster or connect to an Atlas cluster to build search indexes and use {this.props.stageOperator} aggregation stage to run fast, relevant search queries.
157-
</div>
158-
<TextButton
159-
text="Create Free Cluster"
160-
className="btn btn-xs btn-primary"
161-
clickHandler={this.onAtlasSignupCtaClicked}
161+
<AtlasLogoMark
162+
size={30}
163+
className={styles['stage-preview-missing-search-support-icon']}
162164
/>
165+
<div
166+
data-test-id="stage-preview-missing-search-support"
167+
className={styles['stage-preview-missing-search-support-text']}
168+
>
169+
This stage is only available with MongoDB Atlas. Create a free cluster
170+
or connect to an Atlas cluster to build search indexes and use{' '}
171+
{this.props.stageOperator} aggregation stage to run fast, relevant
172+
search queries.
173+
</div>
174+
<Button
175+
href="https://www.mongodb.com/cloud/atlas/lp/search-1?utm_campaign=atlas_search&utm_source=compass&utm_medium=product&utm_content=v1"
176+
target="_blank"
177+
onClick={() => {
178+
track('Atlas Link Clicked', { screen: 'agg_builder' });
179+
}}
180+
variant="primary"
181+
>
182+
Create free cluster
183+
</Button>
163184
</div>
164185
);
165186
}

0 commit comments

Comments
 (0)