Skip to content

Commit c483f82

Browse files
committed
merge main
2 parents 975bb26 + e7e965d commit c483f82

File tree

16 files changed

+274
-263
lines changed

16 files changed

+274
-263
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 Aug 05 2025.
2+
This document was automatically generated on Wed Aug 06 2025.
33

44
## List of dependencies
55

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 Tue, Aug 5, 2025
9+
Generated on Wed, Aug 6, 2025
1010

1111
## Table of Contents
1212

packages/compass-components/src/components/accordion.tsx

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import { Description, Icon } from './leafygreen';
99

1010
const buttonStyles = css({
1111
fontWeight: 'bold',
12-
fontSize: '14px',
1312
display: 'flex',
14-
alignItems: 'flex-start',
13+
alignItems: 'center',
1514
paddingLeft: 0,
1615
paddingRight: 0,
1716
border: 'none',
@@ -28,34 +27,60 @@ const buttonStyles = css({
2827
},
2928
});
3029

30+
const buttonVariantStyles = {
31+
default: css({
32+
fontSize: 14,
33+
lineHeight: `${spacing[500]}px`,
34+
}),
35+
small: css({
36+
fontSize: spacing[300],
37+
lineHeight: `${spacing[500]}px`,
38+
}),
39+
};
40+
41+
const iconVariantSizes = {
42+
default: spacing[400],
43+
small: 14,
44+
};
45+
3146
const buttonLightThemeStyles = css({
3247
color: palette.gray.dark2,
3348
});
49+
3450
const buttonDarkThemeStyles = css({
3551
color: palette.white,
3652
});
53+
3754
const buttonIconContainerStyles = css({
38-
padding: spacing[100] / 2, // matches the line-height (16 + 4)
39-
paddingLeft: 0,
55+
fontSize: 0,
56+
lineHeight: 0,
57+
padding: 0,
58+
paddingRight: spacing[150],
4059
});
60+
4161
const buttonTextStyles = css({
4262
textAlign: 'left',
4363
});
64+
4465
const buttonHintStyles = css({
4566
margin: 0,
4667
marginLeft: spacing[100],
4768
padding: 0,
4869
display: 'inline',
4970
});
50-
interface AccordionProps extends React.HTMLProps<HTMLButtonElement> {
71+
72+
interface AccordionProps
73+
extends Omit<React.HTMLProps<HTMLButtonElement>, 'size'> {
5174
text: string | React.ReactNode;
5275
hintText?: string;
5376
textClassName?: string;
5477
buttonTextClassName?: string;
5578
open?: boolean;
5679
defaultOpen?: boolean;
5780
setOpen?: (newValue: boolean) => void;
81+
size?: 'default' | 'small';
5882
}
83+
5984
function Accordion({
6085
text,
6186
hintText,
@@ -64,6 +89,7 @@ function Accordion({
6489
open: _open,
6590
setOpen: _setOpen,
6691
defaultOpen = false,
92+
size = 'default',
6793
...props
6894
}: React.PropsWithChildren<AccordionProps>): React.ReactElement {
6995
const darkMode = useDarkMode();
@@ -87,6 +113,7 @@ function Accordion({
87113
className={cx(
88114
darkMode ? buttonDarkThemeStyles : buttonLightThemeStyles,
89115
buttonStyles,
116+
buttonVariantStyles[size],
90117
textClassName
91118
)}
92119
id={labelId}
@@ -96,7 +123,10 @@ function Accordion({
96123
onClick={onOpenChange}
97124
>
98125
<span className={buttonIconContainerStyles}>
99-
<Icon glyph={open ? 'ChevronDown' : 'ChevronRight'} />
126+
<Icon
127+
glyph={open ? 'ChevronDown' : 'ChevronRight'}
128+
size={iconVariantSizes[size]}
129+
/>
100130
</span>
101131

102132
<div className={cx(buttonTextStyles, buttonTextClassName)}>

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { connect } from 'react-redux';
33
import type { DataModelingState } from '../store/reducer';
44
import {
55
moveCollection,
6-
getCurrentDiagramFromState,
7-
selectCurrentModel,
86
selectCollection,
97
selectRelationship,
108
selectBackground,
119
type DiagramState,
10+
selectCurrentModelFromState,
1211
} from '../store/diagram';
1312
import {
1413
Banner,
@@ -202,9 +201,7 @@ const ConnectedDiagramContent = connect(
202201
(state: DataModelingState) => {
203202
const { diagram } = state;
204203
return {
205-
model: diagram
206-
? selectCurrentModel(getCurrentDiagramFromState(state).edits)
207-
: null,
204+
model: diagram ? selectCurrentModelFromState(state) : null,
208205
diagramLabel: diagram?.name || 'Schema Preview',
209206
selectedItems: state.diagram?.selectedItems ?? null,
210207
};

packages/compass-data-modeling/src/components/drawer/collection-drawer-content.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ import {
1616
import {
1717
createNewRelationship,
1818
deleteRelationship,
19-
getCurrentDiagramFromState,
20-
selectCurrentModel,
19+
selectCurrentModelFromState,
2120
selectRelationship,
2221
renameCollection,
2322
} from '../../store/diagram';
2423
import type { DataModelingState } from '../../store/reducer';
25-
import { getRelationshipName } from '../../utils';
24+
import { getDefaultRelationshipName } from '../../utils';
2625
import DMDrawerSection from './dm-drawer-section';
2726

2827
type CollectionDrawerContentProps = {
@@ -42,6 +41,7 @@ const formFieldContainerStyles = css({
4241

4342
const titleBtnStyles = css({
4443
marginLeft: 'auto',
44+
maxHeight: 20, // To match accordion line height
4545
});
4646

4747
const emptyRelationshipMessageStyles = css({
@@ -146,7 +146,7 @@ const CollectionDrawerContent: React.FunctionComponent<
146146

147147
return (
148148
<>
149-
<DMDrawerSection label="COLLECTION">
149+
<DMDrawerSection label="Collection properties">
150150
<FormFieldContainer className={formFieldContainerStyles}>
151151
<TextInput
152152
label="Name"
@@ -165,7 +165,7 @@ const CollectionDrawerContent: React.FunctionComponent<
165165
<DMDrawerSection
166166
label={
167167
<>
168-
RELATIONSHIPS&nbsp;
168+
Relationships&nbsp;
169169
<Badge>{relationships.length}</Badge>
170170
<Button
171171
className={titleBtnStyles}
@@ -194,7 +194,7 @@ const CollectionDrawerContent: React.FunctionComponent<
194194
className={relationshipItemStyles}
195195
>
196196
<span className={relationshipNameStyles}>
197-
{getRelationshipName(r)}
197+
{getDefaultRelationshipName(r.relationship)}
198198
</span>
199199
<IconButton
200200
aria-label="Edit relationship"
@@ -227,7 +227,7 @@ const CollectionDrawerContent: React.FunctionComponent<
227227

228228
export default connect(
229229
(state: DataModelingState, ownProps: { namespace: string }) => {
230-
const model = selectCurrentModel(getCurrentDiagramFromState(state).edits);
230+
const model = selectCurrentModelFromState(state);
231231
return {
232232
relationships: model.relationships.filter((r) => {
233233
const [local, foreign] = r.relationship;

packages/compass-data-modeling/src/components/drawer/diagram-editor-side-panel.spec.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import {
1010
import { DataModelingWorkspaceTab } from '../../index';
1111
import DiagramEditorSidePanel from './diagram-editor-side-panel';
1212
import {
13-
getCurrentDiagramFromState,
1413
openDiagram,
1514
selectCollection,
16-
selectCurrentModel,
15+
selectCurrentModelFromState,
1716
selectRelationship,
1817
} from '../../store/diagram';
1918
import dataModel from '../../../test/fixtures/data-model-with-relationships.json';
@@ -88,9 +87,8 @@ describe('DiagramEditorSidePanel', function () {
8887
);
8988

9089
await waitFor(() => {
91-
const name = screen.getByLabelText('Name');
92-
expect(name).to.be.visible;
93-
expect(name).to.have.value('Airport Country');
90+
const section = screen.getByText('Relationship properties');
91+
expect(section).to.be.visible;
9492
});
9593

9694
const localCollectionInput = screen.getByLabelText('Local collection');
@@ -173,7 +171,9 @@ describe('DiagramEditorSidePanel', function () {
173171
});
174172

175173
// Open relationshipt editing form
176-
const relationshipItem = screen.getByText('Airport Country').closest('li');
174+
const relationshipItem = screen
175+
.getByText('countries.name → airports.Country')
176+
.closest('li');
177177
expect(relationshipItem).to.be.visible;
178178
userEvent.click(
179179
within(relationshipItem!).getByRole('button', {
@@ -191,8 +191,8 @@ describe('DiagramEditorSidePanel', function () {
191191
// We should be testing through rendered UI but as it's really hard to make
192192
// diagram rendering in tests property, we are just validating the final
193193
// model here
194-
const modifiedRelationship = selectCurrentModel(
195-
getCurrentDiagramFromState(result.plugin.store.getState()).edits
194+
const modifiedRelationship = selectCurrentModelFromState(
195+
result.plugin.store.getState()
196196
).relationships.find((r: Relationship) => {
197197
return r.id === '204b1fc0-601f-4d62-bba3-38fade71e049';
198198
});
@@ -222,7 +222,9 @@ describe('DiagramEditorSidePanel', function () {
222222
});
223223

224224
// Find the relationhip item
225-
const relationshipItem = screen.getByText('Airport Country').closest('li');
225+
const relationshipItem = screen
226+
.getByText('countries.name → airports.Country')
227+
.closest('li');
226228
expect(relationshipItem).to.be.visible;
227229

228230
// Delete relationship

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import type { DataModelingState } from '../../store/reducer';
44
import { DrawerSection } from '@mongodb-js/compass-components';
55
import CollectionDrawerContent from './collection-drawer-content';
66
import RelationshipDrawerContent from './relationship-drawer-content';
7-
import { closeDrawer } from '../../store/diagram';
8-
97
export const DATA_MODELING_DRAWER_ID = 'data-modeling-drawer';
108

119
type DiagramEditorSidePanelProps = {
1210
selectedItems: { type: 'relationship' | 'collection'; id: string } | null;
13-
onClose: () => void;
1411
};
1512

1613
function DiagramEditorSidePanel({
@@ -55,13 +52,8 @@ function DiagramEditorSidePanel({
5552
);
5653
}
5754

58-
export default connect(
59-
(state: DataModelingState) => {
60-
return {
61-
selectedItems: state.diagram?.selectedItems ?? null,
62-
};
63-
},
64-
{
65-
onClose: closeDrawer,
66-
}
67-
)(DiagramEditorSidePanel);
55+
export default connect((state: DataModelingState) => {
56+
return {
57+
selectedItems: state.diagram?.selectedItems ?? null,
58+
};
59+
})(DiagramEditorSidePanel);

packages/compass-data-modeling/src/components/drawer/dm-drawer-section.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ const darkModeContainerStyles = css({
2323
});
2424

2525
const accordionTitleStyles = css({
26-
fontSize: spacing[300],
2726
width: '100%',
27+
textTransform: 'uppercase',
2828
});
2929

3030
const buttonStyles = css({
3131
width: '100%',
3232
display: 'flex',
33+
alignItems: 'center',
3334
});
3435

3536
const DMDrawerSection: React.FC<{
@@ -43,6 +44,7 @@ const DMDrawerSection: React.FC<{
4344
defaultOpen={true}
4445
textClassName={accordionTitleStyles}
4546
buttonTextClassName={buttonStyles}
47+
size="small"
4648
>
4749
{children}
4850
</Accordion>

0 commit comments

Comments
 (0)