Skip to content

Commit c4e2c6d

Browse files
committed
Merge branch 'main' into 1.29-releases
2 parents 970a2af + 06fd6c3 commit c4e2c6d

File tree

61 files changed

+1191
-454
lines changed

Some content is hidden

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

61 files changed

+1191
-454
lines changed

.github/workflows/connectivity-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
run: |
6868
git clone https://github.com/mongodb-js/devtools-docker-test-envs.git
6969
cd devtools-docker-test-envs
70-
git checkout v1.2.1
70+
git checkout v1.2.2
7171
docker-compose -f docker/enterprise/docker-compose.yaml up -d
7272
docker-compose -f docker/ldap/docker-compose.yaml up -d
7373
docker-compose -f docker/scram/docker-compose.yaml up -d

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 Tue Nov 23 2021.
2+
This document was automatically generated on Mon Nov 29 2021.
33

44
## List of dependencies
55

package-lock.json

Lines changed: 8 additions & 12 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: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ function propagateCollectionEvents(namespace) {
8383
};
8484
}
8585

86+
function getParentByType(model, type) {
87+
const parent = getParent(model);
88+
return parent
89+
? parent.modelType === type
90+
? parent
91+
: getParentByType(parent, type)
92+
: null;
93+
}
94+
8695
function pickCollectionInfo({
8796
type,
8897
readonly,
@@ -235,18 +244,26 @@ const CollectionCollection = AmpersandCollection.extend(
235244
* @returns {Promise<void>}
236245
*/
237246
async fetch({ dataService, fetchInfo = true }) {
238-
const databaseName = this.parent && this.parent.getId();
247+
const databaseName = getParentByType(this, 'Database')?.getId();
239248

240249
if (!databaseName) {
241250
throw new Error(
242-
"Trying to fetch MongoDBCollectionCollection that doesn't have the parent model"
251+
`Trying to fetch ${this.modelType} that doesn't have the Database parent model`
252+
);
253+
}
254+
255+
const instanceModel = getParentByType(this, 'Instance');
256+
257+
if (!instanceModel) {
258+
throw new Error(
259+
`Trying to fetch ${this.modelType} that doesn't have the Instance parent model`
243260
);
244261
}
245262

246263
const collections = await dataService.listCollections(
247264
databaseName,
248265
{},
249-
{ nameOnly: !fetchInfo }
266+
{ nameOnly: !fetchInfo, privileges: instanceModel.auth.privileges }
250267
);
251268

252269
this.set(

packages/compass-aggregations/electron/renderer/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const store = configureStore({
4141
globalAppRegistry: appRegistry,
4242
serverVersion: '4.4.0',
4343
env: 'adl',
44+
isTimeSeries: false,
45+
isReadonly: false,
46+
sourceName: null,
4447
fields: [
4548
{ name: 'harry',
4649
value: 'harry',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ const mapStateToProps = (state) => ({
119119
inputDocuments: state.inputDocuments,
120120
namespace: state.namespace,
121121
env: state.env,
122+
isTimeSeries: state.isTimeSeries,
123+
isReadonly: state.isReadonly,
124+
sourceName: state.sourceName,
122125
serverVersion: state.serverVersion,
123126
pipeline: state.pipeline,
124127
savedPipeline: state.savedPipeline,

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class PipelineWorkspace extends PureComponent {
1919
allowWrites: PropTypes.bool.isRequired,
2020
editViewName: PropTypes.string,
2121
env: PropTypes.string.isRequired,
22+
isTimeSeries: PropTypes.bool.isRequired,
23+
isReadonly: PropTypes.bool.isRequired,
24+
sourceName: PropTypes.string,
2225
pipeline: PropTypes.array.isRequired,
2326
toggleInputDocumentsCollapsed: PropTypes.func.isRequired,
2427
refreshInputDocuments: PropTypes.func.isRequired,
@@ -47,22 +50,45 @@ class PipelineWorkspace extends PureComponent {
4750
newPipelineFromPaste: PropTypes.func.isRequired
4851
};
4952

53+
/**
54+
* The stage moved handler.
55+
*
56+
* @param {Number} fromIndex - The original index.
57+
* @param {Number} toIndex - The index to move to.
58+
*/
5059
onStageMoved = (fromIndex, toIndex) => {
5160
this.props.stageMoved(fromIndex, toIndex);
5261
this.props.runStage(0);
5362
}
5463

64+
/**
65+
* Render the modify source banner if neccessary.
66+
*
67+
* @returns {Component} The component.
68+
*/
5569
renderModifyingViewSourceBanner() {
5670
if (this.props.editViewName) {
5771
return (<ModifySourceBanner editViewName={this.props.editViewName} />);
5872
}
5973
}
6074

75+
/**
76+
* Render a stage.
77+
*
78+
* @param {Object} stage - The current stage info.
79+
* @param {Number} i - The current index.
80+
* @param {Function} connectDragSource - The function to render a stage editor toolbar.
81+
*
82+
* @returns {Component} The component.
83+
*/
6184
renderStage = (stage, i, connectDragSource) => {
6285
return (<Stage
6386
allowWrites={this.props.allowWrites}
6487
connectDragSource={connectDragSource}
6588
env={this.props.env}
89+
isTimeSeries={this.props.isTimeSeries}
90+
isReadonly={this.props.isReadonly}
91+
sourceName={this.props.sourceName}
6692
stage={stage.stage}
6793
stageOperator={stage.stageOperator}
6894
snippet={stage.snippet}
@@ -102,6 +128,11 @@ class PipelineWorkspace extends PureComponent {
102128
/>);
103129
}
104130

131+
/**
132+
* Render a stage list.
133+
*
134+
* @returns {Component} The component.
135+
*/
105136
renderStageList = () => {
106137
return (<SortableStageList
107138
items={this.props.pipeline}

packages/compass-aggregations/src/components/pipeline-workspace/pipeline-workspace.spec.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function createPipelineWorkspace({
5151
allowWrites = false,
5252
pipeline = [],
5353
env = 'atlas',
54+
isTimeSeries = false,
55+
isReadonly = false,
56+
sourceName = null,
5457
toggleInputDocumentsCollapsed = () => {},
5558
refreshInputDocuments = () => {},
5659
stageAdded = () => {},
@@ -81,6 +84,9 @@ function createPipelineWorkspace({
8184
allowWrites={allowWrites}
8285
pipeline={pipeline}
8386
env={env}
87+
isTimeSeries={isTimeSeries}
88+
isReadonly={isReadonly}
89+
sourceName={sourceName}
8490
toggleInputDocumentsCollapsed={toggleInputDocumentsCollapsed}
8591
refreshInputDocuments={refreshInputDocuments}
8692
stageAdded={stageAdded}
@@ -111,12 +117,25 @@ function createPipelineWorkspace({
111117

112118
describe('PipelineWorkspace [Component]', () => {
113119
it('renders', () => {
114-
mount(createPipelineWorkspace());
120+
mount(createPipelineWorkspace({
121+
inputDocuments: {
122+
documents: [],
123+
isLoading: false,
124+
isExpanded: true,
125+
count: 0
126+
}
127+
}));
115128
});
116129

117130
it('renders the stages contained in the pipeline', () => {
118131
const wrapper = mount(createPipelineWorkspace({
119-
pipeline: PIPELINE_1
132+
pipeline: PIPELINE_1,
133+
inputDocuments: {
134+
documents: [],
135+
isLoading: false,
136+
isExpanded: true,
137+
count: 0
138+
}
120139
}));
121140
expect(wrapper.find(Stage)).to.have.lengthOf(2);
122141
});

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ class Pipeline extends PureComponent {
114114
newPipelineFromPaste: PropTypes.func.isRequired,
115115
openCreateView: PropTypes.func.isRequired,
116116
isNewPipelineConfirm: PropTypes.bool.isRequired,
117-
setIsNewPipelineConfirm: PropTypes.func.isRequired
117+
setIsNewPipelineConfirm: PropTypes.func.isRequired,
118+
inputDocuments: PropTypes.object.isRequired
118119
};
119120

120121
static defaultProps = {

packages/compass-aggregations/src/components/stage-editor-toolbar/select-option-with-tooltip/select-option-with-tooltip.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import styles from './select-option-with-tooltip.module.less';
99

1010
class SelectOptionWithTooltip extends Component {
1111
static propTypes = {
12-
option: PropTypes.object,
12+
option: PropTypes.object.isRequired,
1313
className: PropTypes.string,
14-
children: PropTypes.array,
14+
children: PropTypes.node,
1515
};
1616

1717
render() {

0 commit comments

Comments
 (0)