Skip to content
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

feature: download output via csv or json #5

Open
jofftiquez opened this issue Jul 10, 2023 · 9 comments · Fixed by #8
Open

feature: download output via csv or json #5

jofftiquez opened this issue Jul 10, 2023 · 9 comments · Fixed by #8

Comments

@jofftiquez
Copy link
Owner

jofftiquez commented Jul 10, 2023

Add a feature to download the output as CSV or JSON. There are two considerations here, the first is the web app version and the second is the browser extension.

For the browser extension, I would like for this to be a button with dropdown on the right side to show the options "Download CSV", and "Download JSON".

image
image

In the browser extension, since there's an issue in showing the dialog the bulk action is not available yet, therefore there's no place for the button put in. I also need ideas/feedback for this.

The initial idea is when the list is clicked that's the normal action just copy the output to the clipboard. Then, add a menu on the right side of the list item to show a dropdown list with options to "Download CSV", and "Download JSON".

image

@JayeshVP24
Copy link
Contributor

Hey @jofftiquez ,
I'd like to try and build this feature.
There's no description, but I think that this download as csv or json option is supposed to be at generate bulk section. Am I correct?
Kindly let me know if I can work on it. Thank you!

@jofftiquez
Copy link
Owner Author

Hello @JayeshVP24 yes, that is correct. There should be an extra button to explicitly download the output as CSV or JSON. I will update the description. Thank you!

@JayeshVP24
Copy link
Contributor

JayeshVP24 commented Aug 8, 2023

Hello @JayeshVP24 yes, that is correct. There should be an extra button to explicitly download the output as CSV or JSON. I will update the description. Thank you!

Right, thanks.
I've almost implemented it.
One doubt I have is will the beast mode/ bulk generator will always return an array of string or is there an instance where it may create array of arrays?
If its just an array of strings, I'll create a rather simpler array-to-csv generator, if not then an expensive generator can be written.
As far as I've seen, its all just array of strings, no nested arrays exist. If you have any plans to create something in relation to nested arrays, LMK.

@jofftiquez
Copy link
Owner Author

@JayeshVP24 I see, I can't really tell for sure if there's such a case I haven't tested all of them really 😅 However you can maybe use lodash to flatten the input just in case there's such an output. But yeah we'll see.

@jofftiquez
Copy link
Owner Author

You know what, there's actually a nested array. The "Datatype - Array" @JayeshVP24

image

@JayeshVP24
Copy link
Contributor

@jofftiquez
Alright, I think I have handled all edge cases. Only Bulk JSON exported to CSV gives plain JSON in each line.
Have a glance at it.
BulkJSON-to-CSV.csv

@JayeshVP24
Copy link
Contributor

In Browser, u suggested for a Download JSON/CSV for a single datapoint?
idt that makes much sense.

In extensions, Dialogs/Modals are usually a new page itself

JayeshVP24 added a commit to JayeshVP24/faker-js-ui that referenced this issue Aug 8, 2023
@jofftiquez
Copy link
Owner Author

In Browser, u suggested for a Download JSON/CSV for a single datapoint?

I mean OR, 1 for each data type. Thanks

@JayeshVP24
Copy link
Contributor

In Browser, u suggested for a Download JSON/CSV for a single datapoint?

I mean OR, 1 for each data type. Thanks

I have made the PR, please LMK if any changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants