Skip to content

Commit 7fac122

Browse files
committed
move connection-form-modal, rename connection-form-modal-actions
1 parent 117c32f commit 7fac122

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

packages/connection-form/src/components/connection-form-modal.tsx renamed to packages/compass-connections/src/components/connection-form-modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { css, cx, Modal, spacing } from '@mongodb-js/compass-components';
22
import React, { useState } from 'react';
33
import type { Dispatch, SetStateAction } from 'react';
4-
import type { ConnectionFormProps } from './connection-form';
5-
import ConnectionForm from './connection-form';
4+
import type { ConnectionFormProps } from '@mongodb-js/connection-form';
5+
import ConnectionForm from '@mongodb-js/connection-form';
66

77
const modalStyles = css({
88
'& > div': {

packages/compass-connections/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from './stores/store-context';
2020
export { default as SingleConnectionForm } from './components/legacy-connections';
2121
export { LegacyConnectionsModal } from './components/legacy-connections-modal';
22+
export { default as ConnectionFormModal } from './components/connection-form-modal';
2223
export { useConnectionFormPreferences } from './hooks/use-connection-form-preferences';
2324
import type { connect as devtoolsConnect } from 'mongodb-data-service';
2425
import type { ExtraConnectionData as ExtraConnectionDataForTelemetry } from '@mongodb-js/compass-telemetry';

packages/compass-sidebar/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"@mongodb-js/compass-maybe-protect-connection-string": "^0.28.0",
5858
"@mongodb-js/compass-telemetry": "^1.2.3",
5959
"@mongodb-js/compass-workspaces": "^0.28.0",
60-
"@mongodb-js/connection-form": "^1.44.0",
6160
"@mongodb-js/connection-info": "^0.9.3",
6261
"compass-preferences-model": "^2.30.0",
6362
"hadron-app-registry": "^9.2.7",

packages/compass-sidebar/src/components/multiple-connections/sidebar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
useConnections,
66
useConnectionsWithStatus,
77
} from '@mongodb-js/compass-connections/provider';
8-
import { useConnectionFormPreferences } from '@mongodb-js/compass-connections';
8+
import {
9+
useConnectionFormPreferences,
10+
ConnectionFormModal,
11+
} from '@mongodb-js/compass-connections';
912
import { type ConnectionInfo } from '@mongodb-js/connection-info';
1013
import {
1114
ResizableSidebar,
@@ -15,7 +18,6 @@ import {
1518
HorizontalRule,
1619
} from '@mongodb-js/compass-components';
1720
import { SidebarHeader } from './header/sidebar-header';
18-
import { ConnectionFormModal } from '@mongodb-js/connection-form';
1921
import { type RootState, type SidebarThunkAction } from '../../modules';
2022
import { Navigation } from './navigation/navigation';
2123
import ConnectionInfoModal from '../connection-info-modal';

packages/connection-form/src/components/connection-form-modal-actions.spec.tsx renamed to packages/connection-form/src/components/connection-form-actions.spec.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ import { render, screen, userEvent } from '@mongodb-js/testing-library-compass';
33
import { expect } from 'chai';
44
import sinon from 'sinon';
55

6-
import { ConnectionFormModalActions } from './connection-form-modal-actions';
6+
import { ConnectionFormActions } from './connection-form-actions';
77

8-
describe('<ConnectionFormModalActions />', function () {
8+
describe('<ConnectionFormActions />', function () {
99
it('should show warnings', function () {
1010
render(
11-
<ConnectionFormModalActions
11+
<ConnectionFormActions
1212
errors={[]}
1313
warnings={[{ message: 'Warning!' }]}
1414
onSave={() => undefined}
1515
onSaveAndConnect={() => undefined}
16-
></ConnectionFormModalActions>
16+
></ConnectionFormActions>
1717
);
1818
expect(screen.getByText('Warning!')).to.be.visible;
1919
});
2020

2121
it('should show errors', function () {
2222
render(
23-
<ConnectionFormModalActions
23+
<ConnectionFormActions
2424
errors={[{ message: 'Error!' }]}
2525
warnings={[]}
2626
onSave={() => undefined}
2727
onSaveAndConnect={() => undefined}
28-
></ConnectionFormModalActions>
28+
></ConnectionFormActions>
2929
);
3030
expect(screen.getByText('Error!')).to.be.visible;
3131
});
@@ -34,12 +34,12 @@ describe('<ConnectionFormModalActions />', function () {
3434
it('should call onSaveAndConnect function', function () {
3535
const onSaveAndConnectSpy = sinon.spy();
3636
render(
37-
<ConnectionFormModalActions
37+
<ConnectionFormActions
3838
errors={[]}
3939
warnings={[]}
4040
onSave={() => undefined}
4141
onSaveAndConnect={onSaveAndConnectSpy}
42-
></ConnectionFormModalActions>
42+
></ConnectionFormActions>
4343
);
4444
const connectButton = screen.getByRole('button', {
4545
name: 'Save & Connect',
@@ -51,10 +51,10 @@ describe('<ConnectionFormModalActions />', function () {
5151

5252
it('should hide "connect" button if there is no callback', function () {
5353
render(
54-
<ConnectionFormModalActions
54+
<ConnectionFormActions
5555
errors={[]}
5656
warnings={[]}
57-
></ConnectionFormModalActions>
57+
></ConnectionFormActions>
5858
);
5959
expect(screen.queryByRole('button', { name: 'Save & Connect' })).to.not
6060
.exist;
@@ -65,12 +65,12 @@ describe('<ConnectionFormModalActions />', function () {
6565
it('should call onSave function', function () {
6666
const onSaveSpy = sinon.spy();
6767
render(
68-
<ConnectionFormModalActions
68+
<ConnectionFormActions
6969
errors={[]}
7070
warnings={[]}
7171
onSave={onSaveSpy}
7272
onSaveAndConnect={() => undefined}
73-
></ConnectionFormModalActions>
73+
></ConnectionFormActions>
7474
);
7575
const saveButton = screen.getByRole('button', { name: 'Save' });
7676
userEvent.click(saveButton);
@@ -79,11 +79,11 @@ describe('<ConnectionFormModalActions />', function () {
7979

8080
it('should hide "save" button if there is no callback', function () {
8181
render(
82-
<ConnectionFormModalActions
82+
<ConnectionFormActions
8383
errors={[]}
8484
warnings={[]}
8585
onSaveAndConnect={() => undefined}
86-
></ConnectionFormModalActions>
86+
></ConnectionFormActions>
8787
);
8888
expect(screen.queryByRole('button', { name: 'Save' })).to.not.exist;
8989
});
@@ -93,13 +93,13 @@ describe('<ConnectionFormModalActions />', function () {
9393
it('should call onCancel function', function () {
9494
const onCancelSpy = sinon.spy();
9595
render(
96-
<ConnectionFormModalActions
96+
<ConnectionFormActions
9797
errors={[]}
9898
warnings={[]}
9999
onSave={() => undefined}
100100
onSaveAndConnect={() => undefined}
101101
onCancel={onCancelSpy}
102-
></ConnectionFormModalActions>
102+
></ConnectionFormActions>
103103
);
104104
const cancelButton = screen.getByRole('button', { name: 'Cancel' });
105105
userEvent.click(cancelButton);
@@ -109,12 +109,12 @@ describe('<ConnectionFormModalActions />', function () {
109109

110110
it('should hide onCancel button if there is no callback', function () {
111111
render(
112-
<ConnectionFormModalActions
112+
<ConnectionFormActions
113113
errors={[]}
114114
warnings={[]}
115115
onSave={() => undefined}
116116
onSaveAndConnect={() => undefined}
117-
></ConnectionFormModalActions>
117+
></ConnectionFormActions>
118118
);
119119
expect(screen.queryByRole('button', { name: 'Cancel' })).to.not.exist;
120120
});

packages/connection-form/src/components/connection-form-modal-actions.tsx renamed to packages/connection-form/src/components/connection-form-actions.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const saveAndConnectStyles = css({
3838
justifyContent: 'flex-end',
3939
});
4040

41-
export type ConnectionFormModalActionsProps = {
41+
export type ConnectionFormActionsProps = {
4242
errors: ConnectionFormError[];
4343
warnings: ConnectionFormWarning[];
4444

@@ -48,14 +48,14 @@ export type ConnectionFormModalActionsProps = {
4848
onConnect?(): void;
4949
};
5050

51-
export function ConnectionFormModalActions({
51+
export function ConnectionFormActions({
5252
errors,
5353
warnings,
5454
onCancel,
5555
onSave,
5656
onSaveAndConnect,
5757
onConnect,
58-
}: ConnectionFormModalActionsProps): React.ReactElement {
58+
}: ConnectionFormActionsProps): React.ReactElement {
5959
const saveAndConnectLabel = useConnectionFormSetting('saveAndConnectLabel');
6060
return (
6161
<div className={cx(formActionStyles)}>

packages/connection-form/src/components/connection-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
import { cloneDeep } from 'lodash';
2626
import ConnectionStringInput from './connection-string-input';
2727
import AdvancedConnectionOptions from './advanced-connection-options';
28-
import { ConnectionFormModalActions } from './connection-form-modal-actions';
28+
import { ConnectionFormActions } from './connection-form-actions';
2929
import {
3030
useConnectForm,
3131
type ConnectionPersonalizationOptions,
@@ -622,7 +622,7 @@ function ConnectionForm({
622622
: formFooterBorderLightModeStyles
623623
)}
624624
>
625-
<ConnectionFormModalActions
625+
<ConnectionFormActions
626626
errors={connectionStringInvalidError ? [] : errors}
627627
warnings={connectionStringInvalidError ? [] : warnings}
628628
onCancel={onCancel}

packages/connection-form/src/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import ConnectionForm, { ColorCircleGlyph } from './components/connection-form';
2-
import ConnectionFormModal from './components/connection-form-modal';
2+
import type { ConnectionFormProps } from './components/connection-form';
33
import { adjustConnectionOptionsBeforeConnect } from './hooks/use-connect-form';
44

5-
export {
6-
adjustConnectionOptionsBeforeConnect,
7-
ConnectionFormModal,
8-
ColorCircleGlyph,
9-
};
5+
export { adjustConnectionOptionsBeforeConnect, ColorCircleGlyph };
6+
7+
export type { ConnectionFormProps };
108

119
export {
1210
useConnectionColor,

0 commit comments

Comments
 (0)