Comments (6)
That's a clever idea. react-admin already use Confirm
modal to check for validation (like deletion). We should investigate on this to reuse their component.
Also, your idea gave some idea about new properties: overwrite
and confirm
. The confirm is a boolean to indicate if the modal should be opened. If confirm=false
and overwrite
is set, we should bypass the modal process to automatically execute the update/create.
That could be really good. The last thing that we should handle is when a user wants to import both new and updated data... Not sure how we can do that, because we cannot predict what user will put in the csv file.
from react-admin-import-csv.
Hey @Odonno,
I just want to first say thank you for sharing your code initially, it's been a big help in understanding react
, redux
and react-admin
.
I suppose that all console.log should be forbidden, right?
Yes, or at least a configuration flag.
I used to dispatch an action crudUpdateMany in order to save that in the redux store and then it will trigger an UPDATE_MANY event to the according data provider. You, otherwise, you use directly the data provider for each item. I am not sure what is the best use of this ATM. Otherwise, I can see there is 2 kind of operations:
I'm not 100% sure, but according to the API, the UPDATE_MANY
action updates a lot of ids with one row of common data. We need to update many ids with unique rows of data, so this probably isn't going to work. I may be mistaken though...
It can be a little tricky but I believe we should allow the developer to choose the action to execute in those cases, don't you think? Like adding a new prop.
Also, we manage papaparse props ourselves. That could be interesting to set default props and then let the developers override the props based on their own needs. Maybe by reusing the same standard of react-admin. They use an exporter prop, we could have an importer prop.
I like both of these ideas.
Cheers,
Ben
from react-admin-import-csv.
Hum, you are right, it seems that UPDATE_MANY
is to update multiple objects using the same payload/properties. So, multiple UPDATE
may be more suitable.
I also see you use hooks instead of the crudUpdate
dispatched action. Seems to be a better way than I did. So, the last thing is to know to identify whether to create or to update. Not sure how to do that.
from react-admin-import-csv.
I also see you use hooks instead of the crudUpdate dispatched action. Seems to be a better way than I did.
This was a huge learning process for me, I tried using effects and dispatches by kept getting "the invalid hook call warning". So after a lot of trial and error, this was the only thing that react allowed me to do.
... the last thing is to know to identify whether to create or to update. Not sure how to do that.
Maybe we could launch a Material-ui Dialog and ask the question to the user? (I think material-ui is included in react-admin anyway) Something like the following perhaps?
from react-admin-import-csv.
I suppose we can start like that with overwrite
and confirm
props. If someone has an idea in the future for improvements, we will check at that time.
What do you think?
from react-admin-import-csv.
Hey @Odonno,
I've made some recent updates and included a demo here. Let me know what you think.
If you'd like to add some additional features or fix something, please have a look at the development
notes at the bottom of the README, and submit a PR.
Cheers for your help,
Ben
from react-admin-import-csv.
Related Issues (20)
- Latest version is not available on npm/yarn HOT 2
- array of one element HOT 4
- Question: Add additional field to CSV records before posting HOT 2
- Unable to add Filters when using the Import button HOT 1
- Compile error with TS 3.9.9
- Dist package does not contain TypeScript definitions
- Issue with the resource post count when importing records HOT 2
- Import functionality with row by row is updating wrong record HOT 2
- Inject record data into transformRows callback
- Unsupported fetch action type createMany HOT 8
- Access existing data in transformRows or another callback?
- Is there a way to change the default tooltip? HOT 2
- The response to 'getMany' must be like { data : [...] } HOT 3
- change encoding HOT 1
- [QUESTION] How to send a field with an array of ids HOT 2
- Not working with app cache
- Error on GetIdsColliding when importing new rows HOT 7
- CSV with empty column Error Handling HOT 3
- react-admin: 4.x material 5.x react 17 release HOT 1
- Colliding ids for disableGetMany option HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-admin-import-csv.