Skip to content

Commit c8e6e24

Browse files
authored
Merge branch 'main' into update-eslint-to-eight
2 parents 87aeb40 + 43a4832 commit c8e6e24

File tree

25 files changed

+607
-709
lines changed

25 files changed

+607
-709
lines changed

.snyk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ ignore:
6565
Not applicable: requires attacker to render hand crafted HTML snippet
6666
inside the application. Putting on a short expiration time as we're
6767
expecting to be able to update to electron v33 (or later) soon
68-
expires: 2025-05-16T15:23:35.601Z
68+
expires: 2025-06-16T15:23:35.601Z
6969
created: 2025-03-17T15:23:35.608Z
7070
SNYK-JS-ELECTRON-9486047:
7171
- '*':
7272
reason: >-
7373
Not applicable: requires attacker to render hand crafted HTML snippet
7474
inside the application. Putting on a short expiration time as we're
7575
expecting to be able to update to electron v33 (or later) soon
76-
expires: 2025-05-20T04:40:36.098Z
76+
expires: 2025-06-20T04:40:36.098Z
7777
created: 2025-03-21T04:40:36.107Z
7878
# patches apply the minimum changes required to fix a vulnerability
7979
patch:

THIRD-PARTY-NOTICES.md

Lines changed: 5 additions & 5 deletions
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 Thu May 22 2025.
2+
This document was automatically generated on Fri May 23 2025.
33

44
## List of dependencies
55

