jeudi 24 janvier 2019

Should the 'main loop' of my bulk import be driven by the front end or backend?

Let me explain.

I'm building an app plugin which let's users bulk import records from CSV. I want to show a success or failure status in (close to) real-time as each record is imported.

The desired flow is that

  1. the user uploads a CSV of the records they want to import.
  2. See's a (paginated ?) webview of all the records parsed from the CSV
  3. User clicks confirm button on webview
  4. The plugin starts the import - creating the records by calling the apps rest api.
  5. a success or failure icon next to each record in the webview as it is processed by the back end.

The method I want to do, which I think would be the simplest, is to loop over the data in the front end, make a request to the backend, and update the UI with the result of the query.

but if I have a lot of records I don't want to upload a large CSV to the backend, send all the data back rendered in a template for the user to verify and then send each record back to the backend one by one. This won't scale well.

It seems like it would be better to have the backend handle the mainllop but then in this case I don't know how I would update the UI on the front end. - I can't use websockets due to client network constraints

How should I architect this? Please note, I'm looking for a simple solution as I am just trying to build a mvp to validate my idea for the plugin.

Edited for spelling and grammar

Aucun commentaire:

Enregistrer un commentaire