Skip to content

Commit a79d13c

Browse files
authored
chore(compass-import-export): update styles, file error message, checkbox and radio-box-group deps (#4356)
1 parent f4e333b commit a79d13c

28 files changed

+328
-201
lines changed

package-lock.json

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

packages/compass-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@leafygreen-ui/banner": "^7.0.1",
3939
"@leafygreen-ui/button": "^19.0.3",
4040
"@leafygreen-ui/card": "^9.0.2",
41-
"@leafygreen-ui/checkbox": "^12.0.2",
41+
"@leafygreen-ui/checkbox": "^12.0.8",
4242
"@leafygreen-ui/code": "^14.1.0",
4343
"@leafygreen-ui/confirmation-modal": "^4.0.1",
4444
"@leafygreen-ui/emotion": "^4.0.3",
@@ -57,7 +57,7 @@
5757
"@leafygreen-ui/pipeline": "^5.0.1",
5858
"@leafygreen-ui/popover": "^11.0.1",
5959
"@leafygreen-ui/portal": "^4.0.7",
60-
"@leafygreen-ui/radio-box-group": "^12.0.1",
60+
"@leafygreen-ui/radio-box-group": "^12.0.5",
6161
"@leafygreen-ui/radio-group": "^10.1.1",
6262
"@leafygreen-ui/segmented-control": "^7.0.0",
6363
"@leafygreen-ui/select": "^10.1.0",

packages/compass-components/src/components/file-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const containerStyles = css({
2525

2626
const formItemSmallStyles = css({
2727
display: 'flex',
28-
flexFirection: 'row',
2928
alignItems: 'center',
3029
gap: spacing[1],
3130
});
@@ -48,6 +47,7 @@ const buttonSmallStyles = css({
4847
border: 'none',
4948
background: 'none',
5049
fontWeight: 'normal',
50+
marginLeft: spacing[2],
5151

5252
'&:hover': {
5353
background: 'none',

packages/compass-crud/src/components/insert-document-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ class InsertDocumentDialog extends React.PureComponent<
278278
return (
279279
<FormModal
280280
title="Insert Document"
281-
subtitle={`To Collection ${this.props.ns}`}
281+
subtitle={`To collection ${this.props.ns}`}
282282
className="insert-document-dialog"
283283
open={this.props.isOpen}
284284
onSubmit={this.handleInsert.bind(this)}

packages/compass-e2e-tests/tests/collection-export.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('Collection export', function () {
9696
expect(await exportModalQueryTextElement.getText()).to
9797
.equal(`db.getCollection('numbers').find(
9898
{i: 5},
99-
{i: true,j: true,_id: false}
99+
{i: 1,j: 1,_id: 0}
100100
)`);
101101

102102
// Select CSV.
@@ -362,7 +362,7 @@ describe('Collection export', function () {
362362
expect(await exportModalQueryTextElement.getText()).to
363363
.equal(`db.getCollection('numbers').find(
364364
{i: 5},
365-
{i: true,j: true,_id: false}
365+
{i: 1,j: 1,_id: 0}
366366
)`);
367367

368368
// Leave the file type on the default (JSON).
@@ -905,7 +905,7 @@ describe('Collection export', function () {
905905
expect(await exportModalQueryTextElement.getText()).to
906906
.equal(`db.getCollection('numbers-strings').find(
907907
{},
908-
{iString: true,j: true,_id: false}
908+
{iString: 1,j: 1,_id: 0}
909909
).collation(
910910
{locale: 'en_US',numericOrdering: true}
911911
).sort({iString: -1}).limit(2).skip(2)`);
@@ -996,7 +996,7 @@ describe('Collection export', function () {
996996
expect(await exportModalQueryTextElement.getText()).to
997997
.equal(`db.getCollection('numbers-strings').find(
998998
{},
999-
{iString: true,j: true,_id: false}
999+
{iString: 1,j: 1,_id: 0}
10001000
).collation(
10011001
{locale: 'en_US',numericOrdering: true}
10021002
).sort({iString: -1}).limit(2).skip(2)`);

packages/compass-import-export/src/components/export-code-view.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ describe('ExportCodeView [Component]', function () {
6767
const codeText = screen.getByTestId(
6868
'export-collection-code-preview-wrapper'
6969
).textContent;
70-
expect(codeText).to.include('name: true');
71-
expect(codeText).to.not.include('test: true');
70+
expect(codeText).to.include('name: 1');
71+
expect(codeText).to.not.include('test: 1');
7272
});
7373
});
7474
});

packages/compass-import-export/src/components/export-json-format-options.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React from 'react';
1+
import React, { useEffect, useRef } from 'react';
22
import {
33
Accordion,
4+
Banner,
45
Link,
56
Radio,
67
RadioGroup,
@@ -9,13 +10,12 @@ import {
910
} from '@mongodb-js/compass-components';
1011

1112
import type { ExportJSONFormat } from '../export/export-json';
12-
import { Banner } from '@mongodb-js/compass-components';
1313

1414
const radioGroupStyles = css({
1515
margin: `${spacing[3]}px 0`,
1616
});
1717

18-
const bannerStyles = css({
18+
const bannerContainerStyles = css({
1919
margin: `${spacing[2]}px 0`,
2020
});
2121

@@ -26,6 +26,14 @@ function JSONFileTypeOptions({
2626
jsonFormat: ExportJSONFormat;
2727
setJSONFormatVariant: (jsonFormatVariant: ExportJSONFormat) => void;
2828
}) {
29+
const relaxedWarningBannerContainerRef = useRef<HTMLDivElement | null>(null);
30+
useEffect(() => {
31+
// When the user selects relaxed we scroll to show the warning at the bottom.
32+
if (jsonFormat === 'relaxed') {
33+
relaxedWarningBannerContainerRef.current?.scrollIntoView();
34+
}
35+
}, [jsonFormat]);
36+
2937
return (
3038
<Accordion
3139
text="Advanced JSON Format"
@@ -68,12 +76,17 @@ function JSONFileTypeOptions({
6876
>
6977
Learn more about JSON format
7078
</Link>
71-
{jsonFormat === 'relaxed' && (
72-
<Banner className={bannerStyles} variant="warning">
73-
Large numbers (&gt;= 2^^53) will lose precision with the relaxed EJSON
74-
format. This format is not recommended for data integrity.
75-
</Banner>
76-
)}
79+
<div
80+
className={bannerContainerStyles}
81+
ref={relaxedWarningBannerContainerRef}
82+
>
83+
{jsonFormat === 'relaxed' && (
84+
<Banner variant="warning">
85+
Large numbers (&gt;= 2^^53) will lose precision with the relaxed
86+
EJSON format. This format is not recommended for data integrity.
87+
</Banner>
88+
)}
89+
</div>
7790
</Accordion>
7891
);
7992
}

0 commit comments

Comments
 (0)