You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the CLI code, when we upload a file, the request body is a stream, and so we're able to listen in on the stream and output progress. We should do the same where possible in the UI. Currently in the UI, the request body is FormData.
This change in the UI will need to happen in packages/jbrowse-plugin-apollo/src/components/AddAssembly.tsx and packages/jbrowse-plugin-apollo/src/components/ImportFeatures.tsx.
To update the progress percentage, call jobsManager.update(job.name, 'message', percent). jobsManager and job already exist in those files, so you won't need to create them.
Unfortunately, currently only Chrome (and other Chromium-based browsers) allow streams in request bodies. So we'll need to do feature detection and fall back to the current method if the browser doesn't support it.
Since this can only be done on HTTP2, we'll need to see if it's possible for our server to support HTTP2. We have a couple different options to try this.
One option is to use the spdy package to add HTTP2 support to express, as is described here.
The other option is to use fastify instead of express. This is supported natively by NestJS as is described here, but with the http2 option set as new FastifyAdapter({http2: true}).
In either case, we should test this locally to see if it works in a development environment without a key and cert file.
In the CLI code, when we upload a file, the request body is a stream, and so we're able to listen in on the stream and output progress. We should do the same where possible in the UI. Currently in the UI, the request body is FormData.
Reference code for the CLI can be found here:
Apollo3/packages/apollo-cli/src/utils.ts
Lines 453 to 505 in 2698455
This change in the UI will need to happen in
packages/jbrowse-plugin-apollo/src/components/AddAssembly.tsx
andpackages/jbrowse-plugin-apollo/src/components/ImportFeatures.tsx
.To update the progress percentage, call
jobsManager.update(job.name, 'message', percent)
.jobsManager
andjob
already exist in those files, so you won't need to create them.Unfortunately, currently only Chrome (and other Chromium-based browsers) allow streams in request bodies. So we'll need to do feature detection and fall back to the current method if the browser doesn't support it.
I found some code here that should work to detect if the browser supports streams in request bodies:
https://github.com/web-platform-tests/wpt/blob/d90f52b5215dca9fd334314b7353a4b57b4719c9/fetch/api/basic/request-upload.h2.any.js#L130-L142
If
supported
is true after running that code, it should use streams, otherwise fall back to FormData.The text was updated successfully, but these errors were encountered: