-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
✨ generate csv and zip file server side #3613
Conversation
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 0 ✅ Edited: 2024-07-31 07:59:25 UTC |
This PR has had no activity within the last two weeks. It is considered stale and will be closed in 3 days if no further activity is detected. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
1f9008e
to
4549ceb
Compare
378fd12
to
d470713
Compare
4f6ed11
to
8e9dbef
Compare
d470713
to
e7f2fcb
Compare
8e9dbef
to
7cc70cd
Compare
e7f2fcb
to
3539f0d
Compare
7cc70cd
to
e65dbc1
Compare
3539f0d
to
39ab6be
Compare
e65dbc1
to
3e0a1c5
Compare
a56fefe
to
ee481c5
Compare
c1fdfd7
to
d2b893f
Compare
323f690
to
e43bcd4
Compare
06b7fa9
to
396e567
Compare
396e567
to
bc1b6ff
Compare
There are some UTF-8 issues with the generated README. EDIT: Fixed in #4051. |
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.
Nice!
I proposed some enhancements in #4051, so please have a look at that one.
Otherwise, this looks really good!
One thing I'm wondering is if in the metadata and README files, we want to note down the date of the download? I think that would be a nice idea.
functions/_common/grapherRenderer.ts
Outdated
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.
Another note for future-us:
We should extract some of this functionality out of grapherRenderer
, and split it up into some separate files for
- parsing (image) options
- initializing grapher
- generating svg/png
- readme/metadata file generation
- csv file generation
e98a00d
to
20a0eba
Compare
20a0eba
to
97595f0
Compare
Enhancements on top of #3613, see the commit messages for details. The biggest change is replacing `jszip` with [`littlezipper`](https://www.npmjs.com/package/littlezipper), which (mostly) uses the browser-inbuilt (and Workers-inbuilt!) `CompressionStream` API for zip generation, which gives us fast, native compression. It's also a good option if we ever should want to create a zip file directly in the browser - it uses `CompressionStream` if available ( = most modern browsers), or otherwise creates an uncompressed zip file as a fallback.
This PR adds functionality to generate a CSV file on the server in a CF worker for the data of any chart. It also allows downloading a metadata.json file, a readme.md and a zip file of all three of these things.
This is in preparation of surfacing these things in the download UI of grapher in the upcoming cycle 2024.6 (#4015). This PR does not make any use of the new CF functions endpoints yet and the download UI is not yet changed.
This PR implements #3648
Testing
To test this, try http get requests against
/grapher/SLUG.zip
,/grapher/SLUG.csv
,/grapher/SLUG.metadata.json
at localhost:8788, or at the staging server linked below.There is also an observable notebook that lets you browse the generated readme files in an easier way: https://observablehq.com/d/d410e9b2d2b7c330