Skip to content

Commit ce47290

Browse files
authored
Merge branch 'main' into COMPASS-9411
2 parents 97f64d1 + 85bdf1b commit ce47290

File tree

14 files changed

+145
-49
lines changed

14 files changed

+145
-49
lines changed

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 **Mongodb Compass**.
2-
This document was automatically generated on Tue May 27 2025.
2+
This document was automatically generated on Wed May 28 2025.
33

44
## List of dependencies
55

docs/tracking-plan.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
> the tracking plan for the specific Compass version you can use the following
77
> URL: `https://github.com/mongodb-js/compass/blob/<compass version>/docs/tracking-plan.md`
88
9-
Generated on Tue, May 27, 2025
9+
Generated on Wed, May 28, 2025
1010

1111
## Table of Contents
1212

@@ -154,6 +154,7 @@ Generated on Tue, May 27, 2025
154154
- [Secret Storage Not Available](#event--SecretStorageNotAvailableEvent)
155155
- [Experiment Viewed](#event--ExperimentViewedEvent)
156156
- [Create Index Button Clicked](#event--CreateIndexButtonClickedEvent)
157+
- [UUID Encountered](#event--UUIDEncounteredEvent)
157158

158159
### Performance Tab
159160

@@ -1802,6 +1803,16 @@ a system that doesn't offer a suitable secret storage backend.
18021803
- **context** (required): `"Create Index Modal"`
18031804
- **is_compass_web** (optional): `true | undefined`
18041805

1806+
<a name="event--UUIDEncounteredEvent"></a>
1807+
1808+
### UUID Encountered
1809+
1810+
**Properties**:
1811+
1812+
- **subtype** (required): `3 | 4`
1813+
- **count** (required): `number`
1814+
- **is_compass_web** (optional): `true | undefined`
1815+
18051816
## Performance Tab
18061817

18071818
<a name="event--CurrentOpShowOperationDetailsEvent"></a>

packages/compass-components/src/components/bson-value.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ const BinaryValue: React.FunctionComponent<PropsByValueType<'Binary'>> = ({
144144
}
145145
if (value.sub_type === Binary.SUBTYPE_UUID) {
146146
let uuid: string;
147-
148147
try {
149148
// Try to get the pretty hex version of the UUID
150149
uuid = value.toUUID().toString();

packages/compass-components/src/components/signal-popover.spec.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,6 @@ describe('SignalPopover', function () {
5151
});
5252
});
5353

54-
it('should show insights badge text by default if shouldExpandBadge is true', function () {
55-
const { rerender } = render(
56-
<SignalPopover signals={signals[0]} shouldExpandBadge={false} />
57-
);
58-
59-
// opacity: 0 means that the text will not show up
60-
expect(screen.getByTestId('insight-badge-text').style.opacity).to.equal(
61-
'0'
62-
);
63-
64-
rerender(<SignalPopover signals={signals[0]} shouldExpandBadge={true} />);
65-
// opacity: 1 means that the text will show up
66-
expect(screen.getByTestId('insight-badge-text').style.opacity).to.equal(
67-
'1'
68-
);
69-
});
70-
7154
describe('SignalHooksProvider', function () {
7255
it('should call hooks through the signal lifecycle', function () {
7356
const hooks: React.ComponentProps<typeof SignalHooksProvider> = {

packages/compass-components/src/components/signal-popover.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ type SignalPopoverProps = {
124124
darkMode?: boolean;
125125
onPopoverOpenChange?: (open: boolean) => void;
126126
className?: string;
127-
shouldExpandBadge?: boolean;
128127
};
129128

130129
const signalCardContentStyles = css({
@@ -442,7 +441,6 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
442441
darkMode: _darkMode,
443442
onPopoverOpenChange: _onPopoverOpenChange,
444443
className,
445-
shouldExpandBadge,
446444
}) => {
447445
const hooks = useContext(TrackingHooksContext);
448446
const darkMode = useDarkMode(_darkMode);
@@ -455,7 +453,6 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
455453
const currentSignal = signals[currentSignalIndex];
456454
const multiSignals = signals.length > 1;
457455
const isActive = isHovered || popoverOpen;
458-
const shouldShowFullBadge = isActive || shouldExpandBadge;
459456

460457
const triggerRef = useRef<HTMLButtonElement>(null);
461458

@@ -592,7 +589,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
592589
className
593590
),
594591
style: {
595-
width: shouldShowFullBadge ? activeBadgeWidth : 18,
592+
width: isActive ? activeBadgeWidth : 18,
596593
},
597594
ref: triggerRef,
598595
},
@@ -611,7 +608,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
611608
size="small"
612609
className={cx(badgeIconStyles, badgeIconCollapsedStyles)}
613610
data-testid="insight-badge-icon"
614-
style={{ opacity: shouldShowFullBadge ? 0 : 1 }}
611+
style={{ opacity: isActive ? 0 : 1 }}
615612
></Icon>
616613
<strong
617614
className={cx(
@@ -621,7 +618,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
621618
data-testid="insight-badge-text"
622619
style={{
623620
width: activeBadgeWidth,
624-
opacity: shouldShowFullBadge ? 1 : 0,
621+
opacity: isActive ? 1 : 0,
625622
}}
626623
>
627624
{badgeLabel}

packages/compass-connections-navigation/src/connect-button-with-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function ConnectButtonWithMenu({
9191
glyph="Connect"
9292
onClick={onClick}
9393
>
94-
Here
94+
Connect
9595
</ConnectMenuItem>,
9696
<ConnectMenuItem
9797
key="connection-connect-in-new-window"

packages/compass-crud/src/components/crud-toolbar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ const CrudToolbar: React.FunctionComponent<CrudToolbarProps> = ({
258258
onClick={onDeleteButtonClicked}
259259
></DeleteMenu>
260260
)}
261-
{insights && (
262-
<SignalPopover signals={insights} shouldExpandBadge={true} />
263-
)}
261+
{insights && <SignalPopover signals={insights} />}
264262
</div>
265263
<div className={toolbarRightActionStyles}>
266264
<Select

packages/compass-crud/src/components/readonly-document.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,13 @@ class ReadonlyDocument extends React.Component<
132132
*/
133133
renderElements() {
134134
return (
135-
<DocumentList.Document
136-
value={this.props.doc}
137-
// Provide extra whitespace for the expand button
138-
extraGutterWidth={spacing[900]}
139-
/>
135+
<>
136+
<DocumentList.Document
137+
value={this.props.doc}
138+
// Provide extra whitespace for the expand button
139+
extraGutterWidth={spacing[900]}
140+
/>
141+
</>
140142
);
141143
}
142144

packages/compass-crud/src/stores/crud-store.spec.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,6 +2296,7 @@ describe('store', function () {
22962296
});
22972297

22982298
describe('fetchDocuments', function () {
2299+
const track = createNoopTrack();
22992300
let findResult: unknown[] = [];
23002301
let csfleMode = 'disabled';
23012302
let find = sinon.stub().callsFake(() => {
@@ -2323,7 +2324,7 @@ describe('store', function () {
23232324
});
23242325

23252326
it('should call find with $bsonSize projection when mongodb version is >= 4.4, not connected to ADF and csfle is disabled', async function () {
2326-
await fetchDocuments(dataService, '5.0.0', false, 'test.test', {});
2327+
await fetchDocuments(dataService, track, '5.0.0', false, 'test.test', {});
23272328
expect(find).to.have.been.calledOnce;
23282329
expect(find.getCall(0))
23292330
.to.have.nested.property('args.2.projection')
@@ -2334,6 +2335,7 @@ describe('store', function () {
23342335
findResult = [{ __size: new Int32(42), __doc: { _id: 1 } }];
23352336
const docs = await fetchDocuments(
23362337
dataService,
2338+
track,
23372339
'4.0.0',
23382340
false,
23392341
'test.test',
@@ -2345,7 +2347,7 @@ describe('store', function () {
23452347
});
23462348

23472349
it('should NOT call find with $bsonSize projection when mongodb version is < 4.4', async function () {
2348-
await fetchDocuments(dataService, '4.0.0', false, 'test.test', {});
2350+
await fetchDocuments(dataService, track, '4.0.0', false, 'test.test', {});
23492351
expect(find).to.have.been.calledOnce;
23502352
expect(find.getCall(0)).to.have.nested.property(
23512353
'args.2.projection',
@@ -2354,7 +2356,7 @@ describe('store', function () {
23542356
});
23552357

23562358
it('should NOT call find with $bsonSize projection when connected to ADF', async function () {
2357-
await fetchDocuments(dataService, '5.0.0', true, 'test.test', {});
2359+
await fetchDocuments(dataService, track, '5.0.0', true, 'test.test', {});
23582360
expect(find).to.have.been.calledOnce;
23592361
expect(find.getCall(0)).to.have.nested.property(
23602362
'args.2.projection',
@@ -2364,7 +2366,7 @@ describe('store', function () {
23642366

23652367
it('should NOT call find with $bsonSize projection when csfle is enabled', async function () {
23662368
csfleMode = 'enabled';
2367-
await fetchDocuments(dataService, '5.0.0', false, 'test.test', {});
2369+
await fetchDocuments(dataService, track, '5.0.0', false, 'test.test', {});
23682370
expect(find).to.have.been.calledOnce;
23692371
expect(find.getCall(0)).to.have.nested.property(
23702372
'args.2.projection',
@@ -2375,6 +2377,7 @@ describe('store', function () {
23752377
it('should keep user projection when provided', async function () {
23762378
await fetchDocuments(
23772379
dataService,
2380+
track,
23782381
'5.0.0',
23792382
false,
23802383
'test.test',
@@ -2399,6 +2402,7 @@ describe('store', function () {
23992402

24002403
const docs = await fetchDocuments(
24012404
dataService,
2405+
track,
24022406
'5.0.0',
24032407
false,
24042408
'test.test',
@@ -2419,7 +2423,14 @@ describe('store', function () {
24192423
find = sinon.stub().rejects(new TypeError('🤷‍♂️'));
24202424

24212425
try {
2422-
await fetchDocuments(dataService, '5.0.0', false, 'test.test', {});
2426+
await fetchDocuments(
2427+
dataService,
2428+
track,
2429+
'5.0.0',
2430+
false,
2431+
'test.test',
2432+
{}
2433+
);
24232434
expect.fail('Expected fetchDocuments to fail with error');
24242435
} catch (err) {
24252436
expect(find).to.have.been.calledOnce;
@@ -2431,7 +2442,14 @@ describe('store', function () {
24312442
find = sinon.stub().rejects(new MongoServerError('Nope'));
24322443

24332444
try {
2434-
await fetchDocuments(dataService, '3.0.0', true, 'test.test', {});
2445+
await fetchDocuments(
2446+
dataService,
2447+
track,
2448+
'3.0.0',
2449+
true,
2450+
'test.test',
2451+
{}
2452+
);
24352453
expect.fail('Expected fetchDocuments to fail with error');
24362454
} catch (err) {
24372455
expect(find).to.have.been.calledOnce;

packages/compass-crud/src/stores/crud-store.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ const INITIAL_BULK_UPDATE_TEXT = `{
112112

113113
export const fetchDocuments: (
114114
dataService: DataService,
115+
track: TrackFunction,
115116
serverVersion: string,
116117
isDataLake: boolean,
117118
...args: Parameters<DataService['find']>
118119
) => Promise<HadronDocument[]> = async (
119120
dataService: DataService,
121+
track: TrackFunction,
120122
serverVersion,
121123
isDataLake,
122124
ns,
@@ -145,17 +147,31 @@ export const fetchDocuments: (
145147
};
146148

147149
try {
148-
return (
150+
let uuidSubtype3Count = 0;
151+
let uuidSubtype4Count = 0;
152+
const docs = (
149153
await dataService.find(ns, filter, modifiedOptions, executionOptions)
150154
).map((doc) => {
151155
const { __doc, __size, ...rest } = doc;
156+
let hadronDoc: HadronDocument;
152157
if (__doc && __size && Object.keys(rest).length === 0) {
153-
const hadronDoc = new HadronDocument(__doc);
158+
hadronDoc = new HadronDocument(__doc);
154159
hadronDoc.size = Number(__size);
155-
return hadronDoc;
160+
} else {
161+
hadronDoc = new HadronDocument(doc);
156162
}
157-
return new HadronDocument(doc);
163+
const { subtype3Count, subtype4Count } = hadronDoc.findUUIDs();
164+
uuidSubtype3Count += subtype3Count;
165+
uuidSubtype4Count += subtype4Count;
166+
return hadronDoc;
158167
});
168+
if (uuidSubtype3Count > 0) {
169+
track('UUID Encountered', { subtype: 3, count: uuidSubtype3Count });
170+
}
171+
if (uuidSubtype4Count > 0) {
172+
track('UUID Encountered', { subtype: 4, count: uuidSubtype4Count });
173+
}
174+
return docs;
159175
} catch (err) {
160176
// We are handling all the cases where the size calculating projection might
161177
// not work, but just in case we run into some other environment or use-case
@@ -896,6 +912,7 @@ class CrudStoreImpl
896912
try {
897913
documents = await fetchDocuments(
898914
this.dataService,
915+
this.track,
899916
this.state.version,
900917
this.state.isDataLake,
901918
ns,
@@ -1733,6 +1750,7 @@ class CrudStoreImpl
17331750
),
17341751
fetchDocuments(
17351752
this.dataService,
1753+
this.track,
17361754
this.state.version,
17371755
this.state.isDataLake,
17381756
ns,

0 commit comments

Comments
 (0)