You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/03/30 18:20:13 UTC
[GitHub] [superset] betodealmeida commented on a change in pull request #19314: feat: Move Database Import option into DB Connection modal
betodealmeida commented on a change in pull request #19314:
URL: https://github.com/apache/superset/pull/19314#discussion_r838837896
##########
File path: superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
##########
@@ -1252,6 +1430,24 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
/>
{renderPreferredSelector()}
{renderAvailableSelector()}
+ <Upload
+ name="databaseFile"
+ id="databaseFile"
+ data-test="database-file-input"
+ accept=".yaml,.json,.yml,.zip"
+ // upload is handled by hook
+ customRequest={() => {}}
+ onChange={info => onDbImport(info)}
Review comment:
@lyndsiWilliams @hugh's suggestion does that! :)
The best way to think of this IMHO is, when you write:
```js
onChange={info => onDbImport(info)}
```
You're assigning an anonymous function (`info => onDbImport(info)`) to `onChange`. What does that anonymous function do? It takes an `info` and returns the result of calling `onDbImport(info)`. But... isn't that the exact same thing that `onDbImport` does? Regardless of the value of `info`, passing it to the anonymous function returns the same result of pasing it to `onDbImport`, so they're identical.
which means you can replace `info => onDbImport(info)` with `onDbImport`:
```js
onChange={onDbImport}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org