-
-
Notifications
You must be signed in to change notification settings - Fork 278
Conversation
9c24a81
to
0599eb1
Compare
* Added function `setSize(bytes)` to limit the size of the CSV storage. * Converted CSV module to CommonJS, so that all the files that use `const CSV = require('.csv.js')` share the same CSV storage. * Added spec to test `setSize(bytes)`.
* Added setting CSV_STORAGE_SIZE to limit the size of the CSV storage.
115b1db
to
37b4110
Compare
* `connect` accepts and parses data URLs. * Added spec to test connection to a data URL. * Renamed `setSize` to `setStorageSize`. * Removed CSVError.
* Now it's possible to drag files and drop them on the URL box. * Removed packages `data-urls` and `whatwg-encoding`, because they would exhaust memory when parsing data URLs of 20MB. * Improved the generation of a connection label when using data URLs.
37b4110
to
e7dc726
Compare
* Added method Datastores.disconnect(connection) that gets invoked whenever a connection is removed by deleteConnectionById(id). * Implemented disconnect for CSV connector, so that a disconnection removes the CSV file from the storage. * Added spec for disconnect.
e7dc726
to
30f4161
Compare
@shannonlal This PR extends the CSV connector. Now, it's possible to drag files into the URL box. To do so, I've added a new component: Another interesting thing in this PR is that I've extended the Datastores interface. Now, connectors can implement the method Would you like to review this PR when you find the time? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@n-riesco Really good job. Most are my comments are just minor documentation/questions. I think it is good to go. 💃
} | ||
|
||
/** | ||
* Filedrop is an input component where users can type an URL or drop a file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General Comment. I like the style how you have documented the JSDocs and React class structure. I have noticed that there seems to be some inconsistency with the React Classes. Do we have a standard format? I have noticed some classes have PropTypes at the bottom. Is there a standard? Should we document this somewhere? If so where is a good place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have noticed that there seems to be some inconsistency with the React Classes. Do we have a standard format? I have noticed some classes have PropTypes at the bottom. Is there a standard? Should we document this somewhere? If so where is a good place?
We don't have any guidelines. I'd keep them in a file: CODING_GUIDELINES.md
.
I don't want the guidelines to become a burden (it's easier for us to tell contributors to use given files as models; e.g: we could chose one of the files in the project as a model for stateless components, another file for stateful components, and another for components that use redux). Also, by burden, I mean:
- For example, the burden of prescribing that
PropTypes
go at the top is OK, because it's just a copy'n'paste. - But, for example, I don't think the burden of prescribing all React components should be class components is worth it (i.e. it's OK, and some would say better, that stateless components are written as functional components).
|
||
/** | ||
* Filedrop is an input component where users can type an URL or drop a file | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks clean and easy to understand. Do you think this component is worth having a Jest test for or is this overkill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just added the tests
@@ -70,13 +71,24 @@ export function query(queryObject, connection) { | |||
} | |||
|
|||
/* | |||
* connect functions attempt to ping the connection and | |||
* return a promise that is empty | |||
* connect attempts to ping the connection and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this JSDocs format? Should it be @params {object} connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a commit to format it as JSDoc
* connect functions attempt to ping the connection and | ||
* return a promise that is empty | ||
* connect attempts to ping the connection and | ||
* returns a promise that resolves to the connection object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@returns {promise} an empty promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the connector and it's likely to change once Falcon becomes smarter about the connections it creates (at the moment, most of the connectors create a new connection for every request, which is OK if the DB driver implements a pool or the request is stateless).
I'll reword it, so that it only states that the promise resolves once the connection succeeds.
} | ||
|
||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you have two comment blocks for this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first block declares the type CSVConnection
and the second block declares the function connect
. See that CSVConnection
is also used in the declarations of disconnect
, query
, tables
and schemas
.
@shannonlal I've added tests for |
@@ -0,0 +1,135 @@ | |||
jest.unmock('../../../../../app/components/Settings/UserConnections/filedrop.jsx'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good job
@n-riesco Really good job. 💃 . Just curious. Your thoughts about Jest and enzyme as UI testing framework? |
efae52c
to
918d39c
Compare
918d39c
to
f0effc2
Compare
Testing the initial mount is convenient, but:
|
Accept and parse data URLs.
Added component
<Filedrop>
, so that it's possible to drop files into the URL box.Added setting
CSV_STORAGE_SIZE
to limit the size of the CSV storage.Added
Datastores.disconnect(connection)
to be invoked when a connection's tab is closed.Implemented
disconnect
for CSV connectors, so that closing a connection's tab removes the CSV file from storage,Converted CSV module to CommonJS, so that all the files that use
const CSV = require('./csv.js')
share the same CSV storage.Remove bad connection files at startup.
Closes #383