-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]add export Invoices and Contacts to CSV #143
Conversation
@AlphaStyle Great to see you finally opened the PR 👍 I think it's better if you use another file to handle |
So Then two helper functions in Did I understand correctly ? |
If Also, You may even try to refactor this already exist helper |
@hql287 Are the refactoring changes more what you had in mind? Just want some confirmation I am on the right track before I continue 😛 |
app/helpers/pouchDB.js
Outdated
@@ -79,6 +89,67 @@ runMigration( | |||
} | |||
); | |||
|
|||
// Get PouchDB Invoices (Used for Exporting) | |||
const pouchDBInvoices = () => { |
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.
Why don't we use getAllDocs
instead? 🧐
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.
Looks like you need this to return different kind of doc than getAllDocs
?
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.
Once again I didn't do enough testing 😞 I tried to use it in the beginning and saw the end result being different, so I just assumed it would be wrong to use. But now that I can compare getAllDocs('invoices')
and pouchDBInvoices
I see the only difference is that I have to wrap getAllDocs
with an array and that it is missing the _revisions
object wich is not important.
I will use getAllDocs
instead 🙂 And remove the extra pouchDBInvoices
and pouchDBContacts
helpers which will reduce dependencies!
Thank you!
app/helpers/pouchDB.js
Outdated
}; | ||
|
||
// Get PouchDB Contacts (Used for Exporting) | ||
const pouchDBContacts = () => { |
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.
Same as above, why don't we use getAllDocs
instead?
Did you install the new dependencies But this will no longer be an issue because I will use |
@hql287 Could you check whether the new changes work for you? You might notice the column names are a little funny, such as This is where the Import issues occur, because it doesnt parse I will try and use CSV Parser and CSV Stringify instead of csvjson and see if I can get both Export and Import to work. |
Yes, I did.
Checking it now! |
Alright, it's working now, good progress 👍 There're still a couple of issues need to be fixed though:
Btw, here are some thoughts on the user flow, I think we can handle this in 2 ways (assuming we'll name the files). Option 1:
Done. This will take at least 2 clicks every time. Option 2:
I think options 2 is better:
Anyway, I hope I don't sound too demanding 😉 |
@hql287 Not at all, this is exactly the type of guidance and challenges I need. You are teaching me the workflow of a project, how to communicate and share thought and how to make the app user friendly.
Exporting 2 separate files will force the user to select 2 files for import, right? CSV to JSONOriginally I wanted to use the node-csv libraries, but I dont fully understand them 😞 By the time I learn them and modify them to produce the wished result, I could within this time write my own little script that does exactly this and it will give me full flexibility to tweak everything. So it is exactly what I will try to do 🙂 This will reduce dependencies and hopfully this will fix OptionsI, myself prefer Option 1 because it give the user full control where to save and what to save it as. The Electron saveDialog does provide the option for But I agree Option 2 will play along much better with automatically backup. If we place |
Aww, this is very sweet. Thanks! :)
No, once you know where to export the data, just go ahead and export the 2 files // Get the data
const invoicesData = ...
cont contactsData = ...
//Export the data as files
export (invoicesData, exportDir);
export (contactsData, exportDir); |
True, but do they really need to though? I think the content of the file is much more important than its name and the users would only care about these 3 things:
Also, I think you and I as developers both know the burden of naming things well. So by removing this cognitive load, I think our users would have a much better experience while using Manta 😉 |
Any update on this @AlphaStyle? |
@hql287 Sorry I haven't had much chance to work on this lately 😞 JSON to CSVThe JSON to CSV conversion script was harder than I anticipated 😛 You could test my latest push to see whether the column naming is alright or not? Importing
I was referring to Importing 😛 For importing the user would have to select one import for Contacts and an other one for Invoices, right? Lets go for Option 2I have some additional thoughts about option 2. What if we have one export directory in general for all uses? So the user would select one path where to save/export everything and then depending on what we save/export we just put it in it's appropriate sub directory such as UI StylingI'm going to need your help for the styling 😜 |
Closed due to inactivity! |
I need tips on how to improve. Related to Issue 96.
I put the ipc listeners in select-export-directory.js. I should probably make a seperate file or rename the select-export-directory.js file.
Import does not work as of right now.
I made the export / import buttons at settings in general tab without styles.
This PR is not ready for merge!