Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/compass-e2e-tests/helpers/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export const CreateCollectionTimeseriesExpireAfterSeconds =
export const CreateCollectionClusteredCheckboxLabel =
'[data-testid="clustered-collection-fields"] #toggle-clustered-collection-fields-label';
export const CreateCollectionClusteredNameField =
'[data-testid="clustered-collection-fields"] [name="clustered.name"]';
'[data-testid="clustered-collection-fields"] [name="clusteredIndex.name"]';
export const CreateCollectionClusteredExpireAfterSeconds =
'[data-testid="clustered-collection-fields"] [name="expireAfterSeconds"]';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,13 @@ describe('Database collections tab', function () {
await collectionCard
.$('[data-testid="collection-badge-clustered"]')
.waitForDisplayed();

await browser.navigateToCollectionTab('test', collectionName, 'Indexes');

const typeElement = await browser.$(
`[data-test-id="index-component-${indexName}"] [data-test-id="index-table-type"]`
);
await typeElement.waitForDisplayed();
expect(await typeElement.getText()).to.equal('CLUSTERED');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class TypeColumn extends PureComponent {
'data-border': true,
};
}

const helpLink = getIndexHelpLink(this.props.index.type.toUpperCase());

return (
<div
{...tooltipOptions}
Expand All @@ -64,10 +67,12 @@ class TypeColumn extends PureComponent {
data-test-id="index-table-type"
>
{this.props.index.type}
<InfoSprinkle
helpLink={getIndexHelpLink(this.props.index.type.toUpperCase())}
onClickHandler={this.props.openLink}
/>
{helpLink && (
<InfoSprinkle
helpLink={helpLink}
onClickHandler={this.props.openLink}
/>
)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@

@index-quantity-color: #5382a8;
@index-quantity-bg: #eaedf4;

@index-wildcard-color: #548273;
@index-wildcard-bg: #e8eceb;

@index-clustered-color: #548273;
@index-clustered-bg: #e8eceb;

.type-column {
width: auto;
padding-left: 24px;
Expand Down Expand Up @@ -69,7 +76,15 @@
text-align: center;
white-space: nowrap;
margin-right: 15px;
.pill(@index-geo-color, @index-geo-bg);
.pill(@index-wildcard-color, @index-wildcard-bg);
}

&-clustered {
display: inline-block;
text-align: center;
white-space: nowrap;
margin-right: 15px;
.pill(@index-clustered-color, @index-clustered-bg);
}

&-regular {
Expand Down
8 changes: 8 additions & 0 deletions packages/compass-indexes/src/modules/indexes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ const defaultSort = [
text: false,
wildcard: false,
collation: false,
clustered: false,
type: 'regular',
cardinality: 'single',
properties: ['partial', 'ttl'],
Expand Down Expand Up @@ -311,6 +312,7 @@ const defaultSort = [
text: false,
wildcard: false,
collation: true,
clustered: false,
type: 'regular',
cardinality: 'single',
properties: ['collation'],
Expand All @@ -337,6 +339,7 @@ const defaultSort = [
text: false,
wildcard: false,
collation: false,
clustered: false,
type: 'geospatial',
cardinality: 'compound',
properties: [],
Expand All @@ -363,6 +366,7 @@ const defaultSort = [
text: false,
wildcard: false,
collation: false,
clustered: false,
type: 'regular',
cardinality: 'single',
properties: ['unique'],
Expand Down Expand Up @@ -397,6 +401,7 @@ const usageSort = [
text: false,
wildcard: false,
collation: false,
clustered: false,
type: 'regular',
cardinality: 'single',
properties: ['partial', 'ttl'],
Expand All @@ -423,6 +428,7 @@ const usageSort = [
text: false,
wildcard: false,
collation: false,
clustered: false,
type: 'geospatial',
cardinality: 'compound',
properties: [],
Expand All @@ -449,6 +455,7 @@ const usageSort = [
text: false,
wildcard: false,
collation: false,
clustered: false,
type: 'regular',
cardinality: 'single',
properties: ['unique'],
Expand Down Expand Up @@ -489,6 +496,7 @@ const usageSort = [
text: false,
wildcard: false,
collation: true,
clustered: false,
type: 'regular',
cardinality: 'single',
properties: ['collation'],
Expand Down
2 changes: 2 additions & 0 deletions packages/compass-indexes/src/utils/index-link-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const HELP_URLS = {
GEOSPATIAL:
'https://docs.mongodb.org/manual/applications/geospatial-indexes/#geospatial-indexes',
WILDCARD: 'https://docs.mongodb.com/manual/core/index-wildcard/',
// TODO: add an entry for CLUSTERED once the docs become available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A similar comment to the one in the first pr - #2966 (comment)
Do we have a ticket name we can attach to this comment? I find it can help give context quickly when looking through code (and then if we somehow miss updating this todo we know way down the line it can be quickly updated).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://jira.mongodb.org/browse/COMPASS-5760

And I linked to it from both places

// see https://jira.mongodb.org/browse/COMPASS-5760
TEXT: 'https://docs.mongodb.org/manual/core/index-text/',
HASHED: 'https://docs.mongodb.org/manual/core/index-hashed/',
REGULAR: 'https://docs.mongodb.com/manual/indexes/#single-field',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import CollapsibleFieldSet from '../collapsible-field-set/collapsible-field-set'
import FieldSet from '../field-set/field-set';

// TODO: change this link to remove v5.3 once clustered-collections is in current
// see https://jira.mongodb.org/browse/COMPASS-5760
const HELP_URL_CLUSTERED = 'https://www.mongodb.com/docs/v5.3/core/clustered-collections/';

const EXPIRE_AFTER_SECONDS_DESCRIPTION = 'The expireAfterSeconds field enables ' +
Expand Down Expand Up @@ -41,7 +42,7 @@ function ClusteredCollectionFields({
>
<FieldSet>
<TextInput
name="clustered.name"
name="clusteredIndex.name"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug found while writing the e2e test..

value={clusteredIndex.name}
label="name"
data-testid="clustered-index-name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class CollectionFields extends PureComponent {
databaseName: '',
timeSeries: {},
expireAfterSeconds: '',
clusteredIndex: { unique: true, key: { _id: 1 } }
clusteredIndex: { name: '', unique: true, key: { _id: 1 } }
}
};

Expand Down
11 changes: 10 additions & 1 deletion packages/index-model/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ var IndexModel = Model.extend({
return !!this.extra.collation;
}
},
clustered: {
deps: ['extra'],
fn: function() {
return !!this.extra.clustered;
}
},
type: {
deps: ['geo', 'hashed', 'text', 'wildcard'],
deps: ['geo', 'hashed', 'text', 'wildcard', 'clustered'],
fn: function() {
if (this.geo) {
return 'geospatial';
Expand All @@ -117,6 +123,9 @@ var IndexModel = Model.extend({
if (this.wildcard) {
return 'wildcard';
}
if (this.clustered) {
return 'clustered';
}
return 'regular';
}
},
Expand Down