Skip to content

Commit 74472a0

Browse files
authored
feat(database-collections): remove option to create capped coll COMPASS-8292 (#6617)
* remove create capped options * fix showing capped badge
1 parent ea4869a commit 74472a0

File tree

17 files changed

+13
-453
lines changed

17 files changed

+13
-453
lines changed

packages/collection-model/lib/collection-properties.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const PROPERTIES_FLE2 = 'fle2';
77
const PROPERTIES_VIEW = 'view';
88
const PROPERTIES_READ_ONLY = 'read-only';
99

10+
/**
11+
* @param {import('../').CollectionProps} coll
12+
*/
1013
function getProperties(coll) {
1114
const properties = [];
1215

@@ -29,7 +32,7 @@ function getProperties(coll) {
2932
});
3033
}
3134

32-
if (coll.capped) {
35+
if (coll.is_capped) {
3336
properties.push({
3437
id: PROPERTIES_CAPPED,
3538
});

packages/collection-model/lib/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const CollectionModel = AmpersandModel.extend(debounceActions(['fetch']), {
222222
},
223223
},
224224
properties: {
225-
deps: ['collation', 'type', 'capped', 'clustered', 'readonly', 'fle2'],
225+
deps: ['collation', 'type', 'is_capped', 'clustered', 'readonly', 'fle2'],
226226
fn() {
227227
return getProperties(this);
228228
},

packages/compass-e2e-tests/helpers/commands/add-collection.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import type { CompassBrowser } from '../compass-browser';
22
import * as Selectors from '../selectors';
33

44
export type AddCollectionOptions = {
5-
capped?: {
6-
size: number;
7-
};
85
customCollation?: {
96
locale: string;
107
strength: number;
@@ -51,15 +48,6 @@ export async function addCollection(
5148
);
5249
}
5350

54-
if (collectionOptions && collectionOptions.capped) {
55-
await browser.clickVisible(Selectors.CreateCollectionCappedCheckboxLabel);
56-
57-
await browser.setValueVisible(
58-
Selectors.CreateCollectionCappedSizeInput,
59-
collectionOptions.capped.size.toString()
60-
);
61-
}
62-
6351
if (collectionOptions && collectionOptions.customCollation) {
6452
await browser.clickVisible(
6553
Selectors.CreateCollectionCustomCollationCheckboxLabel

packages/compass-e2e-tests/helpers/selectors.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,6 @@ export const CreateCollectionCreateButton =
458458
'[data-testid="create-collection-modal"] [data-testid="submit-button"]';
459459
export const CreateCollectionCancelButton =
460460
'[data-testid="create-collection-modal"] [data-testid="cancel-button"]';
461-
export const CreateCollectionCappedCheckboxLabel =
462-
'[data-testid="capped-collection-fields"] [data-testid="capped-collection-fields-label"]';
463-
export const CreateCollectionCappedSizeInput =
464-
'[data-testid="capped-collection-fields"] [data-testid="capped-size"]';
465461
export const CreateCollectionCollectionOptionsAccordion =
466462
'[data-testid="create-collection-modal"] [data-testid="additional-collection-preferences"]';
467463
export const CreateCollectionCustomCollationCheckboxLabel =

packages/compass-e2e-tests/tests/database-collections-tab.test.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -174,39 +174,6 @@ describe('Database collections tab', function () {
174174
await browser.waitUntilActiveDatabaseTab(DEFAULT_CONNECTION_NAME_1, 'test');
175175
});
176176

177-
it('can create a capped collection', async function () {
178-
const collectionName = 'my-capped-collection';
179-
180-
// open the create collection modal from the button at the top
181-
await browser.clickVisible(Selectors.DatabaseCreateCollectionButton);
182-
183-
await browser.addCollection(
184-
collectionName,
185-
{
186-
capped: {
187-
size: 1000,
188-
},
189-
},
190-
'add-collection-modal-capped.png'
191-
);
192-
193-
await browser.navigateToDatabaseCollectionsTab(
194-
DEFAULT_CONNECTION_NAME_1,
195-
'test'
196-
);
197-
198-
const selector = Selectors.collectionCard('test', collectionName);
199-
await browser.scrollToVirtualItem(
200-
Selectors.CollectionsGrid,
201-
selector,
202-
'grid'
203-
);
204-
const collectionCard = browser.$(selector);
205-
await collectionCard.waitForDisplayed();
206-
207-
// TODO: how do we make sure this is really a capped collection?
208-
});
209-
210177
it('can create a collection with custom collation', async function () {
211178
const collectionName = 'my-custom-collation-collection';
212179

packages/compass-telemetry/src/telemetry-events.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,11 +2253,6 @@ type SwitchViewTypeEvent = ConnectionScopedEvent<{
22532253
type CollectionCreatedEvent = ConnectionScopedEvent<{
22542254
name: 'Collection Created';
22552255
payload: {
2256-
/**
2257-
* Indicates whether the collection is capped.
2258-
*/
2259-
is_capped: boolean;
2260-
22612256
/**
22622257
* Indicates whether the collection has a custom collation.
22632258
*/
@@ -2293,11 +2288,6 @@ type CollectionCreatedEvent = ConnectionScopedEvent<{
22932288
type DatabaseCreatedEvent = ConnectionScopedEvent<{
22942289
name: 'Database Created';
22952290
payload: {
2296-
/**
2297-
* Indicates whether the first collection in the database is capped.
2298-
*/
2299-
is_capped: boolean;
2300-
23012291
/**
23022292
* Indicates whether the first collection in the database has a custom collation.
23032293
*/

packages/databases-collections/src/components/collection-fields/capped-collection-fields.jsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

packages/databases-collections/src/components/collection-fields/capped-collection-fields.spec.jsx

Lines changed: 0 additions & 142 deletions
This file was deleted.

packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const EXPIRE_AFTER_SECONDS_DESCRIPTION =
1515
'The _id field must be a date or an array that contains date values.';
1616

1717
function ClusteredCollectionFields({
18-
isCapped,
1918
isTimeSeries,
2019
isClustered,
2120
clusteredIndex,
@@ -34,7 +33,7 @@ function ClusteredCollectionFields({
3433
return (
3534
<CollapsibleFieldSet
3635
toggled={isClustered}
37-
disabled={isTimeSeries || isCapped}
36+
disabled={isTimeSeries}
3837
onToggle={(checked) => onChangeIsClustered(checked)}
3938
label="Clustered Collection"
4039
data-testid="clustered-collection-fields"
@@ -72,7 +71,6 @@ function ClusteredCollectionFields({
7271
}
7372

7473
ClusteredCollectionFields.propTypes = {
75-
isCapped: PropTypes.bool.isRequired,
7674
isTimeSeries: PropTypes.bool.isRequired,
7775
isClustered: PropTypes.bool.isRequired,
7876
clusteredIndex: PropTypes.object.isRequired,

0 commit comments

Comments
 (0)