Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/components/connect.less
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ label {

.connecting-background-gradient {
opacity: 0.9;
animation: opacityFadeIn 0.2s ease-out;
}
}

Expand All @@ -659,14 +658,23 @@ label {
}

100% {
opacity: 0.9;
opacity: 1;
}
}

.connecting-modal-container {
opacity: 1;
animation: opacityFadeIn 100ms ease-out;
}

.connecting-modal-content {
text-align: center;
padding: 24px;

.connecting-modal-illustration {
max-height: 40vh;
}

.connecting-modal-status {
margin-top: 24px;
font-weight: bold;
Expand Down
8 changes: 7 additions & 1 deletion src/components/modal/connecting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class Connecting extends React.Component {
<React.Fragment>
{!!this.props.currentConnectionAttempt && this.renderConnectingBackground()}
<Modal
animation={false}
containerClassName={styles['connecting-modal-container']}
show={!!this.props.currentConnectionAttempt}
backdropClassName={styles['connecting-modal-backdrop']}
>
Expand All @@ -97,7 +99,11 @@ class Connecting extends React.Component {
className={styles['connecting-modal-content']}
id="connectingStatusText"
>
<img src={Illustration} alt="Compass connecting illustration" />
<img
className={styles['connecting-modal-illustration']}
src={Illustration}
alt="Compass connecting illustration"
/>
<h2
className={styles['connecting-modal-status']}
>
Expand Down
7 changes: 2 additions & 5 deletions src/modules/connection-attempt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promisify } from 'util';
import createDebug from 'debug';
import { promisify } from 'util';

const debug = createDebug('mongodb-compass:compass-connect:connection-attempt');

Expand Down Expand Up @@ -34,10 +34,7 @@ class ConnectionAttempt {
}

try {
const runConnect = promisify(
this._dataService.connect.bind(this._dataService)
);
await runConnect();
await this._dataService.connect();
return this._dataService;
} catch (err) {
if (isConnectionAttemptTerminatedError(err)) {
Expand Down
10 changes: 7 additions & 3 deletions src/modules/connection-attempt.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ describe('connection-attempt', () => {
describe('connect', () => {
it('returns the connected data service', async() => {
const dataService = {
connect: (callback) => setTimeout(() => callback(), 25)
connect: () => {
return new Promise(resolve => setTimeout(() => resolve(), 25));
}
};

const connectionAttempt = createConnectionAttempt();
Expand Down Expand Up @@ -39,8 +41,10 @@ describe('connection-attempt', () => {
it('throws if connecting throws', async() => {
let rejectOnConnect;
const dataService = {
connect: (callback) => {
rejectOnConnect = callback;
connect: () => {
return new Promise((_, reject) => {
rejectOnConnect = reject;
});
}
};

Expand Down
14 changes: 5 additions & 9 deletions src/stores/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const SSH_TUNNEL_FIELDS = [
*/
const EXTENSION = 'Connect.Extension';

const LOADING_CONNECTION_TEXT = 'Loading connecting';
const LOADING_CONNECTION_TEXT = 'Loading connection';

/**
* The store that backs the connect plugin.
Expand Down Expand Up @@ -204,8 +204,7 @@ const Store = Reflux.createStore({
}

try {
const buildConnectionModelFromUrl = promisify(Connection.from);
await buildConnectionModelFromUrl(customUrl);
await Connection.from(customUrl);

this._resetSyntaxErrorMessage();
} catch (error) {
Expand Down Expand Up @@ -1047,8 +1046,7 @@ const Store = Reflux.createStore({

let parsedConnection;
try {
const buildConnectionModelFromUrl = promisify(Connection.from);
parsedConnection = await buildConnectionModelFromUrl(url);
parsedConnection = await Connection.from(url);
} catch (error) {
this._setSyntaxErrorMessage(error.message);

Expand Down Expand Up @@ -1134,8 +1132,7 @@ const Store = Reflux.createStore({
this.StatusActions.showIndeterminateProgressBar();

try {
const buildConnectionModelFromUrl = promisify(Connection.from);
const parsedConnection = await buildConnectionModelFromUrl(url);
const parsedConnection = await Connection.from(url);

this.StatusActions.done();

Expand Down Expand Up @@ -1208,8 +1205,7 @@ const Store = Reflux.createStore({

if (this.state.viewType === CONNECTION_STRING_VIEW) {
try {
const buildConnectionModelFromUrl = promisify(Connection.from);
const parsedConnection = await buildConnectionModelFromUrl(url);
const parsedConnection = await Connection.from(url);

connectionModel.set(this._getPoorAttributes(parsedConnection));

Expand Down