@@ -592,7 +592,7 @@ This document was automatically generated on Thu May 22 2025.
592592
| **[yallist](#63b110ffd18712146937e9f182800c6f2b5783e76d1659a0bd4b457789b0df07)** | 3.1.1 | ISC |
593593
| **[yallist](#d400799c4e1f58dbbbe68b4d9c1b6e80e023f744bd7d16da491005fd8439200f)** | 4.0.0 | ISC |
594594
| **[yargs-parser](#617a7401008b7639df8cebae61c9c009bf04ca762c652da0975da4533bf33690)** | 21.1.1 | ISC |
595-
| **[zod](#750b81338b71d5e78ed66a065d072d2ab6b12e6aed146a736200bc63fc4f721b)** | 3.23.8 | MIT |
595+
| **[zod](#47d4f8aea57c756d184be32bcd9df03f490606057a940cf6ab006cce6cf81731)** | 3.25.17 | MIT |
596596

597597
## Package details
598598

@@ -39486,9 +39486,9 @@ License files:
3948639486
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
3948739487
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3948839488

39489-
<a id="750b81338b71d5e78ed66a065d072d2ab6b12e6aed146a736200bc63fc4f721b"></a>
39489+
<a id="47d4f8aea57c756d184be32bcd9df03f490606057a940cf6ab006cce6cf81731"></a>
3949039490

39491-
### [zod](https://www.npmjs.com/package/zod) (version 3.23.8)
39491+
### [zod](https://www.npmjs.com/package/zod) (version 3.25.17)
3949239492

3949339493
License tags: MIT
3949439494

@@ -39498,7 +39498,7 @@ License files:
3949839498

3949939499
MIT License
3950039500

39501-
Copyright (c) 2020 Colin McDonnell
39501+
Copyright (c) 2025 Colin McDonnell
3950239502

3950339503
Permission is hereby granted, free of charge, to any person obtaining a copy
3950439504
of this software and associated documentation files (the "Software"), to deal

docs/tracking-plan.md

Lines changed: 1 addition & 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 Thu, May 22, 2025
9+
Generated on Fri, May 23, 2025
1010

1111
## Table of Contents
1212

package-lock.json

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

packages/compass-connections/src/stores/connections-store-redux.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,18 +1818,21 @@ const connectWithOptions = (
18181818
connectionId: connectionInfo.id,
18191819
});
18201820

1821+
const { networkTraffic, showEndOfLifeConnectionModal } =
1822+
preferences.getPreferences();
1823+
18211824
if (
18221825
getGenuineMongoDB(connectionInfo.connectionOptions.connectionString)
18231826
.isGenuine === false
18241827
) {
18251828
dispatch(showNonGenuineMongoDBWarningModal(connectionInfo.id));
1826-
} else if (preferences.getPreferences().networkTraffic) {
1829+
} else if (showEndOfLifeConnectionModal) {
18271830
void dataService
18281831
.instance()
18291832
.then(async (instance) => {
18301833
const { version } = instance.build;
18311834
const latestEndOfLifeServerVersion =
1832-
await getLatestEndOfLifeServerVersion();
1835+
await getLatestEndOfLifeServerVersion(networkTraffic);
18331836
if (isEndOfLifeVersion(version, latestEndOfLifeServerVersion)) {
18341837
dispatch(
18351838
showEndOfLifeMongoDBWarningModal(

packages/compass-connections/src/utils/end-of-life-server.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ const {
1313

1414
let latestEndOfLifeServerVersion: Promise<string> | null = null;
1515

16-
export async function getLatestEndOfLifeServerVersion(): Promise<string> {
16+
export async function getLatestEndOfLifeServerVersion(
17+
allowNetworkRequests = true
18+
): Promise<string> {
19+
if (!allowNetworkRequests) {
20+
return FALLBACK_END_OF_LIFE_SERVER_VERSION;
21+
}
22+
1723
if (!HADRON_AUTO_UPDATE_ENDPOINT) {
1824
log.debug(
1925
mongoLogId(1_001_000_356),
@@ -68,7 +74,7 @@ export async function getLatestEndOfLifeServerVersion(): Promise<string> {
6874

6975
export function isEndOfLifeVersion(
7076
version: string,
71-
latestEndOfLifeServerVersion: string
77+
latestEndOfLifeServerVersion = FALLBACK_END_OF_LIFE_SERVER_VERSION
7278
) {
7379
try {
7480
const coercedVersion = semverCoerce(version);

packages/compass-data-modeling/src/components/diagram-editor.tsx

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ import {
1919
spacing,
2020
Button,
2121
palette,
22+
ErrorSummary,
2223
} from '@mongodb-js/compass-components';
2324
import { cancelAnalysis, retryAnalysis } from '../store/analysis-process';
25+
import type { Edit, StaticModel } from '../services/data-model-storage';
26+
import { UUID } from 'bson';
2427

2528
const loadingContainerStyles = css({
2629
width: '100%',
@@ -73,17 +76,29 @@ const modelPreviewStyles = css({
7376
});
7477

7578
const editorContainerStyles = css({
76-
height: 160 + 34 + 16,
7779
display: 'flex',
7880
flexDirection: 'column',
7981
gap: 8,
8082
boxShadow: `0 0 0 2px ${palette.gray.light2}`,
8183
});
8284

83-
const editorContainerApplyButtonStyles = css({
85+
const editorContainerApplyContainerStyles = css({
8486
paddingLeft: 8,
8587
paddingRight: 8,
86-
alignSelf: 'flex-end',
88+
justifyContent: 'flex-end',
89+
gap: spacing[200],
90+
display: 'flex',
91+
width: '100%',
92+
height: spacing[100],
93+
});
94+
95+
const editorContainerPlaceholderButtonStyles = css({
96+
paddingLeft: 8,
97+
paddingRight: 8,
98+
alignSelf: 'flex-start',
99+
display: 'flex',
100+
gap: spacing[200],
101+
paddingTop: spacing[200],
87102
});
88103

89104
const DiagramEditor: React.FunctionComponent<{
@@ -92,18 +107,19 @@ const DiagramEditor: React.FunctionComponent<{
92107
onUndoClick: () => void;
93108
hasRedo: boolean;
94109
onRedoClick: () => void;
95-
model: unknown;
110+
model: StaticModel | null;
111+
editErrors?: string[];
96112
onRetryClick: () => void;
97113
onCancelClick: () => void;
98-
// TODO
99-
onApplyClick: (edit: unknown) => void;
114+
onApplyClick: (edit: Omit<Edit, 'id' | 'timestamp'>) => void;
100115
}> = ({
101116
step,
102117
hasUndo,
103118
onUndoClick,
104119
hasRedo,
105120
onRedoClick,
106121
model,
122+
editErrors,
107123
onRetryClick,
108124
onCancelClick,
109125
onApplyClick,
@@ -118,6 +134,43 @@ const DiagramEditor: React.FunctionComponent<{
118134
}
119135
}, [applyInput]);
120136

137+
const applyPlaceholder =
138+
(type: 'AddRelationship' | 'RemoveRelationship') => () => {
139+
let placeholder = {};
140+
switch (type) {
141+
case 'AddRelationship':
142+
placeholder = {
143+
type: 'AddRelationship',
144+
relationship: {
145+
id: new UUID().toString(),
146+
relationship: [
147+
{
148+
ns: 'db.sourceCollection',
149+
cardinality: 1,
150+
fields: ['field1'],
151+
},
152+
{
153+
ns: 'db.targetCollection',
154+
cardinality: 1,
155+
fields: ['field2'],
156+
},
157+
],
158+
isInferred: false,
159+
},
160+
};
161+
break;
162+
case 'RemoveRelationship':
163+
placeholder = {
164+
type: 'RemoveRelationship',
165+
relationshipId: new UUID().toString(),
166+
};
167+
break;
168+
default:
169+
throw new Error(`Unknown placeholder ${placeholder}`);
170+
}
171+
setApplyInput(JSON.stringify(placeholder, null, 2));
172+
};
173+
121174
const modelStr = useMemo(() => {
122175
return JSON.stringify(model, null, 2);
123176
}, [model]);
@@ -172,6 +225,20 @@ const DiagramEditor: React.FunctionComponent<{
172225
></CodemirrorMultilineEditor>
173226
</div>
174227
<div className={editorContainerStyles} data-testid="apply-editor">
228+
<div className={editorContainerPlaceholderButtonStyles}>
229+
<Button
230+
onClick={applyPlaceholder('AddRelationship')}
231+
data-testid="placeholder-addrelationship-button"
232+
>
233+
Add relationship
234+
</Button>
235+
<Button
236+
onClick={applyPlaceholder('RemoveRelationship')}
237+
data-testid="placeholder-removerelationship-button"
238+
>
239+
Remove relationship
240+
</Button>
241+
</div>
175242
<div>
176243
<CodemirrorMultilineEditor
177244
language="json"
@@ -180,7 +247,8 @@ const DiagramEditor: React.FunctionComponent<{
180247
maxLines={10}
181248
></CodemirrorMultilineEditor>
182249
</div>
183-
<div className={editorContainerApplyButtonStyles}>
250+
<div className={editorContainerApplyContainerStyles}>
251+
{editErrors && <ErrorSummary errors={editErrors} />}
184252
<Button
185253
onClick={() => {
186254
onApplyClick(JSON.parse(applyInput));
@@ -238,6 +306,7 @@ export default connect(
238306
model: diagram
239307
? selectCurrentModel(getCurrentDiagramFromState(state))
240308
: null,
309+
editErrors: diagram?.editErrors,
241310
};
242311
},
243312
{

0 commit comments

Comments
 (0)