Skip to content

Commit e6806f9

Browse files
committed
Bugfix: 3107, 3123, 3042, 3102, 3126
1 parent 77a43bd commit e6806f9

File tree

6 files changed

+105
-70
lines changed

6 files changed

+105
-70
lines changed

package-lock.json

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

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,23 +226,23 @@
226226
"url": "git://github.com/10gen/compass.git"
227227
},
228228
"dependencies": {
229-
"@mongodb-js/compass-aggregations": "^1.8.0",
229+
"@mongodb-js/compass-aggregations": "^1.8.1",
230230
"@mongodb-js/compass-auth-kerberos": "^1.0.1",
231231
"@mongodb-js/compass-auth-ldap": "^1.0.1",
232232
"@mongodb-js/compass-auth-x509": "^1.0.1",
233233
"@mongodb-js/compass-auto-updates": "^0.0.2",
234234
"@mongodb-js/compass-collection-stats": "^3.0.1",
235235
"@mongodb-js/compass-connect": "^3.4.0",
236-
"@mongodb-js/compass-crud": "^5.3.5",
236+
"@mongodb-js/compass-crud": "^5.3.7",
237237
"@mongodb-js/compass-deployment-awareness": "^6.1.1",
238238
"@mongodb-js/compass-document-validation": "^8.0.3",
239-
"@mongodb-js/compass-export-to-language": "^2.3.0",
239+
"@mongodb-js/compass-export-to-language": "^2.3.2",
240240
"@mongodb-js/compass-find-in-page": "^1.0.2",
241241
"@mongodb-js/compass-import-export": "^1.0.4",
242242
"@mongodb-js/compass-instance": "^1.0.1",
243243
"@mongodb-js/compass-license": "^1.0.0",
244244
"@mongodb-js/compass-plugin-info": "^1.0.0",
245-
"@mongodb-js/compass-query-bar": "^1.0.28",
245+
"@mongodb-js/compass-query-bar": "^1.0.30",
246246
"@mongodb-js/compass-query-history": "^3.0.2",
247247
"@mongodb-js/compass-server-version": "^2.0.1",
248248
"@mongodb-js/compass-serverstats": "^12.1.0",

src/internal-plugins/database/lib/components/create-collection-checkbox.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CreateCollectionCheckbox extends React.Component {
1919
<label>
2020
<input
2121
type="checkbox"
22-
onClick={this.props.onClickHandler}
22+
onChange={this.props.onClickHandler}
2323
checked={this.props.checked}
2424
className={this.props.inputClassName} />
2525
<p className={this.props.titleClassName}>{this.props.name}</p>

src/internal-plugins/indexes/lib/component/create-index-checkbox.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CreateIndexCheckbox extends React.Component {
1515
constructor(props) {
1616
super(props);
1717
this.state = {
18-
checked: false
18+
checked: props.checked
1919
};
2020
}
2121

@@ -61,7 +61,8 @@ CreateIndexCheckbox.displayName = 'CreateIndexCheckbox';
6161
CreateIndexCheckbox.propTypes = {
6262
description: PropTypes.string.isRequired,
6363
isParam: PropTypes.bool.isRequired,
64-
option: PropTypes.string.isRequired
64+
option: PropTypes.string.isRequired,
65+
checked: PropTypes.bool.isRequired
6566
};
6667

6768
module.exports = CreateIndexCheckbox;

src/internal-plugins/indexes/lib/component/create-index-modal.jsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ class CreateIndexModal extends React.Component {
8383
* Handle clicking the collation checkbox.
8484
*/
8585
onCollationClicked() {
86-
this.setState({ isCustomCollation: !this.state.isCustomCollation }, () => {
87-
if (this.state.isCustomCollation) {
88-
Action.updateOption('collation', {locale: 'simple'});
89-
} else {
90-
Action.updateOption('collation', false);
91-
}
92-
});
86+
this.setState({ isCustomCollation: !this.state.isCustomCollation });
9387
}
9488

9589
/**
@@ -101,24 +95,35 @@ class CreateIndexModal extends React.Component {
10195
let idx = 0;
10296
const options = [];
10397
for (const option of INDEX_OPTIONS) {
98+
const propOption = this.state.options[option.name];
99+
const checked = propOption === undefined ? false : propOption.value;
104100
options.push(
105101
<CreateIndexCheckbox
106102
key={idx++}
107103
description={option.desc}
108104
isParam={false}
109105
dataTestId={`create-index-modal-${option.name}-checkbox`}
110-
option={option.name} />
106+
option={option.name}
107+
checked={checked}/>
111108
);
112109
if (option.param) {
113-
const propOption = this.state.options[option.name];
110+
let val;
111+
if (propOption === undefined || propOption.param === undefined) {
112+
val = option.name === 'partialFilterExpression'
113+
? '{}'
114+
: '';
115+
} else {
116+
val = propOption.param;
117+
}
114118
options.push(
115119
<CreateIndexTextField
116120
key={idx++}
117121
enabled={propOption ? propOption.value : false}
118122
isParam
119123
option={option.name}
120124
dataTestId={`create-index-modal-${option.name}-field`}
121-
units={option.paramUnit} />
125+
units={option.paramUnit}
126+
value={val}/>
122127
);
123128
}
124129
}
@@ -129,6 +134,7 @@ class CreateIndexModal extends React.Component {
129134
titleClassName="create-index-collation-title"
130135
helpUrl={HELP_URL_COLLATION}
131136
onClickHandler={this.onCollationClicked.bind(this)}
137+
checked={this.state.isCustomCollation}
132138
/>
133139
</div>);
134140
options.push(this.renderCollation(idx++));
@@ -302,7 +308,8 @@ class CreateIndexModal extends React.Component {
302308
autoFocus
303309
isParam={false}
304310
option={'name'}
305-
dataTestId="create-index-modal-name" />
311+
dataTestId="create-index-modal-name"
312+
value={''}/>
306313

307314
<div className="create-index-fields">
308315
<p className="create-index-description">Configure the index definition</p>

src/internal-plugins/indexes/lib/component/create-index-text-field.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ class CreateIndexTextField extends React.Component {
1818
constructor(props) {
1919
super(props);
2020
const state = {
21-
value: ''
21+
value: props.value
2222
};
23-
if (this.props.option === 'partialFilterExpression') {
24-
state.value = '{}';
25-
}
2623
this.state = state;
2724
}
2825

@@ -166,7 +163,8 @@ CreateIndexTextField.propTypes = {
166163
isParam: PropTypes.bool.isRequired,
167164
option: PropTypes.string.isRequired,
168165
units: PropTypes.string,
169-
dataTestId: PropTypes.string
166+
dataTestId: PropTypes.string,
167+
value: PropTypes.string.isRequired
170168
};
171169

172170
CreateIndexTextField.defaultProps = {

0 commit comments

Comments
 (0)