diff --git a/packages/compass-e2e-tests/helpers/selectors.ts b/packages/compass-e2e-tests/helpers/selectors.ts index 1d615fc69c4..7e3e24a0728 100644 --- a/packages/compass-e2e-tests/helpers/selectors.ts +++ b/packages/compass-e2e-tests/helpers/selectors.ts @@ -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"]'; diff --git a/packages/compass-e2e-tests/tests/database-collections-tab.test.ts b/packages/compass-e2e-tests/tests/database-collections-tab.test.ts index 4c86c79511d..2859c2567d2 100644 --- a/packages/compass-e2e-tests/tests/database-collections-tab.test.ts +++ b/packages/compass-e2e-tests/tests/database-collections-tab.test.ts @@ -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'); }); }); diff --git a/packages/compass-indexes/src/components/type-column/type-column.jsx b/packages/compass-indexes/src/components/type-column/type-column.jsx index e9bcca61e7e..e87f31796e3 100644 --- a/packages/compass-indexes/src/components/type-column/type-column.jsx +++ b/packages/compass-indexes/src/components/type-column/type-column.jsx @@ -55,6 +55,9 @@ class TypeColumn extends PureComponent { 'data-border': true, }; } + + const helpLink = getIndexHelpLink(this.props.index.type.toUpperCase()); + return (
{this.props.index.type} - + {helpLink && ( + + )}
); } diff --git a/packages/compass-indexes/src/components/type-column/type-column.module.less b/packages/compass-indexes/src/components/type-column/type-column.module.less index 0821b9aeba0..39fa7cb1a71 100644 --- a/packages/compass-indexes/src/components/type-column/type-column.module.less +++ b/packages/compass-indexes/src/components/type-column/type-column.module.less @@ -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; @@ -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 { diff --git a/packages/compass-indexes/src/modules/indexes.spec.js b/packages/compass-indexes/src/modules/indexes.spec.js index a233c979cc9..3a369c7e2bf 100644 --- a/packages/compass-indexes/src/modules/indexes.spec.js +++ b/packages/compass-indexes/src/modules/indexes.spec.js @@ -271,6 +271,7 @@ const defaultSort = [ text: false, wildcard: false, collation: false, + clustered: false, type: 'regular', cardinality: 'single', properties: ['partial', 'ttl'], @@ -311,6 +312,7 @@ const defaultSort = [ text: false, wildcard: false, collation: true, + clustered: false, type: 'regular', cardinality: 'single', properties: ['collation'], @@ -337,6 +339,7 @@ const defaultSort = [ text: false, wildcard: false, collation: false, + clustered: false, type: 'geospatial', cardinality: 'compound', properties: [], @@ -363,6 +366,7 @@ const defaultSort = [ text: false, wildcard: false, collation: false, + clustered: false, type: 'regular', cardinality: 'single', properties: ['unique'], @@ -397,6 +401,7 @@ const usageSort = [ text: false, wildcard: false, collation: false, + clustered: false, type: 'regular', cardinality: 'single', properties: ['partial', 'ttl'], @@ -423,6 +428,7 @@ const usageSort = [ text: false, wildcard: false, collation: false, + clustered: false, type: 'geospatial', cardinality: 'compound', properties: [], @@ -449,6 +455,7 @@ const usageSort = [ text: false, wildcard: false, collation: false, + clustered: false, type: 'regular', cardinality: 'single', properties: ['unique'], @@ -489,6 +496,7 @@ const usageSort = [ text: false, wildcard: false, collation: true, + clustered: false, type: 'regular', cardinality: 'single', properties: ['collation'], diff --git a/packages/compass-indexes/src/utils/index-link-helper.js b/packages/compass-indexes/src/utils/index-link-helper.js index db7a87066bb..8f0bb1ccdea 100644 --- a/packages/compass-indexes/src/utils/index-link-helper.js +++ b/packages/compass-indexes/src/utils/index-link-helper.js @@ -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 + // 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', diff --git a/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx b/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx index 0712428fd20..490c50b23a1 100644 --- a/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx +++ b/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx @@ -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 ' + @@ -41,7 +42,7 @@ function ClusteredCollectionFields({ >